@hanzo/app 0.3.93 → 0.3.95
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Account.d.ts +9 -3
- package/dist/Account.js +142 -141
- package/dist/App.js +71 -37
- package/dist/Bar.js +1 -1
- package/dist/Betas.d.ts +1 -1
- package/dist/Betas.js +16 -22
- package/dist/Board.js +113 -47
- package/dist/CalScheduler.d.ts +1 -0
- package/dist/CalScheduler.js +223 -57
- package/dist/Chat.js +432 -153
- package/dist/Contacts.js +35 -31
- package/dist/ContextMenu.js +126 -42
- package/dist/Directory.js +1 -1
- package/dist/Drawer.js +1 -1
- package/dist/Drive.js +351 -119
- package/dist/Gate.js +156 -13
- package/dist/Home.js +31 -53
- package/dist/Inbox.js +29 -15
- package/dist/InlineRename.d.ts +6 -0
- package/dist/InlineRename.js +41 -0
- package/dist/Learning.js +132 -13
- package/dist/Market.js +13 -9
- package/dist/Meet.d.ts +5 -0
- package/dist/Meet.js +75 -51
- package/dist/MoreMenu.d.ts +19 -0
- package/dist/MoreMenu.js +33 -0
- package/dist/NeedMoreUsage.js +2 -2
- package/dist/OrgSwitcher.js +6 -2
- package/dist/Rail.d.ts +73 -7
- package/dist/Rail.js +372 -111
- package/dist/Recents.js +77 -24
- package/dist/RightPane.js +2 -2
- package/dist/Search.d.ts +13 -1
- package/dist/Search.js +366 -50
- package/dist/Setup.js +34 -5
- package/dist/Shared.js +12 -12
- package/dist/Shell.js +210 -151
- package/dist/Sidebar.d.ts +14 -3
- package/dist/Sidebar.js +411 -129
- package/dist/SkipLink.d.ts +8 -0
- package/dist/SkipLink.js +11 -0
- package/dist/Start.js +51 -52
- package/dist/Terminals.js +159 -11
- package/dist/ToBottom.js +1 -1
- package/dist/Upgrade.d.ts +8 -3
- package/dist/Upgrade.js +194 -103
- package/dist/Usage.d.ts +1 -1
- package/dist/Usage.js +186 -82
- package/dist/WalletPill.js +8 -2
- package/dist/Work.js +162 -53
- package/dist/archive.d.ts +8 -0
- package/dist/archive.js +16 -0
- package/dist/bots/Bots.js +1 -1
- package/dist/bots/ComputerDialog.js +53 -26
- package/dist/bots/ConnectorsDialog.js +34 -15
- package/dist/bots/Make.js +5 -1
- package/dist/bots/Panel.js +37 -31
- package/dist/bots/Roster.js +18 -13
- package/dist/bots/Thread.js +54 -27
- package/dist/bots/face.js +6 -2
- package/dist/bots/kit.d.ts +1 -0
- package/dist/bots/kit.js +1 -1
- package/dist/bots/refusal.d.ts +13 -4
- package/dist/bots/refusal.js +62 -8
- package/dist/chord.d.ts +13 -0
- package/dist/chord.js +30 -1
- package/dist/crew.js +47 -4
- package/dist/ground.d.ts +1 -1
- package/dist/ground.js +1 -1
- package/dist/help.d.ts +7 -3
- package/dist/help.js +19 -14
- package/dist/keys.d.ts +28 -0
- package/dist/keys.js +58 -0
- package/dist/lib/arrival.d.ts +5 -0
- package/dist/lib/arrival.js +10 -0
- package/dist/lib/betas.d.ts +2 -0
- package/dist/lib/betas.js +10 -0
- package/dist/lib/branch.d.ts +11 -0
- package/dist/lib/branch.js +11 -0
- package/dist/lib/chatPreferences.d.ts +1 -1
- package/dist/lib/chatPreferences.js +1 -1
- package/dist/lib/dev-mode.d.ts +18 -0
- package/dist/lib/dev-mode.js +102 -0
- package/dist/lib/info-hint.d.ts +7 -0
- package/dist/lib/info-hint.js +8 -0
- package/dist/lib/model-picker.d.ts +2 -0
- package/dist/lib/model-picker.js +12 -0
- package/dist/lib/owners.d.ts +5 -0
- package/dist/lib/owners.js +15 -0
- package/dist/lib/pay.d.ts +2 -0
- package/dist/lib/pay.js +4 -0
- package/dist/lib/todo.d.ts +6 -0
- package/dist/lib/todo.js +37 -25
- package/dist/look.js +39 -8
- package/dist/rail-open.d.ts +9 -0
- package/dist/rail-open.js +34 -0
- package/dist/renaming.d.ts +10 -0
- package/dist/renaming.js +25 -0
- package/dist/thread.d.ts +2 -1
- package/dist/thread.js +85 -44
- package/package.json +11 -11
package/dist/Chat.js
CHANGED
|
@@ -34,7 +34,7 @@ import { useI18n } from "@hanzo/i18n/react";
|
|
|
34
34
|
import { billed, detail, familyOf, ours, planRequired, plainly, refused } from "./failure.js";
|
|
35
35
|
import { Prose } from "./Prose.js";
|
|
36
36
|
import { useAgent, useAi, useChat, } from "@hanzo/ai/react";
|
|
37
|
-
import { Chat as ChatSurface, EFFORTS, Failure, Parts, Tune, useFamilies, words } from "@hanzo/ui/chat";
|
|
37
|
+
import { Chat as ChatSurface, ChatHandoffProvider, EFFORTS, Failure, Parts, Tune, useFamilies, words } from "@hanzo/ui/chat";
|
|
38
38
|
import { carriedIn, carrying, compose, partsOf, said as told, weigh } from "./lib/attach.js";
|
|
39
39
|
import { download, dropped, fileOf, pct, readable, refOf, retrieve } from "./lib/files.js";
|
|
40
40
|
import { conversation, drop, hold, landed, localOf, spend, take, usePane, useWorkFile } from "./pane.js";
|
|
@@ -42,13 +42,13 @@ import { Face, brief as castBrief, join, roleOf, castTurn, roster as rosterLine,
|
|
|
42
42
|
import { cleanForSpeech, speakAgent } from "./speech.js";
|
|
43
43
|
import { AgentMaker, HOUSE, useAgentShelf, useCrew } from "./crew.js";
|
|
44
44
|
import { called } from "./team.js";
|
|
45
|
-
import {
|
|
45
|
+
import { Box, Button, Dialog, DialogContent, DialogTitle, Input, Text, Tooltip, TooltipContent, TooltipTrigger, View, VisuallyHidden, XStack, YStack, toast } from "@hanzo/ui";
|
|
46
46
|
import { useMedia } from "@hanzo/gui";
|
|
47
47
|
import { given, tidy } from "./lib/title.js";
|
|
48
48
|
import { useIam, useIamToken } from "@hanzo/iam/react";
|
|
49
49
|
import { bearer, hasSession, named, org } from "./lib/session.js";
|
|
50
50
|
import { api } from "./lib/api.js";
|
|
51
|
-
import { app, dev, follow, go } from "./lib/host.js";
|
|
51
|
+
import { app, dev, follow, go, visit } from "./lib/host.js";
|
|
52
52
|
import { useHost } from "./host.js";
|
|
53
53
|
import { chats, house, paidPlan, paused, setCreditsAfterAllowance, spends, uncapped, useLimits } from "./lib/limits.js";
|
|
54
54
|
import { LimitedBanner } from "@hanzo/ui/product/LimitedBanner";
|
|
@@ -58,7 +58,12 @@ import { useHydrated } from "./lib/hydrated.js";
|
|
|
58
58
|
import { base, served } from "./lib/ai.js";
|
|
59
59
|
import { onServed } from "./lib/served.js";
|
|
60
60
|
import { refused as worded, speech, useDictation, useTalk, useVoice } from "@hanzo/voice";
|
|
61
|
-
import { Check,
|
|
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";
|
|
62
|
+
import { branched } from "./lib/branch.js";
|
|
63
|
+
import { openModelPicker } from "./lib/model-picker.js";
|
|
64
|
+
import { open as openBoardCard, home as boardHome } from "./lib/todo.js";
|
|
65
|
+
import { useDevMode } from "./lib/dev-mode.js";
|
|
66
|
+
import { InfoHint } from "./lib/info-hint.js";
|
|
62
67
|
import { ENSO } from "./lib/ai.js";
|
|
63
68
|
import { openThread, empty as emptyOpen, useOpen } from "./open.js";
|
|
64
69
|
import { Side } from "./Shell.js";
|
|
@@ -70,9 +75,9 @@ import { keepFile, useAttach, useKeep } from "./keep.js";
|
|
|
70
75
|
import { useKept } from "./kept.js";
|
|
71
76
|
import { dragWindow, toggleWindowMaximize } from "./WindowControls.js";
|
|
72
77
|
import { WalletPill } from "./WalletPill.js";
|
|
73
|
-
import { artifacts, lead, nameOf, PAGE, Panel, PanelToggle, renders,
|
|
74
|
-
import {
|
|
75
|
-
import { Upgrade, useFree } from './Upgrade.js';
|
|
78
|
+
import { artifacts, lead, nameOf, PAGE, Panel, PanelToggle, renders, Summary, useDeck, useKey, Suggestions, useCarry, useLanguage, useMind, useSuggestions, taken, CHAT_MODES, usePanel, frames, name as tabName, } from "@hanzo/build";
|
|
79
|
+
import { payUrl, topUp } from './lib/pay.js';
|
|
80
|
+
import { requestUpgrade, Upgrade, useFree } from './Upgrade.js';
|
|
76
81
|
import { enter, LOGIN } from './lib/destination.js';
|
|
77
82
|
import { first } from './lib/first.js';
|
|
78
83
|
import { BAD } from "./lib/mix.js";
|
|
@@ -300,7 +305,69 @@ function Why({ text }) {
|
|
|
300
305
|
const [open, setOpen] = useState(false);
|
|
301
306
|
if (!text)
|
|
302
307
|
return null;
|
|
303
|
-
return (_jsxs(YStack, { gap: "$1", children: [_jsx(XStack, { render: "button", "aria-expanded": open,
|
|
308
|
+
return (_jsxs(YStack, { gap: "$1", children: [_jsx(XStack, { render: "button", "aria-expanded": open, onClick: () => setOpen((v) => !v), cursor: "pointer", self: "flex-start", px: "$1.5", py: "$0.5", rounded: "$2", hoverStyle: { bg: "$hover" }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: "solid", outlineColor: "var(--ring)" }, "$max-sm": { minH: 44, items: "center" }, children: _jsx(Text, { fontSize: "$2", color: "$soft", children: t(open ? "Hide details" : "Details") }) }), open ? (_jsx(Text, { fontSize: "$2", color: "$soft", children: text })) : null] }));
|
|
309
|
+
}
|
|
310
|
+
/** Subtle hover/focus-reveal actions for a user message: copy with check feedback, and inline edit. */
|
|
311
|
+
function UserTurnActions({ text, onEdit, canEdit, }) {
|
|
312
|
+
const { t } = useI18n();
|
|
313
|
+
const [copied, setCopied] = useState(false);
|
|
314
|
+
useEffect(() => {
|
|
315
|
+
if (!copied)
|
|
316
|
+
return;
|
|
317
|
+
const id = window.setTimeout(() => setCopied(false), 1600);
|
|
318
|
+
return () => window.clearTimeout(id);
|
|
319
|
+
}, [copied]);
|
|
320
|
+
if (!text.trim())
|
|
321
|
+
return null;
|
|
322
|
+
return (_jsxs(XStack, { "data-slot": "user-turn-actions", items: "center", justify: "flex-end", gap: "$1", pt: "$1", opacity: copied ? 1 : 0, "$group-hover": { opacity: 1 }, focusWithinStyle: { opacity: 1 }, $touchable: { opacity: 1 }, "$max-sm": { opacity: 1 }, transition: "quickest", children: [_jsxs(XStack, { render: "button", ...{ type: "button", title: copied ? t("Copied") : t("Copy") }, "data-slot": "user-turn-copy", "aria-label": copied ? t("Copied") : t("Copy message"), onClick: () => {
|
|
323
|
+
void navigator.clipboard?.writeText(text).then(() => setCopied(true), () => toast.error(t("Could not copy")));
|
|
324
|
+
}, items: "center", justify: "center", gap: "$1", height: 26, minW: 26, px: "$1.5", rounded: "$2", cursor: "pointer", bg: copied ? "$raised" : "transparent", borderWidth: 1, borderColor: copied ? "var(--border-strong)" : "transparent", hoverStyle: { bg: "$raised", borderColor: "var(--border-strong)" }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: "solid", outlineColor: "var(--ring)" }, "$max-sm": { minW: 44, minH: 44 }, 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] }), canEdit && onEdit ? (_jsx(XStack, { render: "button", ...{ type: "button", title: t("Edit") }, "data-slot": "user-turn-edit", "aria-label": t("Edit message"), onClick: onEdit, items: "center", justify: "center", width: 26, height: 26, rounded: "$2", cursor: "pointer", bg: "transparent", borderWidth: 1, borderColor: "transparent", hoverStyle: { bg: "$raised", borderColor: "var(--border-strong)" }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: "solid", outlineColor: "var(--ring)" }, "$max-sm": { minW: 44, minH: 44 }, children: _jsx(Pencil, { size: 13, color: "var(--muted-foreground)", "aria-hidden": true }) })) : null] }));
|
|
325
|
+
}
|
|
326
|
+
function plainTurnText(m) {
|
|
327
|
+
if (typeof m.content === "string") {
|
|
328
|
+
return m.role === "user" ? told(m.content).text : m.content;
|
|
329
|
+
}
|
|
330
|
+
if (Array.isArray(m.content)) {
|
|
331
|
+
return words(m.content);
|
|
332
|
+
}
|
|
333
|
+
return "";
|
|
334
|
+
}
|
|
335
|
+
/** Quiet monochrome hover/focus-reveal actions under every completed assistant response. */
|
|
336
|
+
function AssistantTurnActions({ text, latest = false, canRegenerate, onRegenerate, onBranch, onOpen, onOpenInDev, onCreateBoardCard, onSchedule, }) {
|
|
337
|
+
const { t } = useI18n();
|
|
338
|
+
const [copied, setCopied] = useState(false);
|
|
339
|
+
useEffect(() => {
|
|
340
|
+
if (!copied)
|
|
341
|
+
return;
|
|
342
|
+
const id = window.setTimeout(() => setCopied(false), 1600);
|
|
343
|
+
return () => window.clearTimeout(id);
|
|
344
|
+
}, [copied]);
|
|
345
|
+
if (!text.trim())
|
|
346
|
+
return null;
|
|
347
|
+
const actionButton = {
|
|
348
|
+
display: "flex",
|
|
349
|
+
items: "center",
|
|
350
|
+
justify: "center",
|
|
351
|
+
height: 26,
|
|
352
|
+
minW: 26,
|
|
353
|
+
px: "$1.5",
|
|
354
|
+
rounded: "$2",
|
|
355
|
+
cursor: "pointer",
|
|
356
|
+
bg: "transparent",
|
|
357
|
+
borderWidth: 1,
|
|
358
|
+
borderColor: "transparent",
|
|
359
|
+
transition: "quickest",
|
|
360
|
+
hoverStyle: { bg: "$hover", borderColor: "var(--border-strong)" },
|
|
361
|
+
focusVisibleStyle: { outlineWidth: 2, outlineStyle: "solid", outlineColor: "var(--ring)" },
|
|
362
|
+
$touchable: { minW: 44, minH: 44 },
|
|
363
|
+
"$max-sm": { minW: 44, minH: 44 },
|
|
364
|
+
};
|
|
365
|
+
return (_jsxs(XStack, { "data-slot": "assistant-turn-actions", items: "center", justify: "flex-start", gap: "$1", pt: "$1", flexWrap: "wrap", opacity: copied ? 1 : latest ? 0.65 : 0, hoverStyle: { opacity: 1 }, "$group-hover": { opacity: 1 }, focusWithinStyle: { opacity: 1 }, $touchable: { opacity: 0.65 }, "$max-sm": { opacity: 0.65 }, transition: "quickest", children: [_jsx(Box, { render: _jsx("button", { type: "button", title: copied ? t("Copied") : t("Copy") }), "data-slot": "assistant-turn-copy", "aria-label": copied ? t("Copied") : t("Copy response"), onClick: () => {
|
|
366
|
+
void navigator.clipboard?.writeText(text).then(() => {
|
|
367
|
+
setCopied(true);
|
|
368
|
+
toast.success(t("Copied to clipboard"));
|
|
369
|
+
}, () => 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] }));
|
|
304
371
|
}
|
|
305
372
|
/**
|
|
306
373
|
* How long a turn may stream without a word before it is stopped and said to
|
|
@@ -451,7 +518,7 @@ function Chip({ name, type, size, state, sent, file, picture, onOpen, onRemove,
|
|
|
451
518
|
.filter(Boolean)
|
|
452
519
|
.map((part) => (dir === "rtl" ? isolate(part) : part))
|
|
453
520
|
.join(" \u00b7 ");
|
|
454
|
-
const remove = (_jsxs(_Fragment, { children: [onSave ? _jsx(Keep, { name: name, onSave: onSave }) : null, onRemove ? (_jsx(Box, { render: "button", "aria-label": t("Remove {name}", { name }), onClick: onRemove, p: "$1", rounded: "$10", shrink: 0, hoverStyle: { bg: "$hover" }, children: _jsx(X, { size: 12, "aria-hidden": true }) })) : null] }));
|
|
521
|
+
const remove = (_jsxs(_Fragment, { children: [onSave ? _jsx(Keep, { name: name, onSave: onSave }) : null, onRemove ? (_jsx(Box, { render: "button", "aria-label": t("Remove {name}", { name }), onClick: onRemove, p: "$1", rounded: "$10", shrink: 0, cursor: "pointer", hoverStyle: { bg: "$hover" }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: "solid", outlineColor: "var(--ring)" }, children: _jsx(X, { size: 12, "aria-hidden": true }) })) : null] }));
|
|
455
522
|
const marks = {
|
|
456
523
|
role: "listitem",
|
|
457
524
|
"data-slot": "file-chip",
|
|
@@ -461,10 +528,10 @@ function Chip({ name, type, size, state, sent, file, picture, onOpen, onRemove,
|
|
|
461
528
|
...(why ? { title: why } : null),
|
|
462
529
|
};
|
|
463
530
|
if (kind === "file")
|
|
464
|
-
return (_jsxs(XStack, { ...marks, self: "center", items: "center", gap: "$1", paddingInlineEnd: onRemove ? "$1" : "$2.5", rounded: "$10", borderWidth: 1, borderColor: "$borderColor", maxW: 320, children: [_jsxs(XStack, { render: "button", "aria-label": t("Open {name}", { name }), onClick: onOpen, items: "center", gap: "$1.5", paddingInlineStart: "$2.5", py: "$1", minW: 0, cursor: "pointer", children: [_jsx(Paperclip, { size: 12, "aria-hidden": true, color: "var(--muted-foreground)" }), _jsx(Text, { fontSize: "$2", color: "$ink", numberOfLines: 1, children: name }), meta ? (_jsx(Text, { fontSize: "$1", color: bad ? BAD : "$soft", numberOfLines: 1, shrink: 0, children: meta })) : null] }), remove] }));
|
|
531
|
+
return (_jsxs(XStack, { ...marks, self: "center", items: "center", gap: "$1", paddingInlineEnd: onRemove ? "$1" : "$2.5", rounded: "$10", borderWidth: 1, borderColor: "$edge", hoverStyle: { borderColor: "var(--border-strong)" }, maxW: 320, children: [_jsxs(XStack, { render: "button", "aria-label": t("Open {name}", { name }), onClick: onOpen, items: "center", gap: "$1.5", paddingInlineStart: "$2.5", py: "$1", minW: 0, cursor: "pointer", focusVisibleStyle: { outlineWidth: 2, outlineStyle: "solid", outlineColor: "var(--ring)" }, children: [_jsx(Paperclip, { size: 12, "aria-hidden": true, color: "var(--muted-foreground)" }), _jsx(Text, { fontSize: "$2", color: "$ink", numberOfLines: 1, children: name }), meta ? (_jsx(Text, { fontSize: "$1", color: bad ? BAD : "$soft", numberOfLines: 1, shrink: 0, children: meta })) : null] }), remove] }));
|
|
465
532
|
const drawn = kind === "image" && picture && broken !== picture;
|
|
466
533
|
const Glyph = kind === "pdf" ? FileText : ImageMark;
|
|
467
|
-
return (_jsxs(XStack, { ...marks, items: "center", gap: "$1", p: "$1", paddingInlineEnd: onRemove ? "$1" : "$2.5", rounded: "$4", borderWidth: 1, borderColor: "$borderColor", maxW: 280, children: [_jsxs(XStack, { render: "button", "aria-label": t("Open {name}", { name }), onClick: onOpen, items: "center", gap: "$2", minW: 0, cursor: "pointer", children: [_jsx(YStack, { "data-slot": "file-thumb", width: THUMB, height: THUMB, shrink: 0, rounded: "$3", overflow: "hidden", items: "center", justify: "center", gap: "$0.5", borderWidth: drawn ? 0 : 1, borderColor: "$borderColor", children: drawn ? (_jsx(View, { render: _jsx("img", { src: picture, alt: "", loading: "lazy", decoding: "async", onError: () => setBroken(picture) }), width: "100%", height: "100%", objectFit: "cover", display: "block" })) : (_jsxs(_Fragment, { children: [_jsx(Glyph, { size: 18, "aria-hidden": true, color: "var(--muted-foreground)" }), kind === "pdf" ? (_jsx(Text, { fontSize: 9, fontWeight: "600", letterSpacing: 0.5, color: "$soft", children: "PDF" })) : null] })) }), _jsxs(YStack, { minW: 0, gap: "$0.5", children: [_jsx(Text, { fontSize: "$2", color: "$ink", numberOfLines: 1, text: "start", children: name }), meta ? (_jsx(Text, { fontSize: "$1", color: bad ? BAD : "$soft", numberOfLines: 1, text: "start", children: meta })) : null] })] }), remove] }));
|
|
534
|
+
return (_jsxs(XStack, { ...marks, items: "center", gap: "$1", p: "$1", paddingInlineEnd: onRemove ? "$1" : "$2.5", rounded: "$4", borderWidth: 1, borderColor: "$edge", hoverStyle: { borderColor: "var(--border-strong)" }, maxW: 280, children: [_jsxs(XStack, { render: "button", "aria-label": t("Open {name}", { name }), onClick: onOpen, items: "center", gap: "$2", minW: 0, cursor: "pointer", focusVisibleStyle: { outlineWidth: 2, outlineStyle: "solid", outlineColor: "var(--ring)" }, children: [_jsx(YStack, { "data-slot": "file-thumb", width: THUMB, height: THUMB, shrink: 0, rounded: "$3", overflow: "hidden", items: "center", justify: "center", gap: "$0.5", borderWidth: drawn ? 0 : 1, borderColor: "$borderColor", children: drawn ? (_jsx(View, { render: _jsx("img", { src: picture, alt: "", loading: "lazy", decoding: "async", onError: () => setBroken(picture) }), width: "100%", height: "100%", objectFit: "cover", display: "block" })) : (_jsxs(_Fragment, { children: [_jsx(Glyph, { size: 18, "aria-hidden": true, color: "var(--muted-foreground)" }), kind === "pdf" ? (_jsx(Text, { fontSize: 9, fontWeight: "600", letterSpacing: 0.5, color: "$soft", children: "PDF" })) : null] })) }), _jsxs(YStack, { minW: 0, gap: "$0.5", children: [_jsx(Text, { fontSize: "$2", color: "$ink", numberOfLines: 1, text: "start", children: name }), meta ? (_jsx(Text, { fontSize: "$1", color: bad ? BAD : "$soft", numberOfLines: 1, text: "start", children: meta })) : null] })] }), remove] }));
|
|
468
535
|
}
|
|
469
536
|
/**
|
|
470
537
|
* "Save to Library" on a file the reader put into the conversation: pressed, it
|
|
@@ -484,7 +551,7 @@ function Keep({ name, onSave }) {
|
|
|
484
551
|
setState("");
|
|
485
552
|
setWrong(e?.message || t("{name} was not saved.", { name }));
|
|
486
553
|
});
|
|
487
|
-
}, p: "$1", rounded: "$10", shrink: 0, opacity: state === "saving" ? 0.5 : 1, hoverStyle: { bg: "$hover" }, children: state === "saved" ? _jsx(Check, { size: 12, "aria-hidden": true }) : _jsx(LibraryMark, { size: 12, "aria-hidden": true, color: wrong ? BAD : undefined }) }));
|
|
554
|
+
}, p: "$1", rounded: "$10", shrink: 0, cursor: "pointer", opacity: state === "saving" ? 0.5 : 1, hoverStyle: { bg: "$hover" }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: "solid", outlineColor: "var(--ring)" }, children: state === "saved" ? _jsx(Check, { size: 12, "aria-hidden": true }) : _jsx(LibraryMark, { size: 12, "aria-hidden": true, color: wrong ? BAD : undefined }) }));
|
|
488
555
|
}
|
|
489
556
|
/** A file held for the next message: uploading, then indexing, then ready. */
|
|
490
557
|
function HeldChip({ one, onOpen, onRemove, onSave }) {
|
|
@@ -493,7 +560,7 @@ function HeldChip({ one, onOpen, onRemove, onSave }) {
|
|
|
493
560
|
const state = one.state === "uploading" ? one.state : (file?.status ?? one.state);
|
|
494
561
|
const picture = usePicture(kindOf(one.name, one.type) === "image", one.href, file?.id, file);
|
|
495
562
|
// The mark the column's Sources row opens for the same file, so both open it alike.
|
|
496
|
-
const mark = { id: one.id, name: one.name, kind: kindOf(one.name, one.type) === "image" ? "image" : "file", href: one.href || undefined, file: file?.id, mime: one.type };
|
|
563
|
+
const mark = { id: one.id, name: one.name, kind: kindOf(one.name, one.type) === "image" ? "image" : "file", href: one.href || picture || undefined, file: file?.id, mime: one.type };
|
|
497
564
|
return (_jsx(Chip, { name: one.name, type: one.type, size: one.size, state: state, sent: one.sent, file: file ?? (one.error ? { error: one.error } : undefined), picture: picture, onOpen: () => onOpen(mark), onRemove: onRemove,
|
|
498
565
|
// Its bytes are on this machine until the upload lands, and are kept by the workspace file it became.
|
|
499
566
|
onSave: onSave && one.href ? () => onSave(one.href, file?.id ?? one.id) : undefined }));
|
|
@@ -503,7 +570,7 @@ function TurnChip({ f, onOpen, onSave }) {
|
|
|
503
570
|
const api = useAi();
|
|
504
571
|
const live = useWorkFile(f.id);
|
|
505
572
|
const picture = usePicture(kindOf(f.name, f.type) === "image", "", f.id, live);
|
|
506
|
-
const mark = { id: f.id, name: f.name, kind: kindOf(f.name, f.type) === "image" ? "image" : "file", file: f.id, mime: f.type };
|
|
573
|
+
const mark = { id: f.id, name: f.name, kind: kindOf(f.name, f.type) === "image" ? "image" : "file", href: picture || undefined, file: f.id, mime: f.type };
|
|
507
574
|
// The bytes on this machine where this document still holds them, else the workspace's copy.
|
|
508
575
|
const save = onSave ? async () => onSave(localOf(f.id) || (await signedOf(api, f.id, live)), f.id) : undefined;
|
|
509
576
|
return _jsx(Chip, { name: f.name, type: f.type, size: f.size, state: live?.status ?? "ready", sent: 1, file: live, picture: picture, onOpen: () => onOpen(mark), onSave: save });
|
|
@@ -551,6 +618,7 @@ function Thread({ placeholder = message(), initial, anonymous = false, settled =
|
|
|
551
618
|
// pick of one Dev offers too moves Dev's, where it is made, and opening Chat
|
|
552
619
|
// never resets Dev's.
|
|
553
620
|
const [chatPrefs, setChatPrefs] = useChatPreferences();
|
|
621
|
+
const [devMode] = useDevMode();
|
|
554
622
|
const [sidebarClosed] = useKept('hanzo.build.rail', false);
|
|
555
623
|
const ai = useAi();
|
|
556
624
|
const opened = useOpen();
|
|
@@ -632,15 +700,43 @@ function Thread({ placeholder = message(), initial, anonymous = false, settled =
|
|
|
632
700
|
deck.open({ kind: PAGE, title: a.name, body: a.body, type: a.mime });
|
|
633
701
|
setPanel(true);
|
|
634
702
|
}, [deck, setPanel]);
|
|
703
|
+
const [lightbox, setLightbox] = useState(null);
|
|
704
|
+
const downloadLightbox = useCallback(() => {
|
|
705
|
+
if (!lightbox?.url || typeof document === "undefined")
|
|
706
|
+
return;
|
|
707
|
+
const link = document.createElement("a");
|
|
708
|
+
link.href = lightbox.url;
|
|
709
|
+
link.download = lightbox.name || "image";
|
|
710
|
+
link.target = "_blank";
|
|
711
|
+
link.rel = "noopener noreferrer";
|
|
712
|
+
document.body.appendChild(link);
|
|
713
|
+
link.click();
|
|
714
|
+
link.remove();
|
|
715
|
+
}, [lightbox]);
|
|
635
716
|
/**
|
|
636
|
-
* OPENS A FILE A MESSAGE CARRIES
|
|
637
|
-
* a page tab in the side panel
|
|
638
|
-
* a laptop, a sheet on a phone.
|
|
717
|
+
* OPENS A FILE A MESSAGE CARRIES: attached images open in a crisp full-clarity
|
|
718
|
+
* lightbox Dialog; other files open as a page tab in the side panel (`look`).
|
|
639
719
|
*/
|
|
640
720
|
const openFile = useCallback((m) => {
|
|
721
|
+
if (m.kind === "image") {
|
|
722
|
+
const direct = m.href || (m.file ? localOf(m.file) : "");
|
|
723
|
+
if (direct) {
|
|
724
|
+
setLightbox({ name: m.name, url: direct, mime: m.mime });
|
|
725
|
+
return;
|
|
726
|
+
}
|
|
727
|
+
if (m.file) {
|
|
728
|
+
const fileId = m.file;
|
|
729
|
+
setLightbox({ name: m.name, url: "", mime: m.mime });
|
|
730
|
+
void signedOf(ai, fileId).then((url) => setLightbox((cur) => (cur && cur.name === m.name && !cur.url ? { ...cur, url } : cur)), () => {
|
|
731
|
+
setLightbox(null);
|
|
732
|
+
toast.error(t("Could not load image preview"));
|
|
733
|
+
});
|
|
734
|
+
return;
|
|
735
|
+
}
|
|
736
|
+
}
|
|
641
737
|
void look(deck, m, ai);
|
|
642
738
|
setPanel(true);
|
|
643
|
-
}, [deck, ai, setPanel]);
|
|
739
|
+
}, [deck, ai, setPanel, t]);
|
|
644
740
|
/**
|
|
645
741
|
* WHO YOU ARE TALKING TO, when it is somebody rather than the plain model.
|
|
646
742
|
*
|
|
@@ -1026,6 +1122,72 @@ function Thread({ placeholder = message(), initial, anonymous = false, settled =
|
|
|
1026
1122
|
const [dragging, setDragging] = useState(false);
|
|
1027
1123
|
const depth = useRef(0);
|
|
1028
1124
|
useSeed(open ? initial : undefined, setDraft);
|
|
1125
|
+
// Layer 4 cross-surface continuity: consume Design → Chat handoff if present.
|
|
1126
|
+
useEffect(() => {
|
|
1127
|
+
try {
|
|
1128
|
+
const raw = typeof window !== "undefined" ? window.sessionStorage.getItem("hanzo.handoff.chat") : null;
|
|
1129
|
+
if (!raw)
|
|
1130
|
+
return;
|
|
1131
|
+
window.sessionStorage.removeItem("hanzo.handoff.chat");
|
|
1132
|
+
const parsed = JSON.parse(raw);
|
|
1133
|
+
if (parsed?.prompt?.trim())
|
|
1134
|
+
setDraft(parsed.prompt.trim());
|
|
1135
|
+
}
|
|
1136
|
+
catch {
|
|
1137
|
+
// Ignore malformed handoff payloads.
|
|
1138
|
+
}
|
|
1139
|
+
}, [setDraft]);
|
|
1140
|
+
const chatHost = useHost();
|
|
1141
|
+
const openInDev = useCallback((payload) => {
|
|
1142
|
+
try {
|
|
1143
|
+
if (typeof window !== "undefined") {
|
|
1144
|
+
window.sessionStorage.setItem("hanzo.handoff.dev", JSON.stringify({
|
|
1145
|
+
prompt: payload.prompt ?? (payload.title ? `Continue working on ${payload.title}` : "Continue implementing this from Chat:"),
|
|
1146
|
+
code: payload.code ?? "",
|
|
1147
|
+
language: payload.language ?? "",
|
|
1148
|
+
title: payload.title ?? "",
|
|
1149
|
+
ts: Date.now(),
|
|
1150
|
+
}));
|
|
1151
|
+
}
|
|
1152
|
+
}
|
|
1153
|
+
catch {
|
|
1154
|
+
// Ignore storage failures.
|
|
1155
|
+
}
|
|
1156
|
+
visit(chatHost.router, app(""));
|
|
1157
|
+
}, [chatHost.router]);
|
|
1158
|
+
const createBoardCardFromTurn = useCallback((turnText) => {
|
|
1159
|
+
const firstLine = turnText
|
|
1160
|
+
.split("\n")
|
|
1161
|
+
.map((line) => line.replace(/^#+\s*/, "").replace(/[*_`]/g, "").trim())
|
|
1162
|
+
.find(Boolean);
|
|
1163
|
+
const cardTitle = firstLine
|
|
1164
|
+
? firstLine.length > 72
|
|
1165
|
+
? `${firstLine.slice(0, 71).trimEnd()}…`
|
|
1166
|
+
: firstLine
|
|
1167
|
+
: t("Follow-up from Chat");
|
|
1168
|
+
// The first board the server names; a card is not filed on a stand-in.
|
|
1169
|
+
void boardHome(ai)
|
|
1170
|
+
.then((key) => {
|
|
1171
|
+
if (!key)
|
|
1172
|
+
return void toast.error(t("No board yet"));
|
|
1173
|
+
return openBoardCard(ai, key, {
|
|
1174
|
+
title: cardTitle,
|
|
1175
|
+
description: turnText.slice(0, 1200),
|
|
1176
|
+
status: "todo",
|
|
1177
|
+
labels: ["chat"],
|
|
1178
|
+
}).then((card) => {
|
|
1179
|
+
if (card.local)
|
|
1180
|
+
return void toast.error(t("Saved on this device only"));
|
|
1181
|
+
toast.success(t("Added to Board"), {
|
|
1182
|
+
action: {
|
|
1183
|
+
label: t("Open Board"),
|
|
1184
|
+
onClick: () => visit(chatHost.router, "/board"),
|
|
1185
|
+
},
|
|
1186
|
+
});
|
|
1187
|
+
});
|
|
1188
|
+
})
|
|
1189
|
+
.catch(() => toast.error(t("Could not add to Board")));
|
|
1190
|
+
}, [ai, chatHost.router, t]);
|
|
1029
1191
|
const [anonBusy, setAnonBusy] = useState(false);
|
|
1030
1192
|
const [anonGateOpen, setAnonGateOpen] = useState(false);
|
|
1031
1193
|
const anonCountRef = useRef(0);
|
|
@@ -1184,6 +1346,46 @@ function Thread({ placeholder = message(), initial, anonymous = false, settled =
|
|
|
1184
1346
|
if (error && !chat.streaming)
|
|
1185
1347
|
note({ error });
|
|
1186
1348
|
}, [error, chat.streaming, note]);
|
|
1349
|
+
// ZERO-LOST-WORK WALLET REFUSAL RECOVERY: when credits run out, restore the
|
|
1350
|
+
// failed prompt back into the composer draft and show a 1-click recovery strip.
|
|
1351
|
+
const lastSubmittedPromptRef = useRef("");
|
|
1352
|
+
const handledWalletErrorRef = useRef(null);
|
|
1353
|
+
const [walletRecovery, setWalletRecovery] = useState(null);
|
|
1354
|
+
useEffect(() => {
|
|
1355
|
+
setWalletRecovery(null);
|
|
1356
|
+
}, [open, emptied]);
|
|
1357
|
+
useEffect(() => {
|
|
1358
|
+
if (!error || chat.streaming)
|
|
1359
|
+
return;
|
|
1360
|
+
if (!refusalOf(error).wallet)
|
|
1361
|
+
return;
|
|
1362
|
+
if (handledWalletErrorRef.current === error)
|
|
1363
|
+
return;
|
|
1364
|
+
handledWalletErrorRef.current = error;
|
|
1365
|
+
const lastUserTurn = [...turns.current].reverse().find((m) => m.role === "user");
|
|
1366
|
+
const fallbackPrompt = lastUserTurn ? plainTurnText(lastUserTurn).trim() : "";
|
|
1367
|
+
const failedPrompt = lastSubmittedPromptRef.current.trim() || fallbackPrompt;
|
|
1368
|
+
if (failedPrompt) {
|
|
1369
|
+
setDraft((current) => (current.trim() ? current : failedPrompt));
|
|
1370
|
+
}
|
|
1371
|
+
setWalletRecovery({ error, prompt: failedPrompt });
|
|
1372
|
+
}, [error, chat.streaming, setDraft]);
|
|
1373
|
+
const switchModelFromRecovery = useCallback(() => {
|
|
1374
|
+
if (!alreadyEnso && models.some((m) => m.id === ENSO)) {
|
|
1375
|
+
mind.pick(ENSO);
|
|
1376
|
+
toast.success(t("Switched to {model}", { model: nameOf(ENSO, listed) }));
|
|
1377
|
+
setWalletRecovery(null);
|
|
1378
|
+
return;
|
|
1379
|
+
}
|
|
1380
|
+
if (openModelPicker())
|
|
1381
|
+
return;
|
|
1382
|
+
const alt = models.find((m) => m.id !== model);
|
|
1383
|
+
if (alt) {
|
|
1384
|
+
mind.pick(alt.id);
|
|
1385
|
+
toast.success(t("Switched to {model}", { model: nameOf(alt.id, listed) }));
|
|
1386
|
+
setWalletRecovery(null);
|
|
1387
|
+
}
|
|
1388
|
+
}, [alreadyEnso, models, mind, listed, model, t]);
|
|
1187
1389
|
// EVERY SEND THAT SETTLES re-reads the plan's limits: a stream that ended, a
|
|
1188
1390
|
// stop, or a refusal — a 429 for a spent window included, which is read
|
|
1189
1391
|
// again on the pass that delivers it. An error with no stream before it
|
|
@@ -1316,10 +1518,38 @@ function Thread({ placeholder = message(), initial, anonymous = false, settled =
|
|
|
1316
1518
|
const [customTitle, setCustomTitle] = useState("");
|
|
1317
1519
|
const [editingTitle, setEditingTitle] = useState(false);
|
|
1318
1520
|
const [titleDraft, setTitleDraft] = useState("");
|
|
1521
|
+
const [editingTurnId, setEditingTurnId] = useState(null);
|
|
1522
|
+
const [editingTurnDraft, setEditingTurnDraft] = useState("");
|
|
1319
1523
|
useEffect(() => {
|
|
1320
1524
|
setCustomTitle("");
|
|
1321
1525
|
setEditingTitle(false);
|
|
1526
|
+
setEditingTurnId(null);
|
|
1527
|
+
setEditingTurnDraft("");
|
|
1322
1528
|
}, [open, emptied]);
|
|
1529
|
+
const commitEditTurn = useCallback((turnId) => {
|
|
1530
|
+
const next = editingTurnDraft.trim();
|
|
1531
|
+
setEditingTurnId(null);
|
|
1532
|
+
setEditingTurnDraft("");
|
|
1533
|
+
if (!next)
|
|
1534
|
+
return;
|
|
1535
|
+
const list = turns.current;
|
|
1536
|
+
const uIdx = list.findIndex((m) => m.id === turnId);
|
|
1537
|
+
if (uIdx < 0)
|
|
1538
|
+
return;
|
|
1539
|
+
if (anonymous) {
|
|
1540
|
+
apply.current((held) => held.slice(0, uIdx));
|
|
1541
|
+
if (anonCountRef.current > 0)
|
|
1542
|
+
anonCountRef.current -= 1;
|
|
1543
|
+
void sendAnon(next);
|
|
1544
|
+
return;
|
|
1545
|
+
}
|
|
1546
|
+
setFailures((all) => {
|
|
1547
|
+
const { [turnId]: _gone, ...rest } = all;
|
|
1548
|
+
return rest;
|
|
1549
|
+
});
|
|
1550
|
+
apply.current((held) => held.slice(0, uIdx));
|
|
1551
|
+
setQueued(next);
|
|
1552
|
+
}, [editingTurnDraft, anonymous, sendAnon]);
|
|
1323
1553
|
const redoTurn = useCallback((turnId, action) => {
|
|
1324
1554
|
const list = turns.current;
|
|
1325
1555
|
const aIdx = list.findIndex((m) => m.id === turnId);
|
|
@@ -1419,33 +1649,16 @@ function Thread({ placeholder = message(), initial, anonymous = false, settled =
|
|
|
1419
1649
|
void threadActions.rename(baseThread, next);
|
|
1420
1650
|
}
|
|
1421
1651
|
}, [titleDraft, shownTitle, mine, kept, open, anonymous, forgetful, currentThread, threadActions]);
|
|
1652
|
+
// A BRANCH IS A NEW SAVED CHAT holding the conversation up to this answer.
|
|
1422
1653
|
const branchTurn = useCallback((turnId) => {
|
|
1423
|
-
const
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
.filter((m) => m.role === "user" || m.role === "assistant")
|
|
1432
|
-
.map((m) => ({
|
|
1433
|
-
role: m.role,
|
|
1434
|
-
content: typeof m.content === "string" ? m.content : words(m.content),
|
|
1435
|
-
}));
|
|
1436
|
-
if (toRecord.length) {
|
|
1437
|
-
void ai.threads
|
|
1438
|
-
.record(toRecord)
|
|
1439
|
-
.then((newId) => {
|
|
1440
|
-
if (newId) {
|
|
1441
|
-
reopen(newId);
|
|
1442
|
-
void ai.threads.update(newId, { title: branchedTitle }).catch(() => { });
|
|
1443
|
-
}
|
|
1444
|
-
})
|
|
1445
|
-
.catch(() => { });
|
|
1446
|
-
}
|
|
1447
|
-
}
|
|
1448
|
-
}, [shownTitle, anonymous, forgetful, ai, reopen]);
|
|
1654
|
+
const kept = branched(turns.current, turnId, plainTurnText, { anonymous, forgetful });
|
|
1655
|
+
if (!kept)
|
|
1656
|
+
return;
|
|
1657
|
+
ai.threads.record(kept).then((id) => {
|
|
1658
|
+
reopen(id);
|
|
1659
|
+
toast.success(t("Branched into a new chat"));
|
|
1660
|
+
}, () => toast.error(t("Could not branch this chat")));
|
|
1661
|
+
}, [ai, anonymous, forgetful, reopen, t]);
|
|
1449
1662
|
const currentThreadMap = useMemo(() => {
|
|
1450
1663
|
const map = new Map(alone);
|
|
1451
1664
|
if (!map.has(currentThread.id))
|
|
@@ -1518,7 +1731,27 @@ function Thread({ placeholder = message(), initial, anonymous = false, settled =
|
|
|
1518
1731
|
break;
|
|
1519
1732
|
case "archive":
|
|
1520
1733
|
if (!anonymous && !forgetful && (mine || open)) {
|
|
1521
|
-
|
|
1734
|
+
const targetThread = mine ?? currentThread;
|
|
1735
|
+
const wasArchived = Boolean(targetThread.archived);
|
|
1736
|
+
void threadActions.archive(targetThread).then((ok) => {
|
|
1737
|
+
if (!ok)
|
|
1738
|
+
return;
|
|
1739
|
+
if (!wasArchived) {
|
|
1740
|
+
const archivedSnapshot = { ...targetThread, archived: true };
|
|
1741
|
+
toast(t("Archived chat"), {
|
|
1742
|
+
duration: 5000,
|
|
1743
|
+
action: {
|
|
1744
|
+
label: t("Undo"),
|
|
1745
|
+
onClick: () => {
|
|
1746
|
+
void threadActions.archive(archivedSnapshot);
|
|
1747
|
+
},
|
|
1748
|
+
},
|
|
1749
|
+
});
|
|
1750
|
+
}
|
|
1751
|
+
else {
|
|
1752
|
+
toast.success(t("Unarchived chat"));
|
|
1753
|
+
}
|
|
1754
|
+
});
|
|
1522
1755
|
}
|
|
1523
1756
|
break;
|
|
1524
1757
|
case "delete":
|
|
@@ -1598,6 +1831,9 @@ function Thread({ placeholder = message(), initial, anonymous = false, settled =
|
|
|
1598
1831
|
const text = ask.trim();
|
|
1599
1832
|
if (preparing || (!text && !files.length))
|
|
1600
1833
|
return;
|
|
1834
|
+
setWalletRecovery(null);
|
|
1835
|
+
if (text)
|
|
1836
|
+
lastSubmittedPromptRef.current = text;
|
|
1601
1837
|
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);
|
|
1602
1838
|
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
1839
|
const demoNote = isInteractiveDemo
|
|
@@ -1745,7 +1981,7 @@ function Thread({ placeholder = message(), initial, anonymous = false, settled =
|
|
|
1745
1981
|
localStorage.removeItem("hanzo_iam_refresh_token");
|
|
1746
1982
|
}
|
|
1747
1983
|
enter(LOGIN);
|
|
1748
|
-
}, children: t("Sign in") })) : lift ? (_jsx(Button, { size: "sm", variant: "outline", onClick: () => setAsk({ ...lift, model: nameOf(model, listed) }), children: t("Upgrade") })) : how?.visitor ? (_jsx(Button, { size: "sm", variant: "outline", onClick: () => enter(), children: t("Sign in to keep going") })) : (_jsx(
|
|
1984
|
+
}, children: t("Sign in") })) : lift ? (_jsx(Button, { size: "sm", variant: "outline", onClick: () => setAsk({ ...lift, model: nameOf(model, listed) }), children: t("Upgrade") })) : how?.visitor ? (_jsx(Button, { size: "sm", variant: "outline", onClick: () => enter(), children: t("Sign in to keep going") })) : (_jsxs(_Fragment, { children: [_jsx(Button, { size: "sm", "$max-sm": { minH: 44 }, onPress: () => requestUpgrade(), children: t("Add credits") }), _jsx(Button, { size: "sm", variant: "outline", borderColor: "var(--border-strong)", "$max-sm": { minH: 44 }, onPress: switchModelFromRecovery, children: t("Switch model") })] })) })) : null] }) }));
|
|
1749
1985
|
};
|
|
1750
1986
|
// Dev, from the Summary's Create file or site: a move inside the app where the
|
|
1751
1987
|
// host's app reads the path (hanzo.ai), else Dev on hanzo.ai, as the shell's
|
|
@@ -1809,6 +2045,7 @@ function Thread({ placeholder = message(), initial, anonymous = false, settled =
|
|
|
1809
2045
|
setTitleSlot(document.getElementById("hanzo-titlebar-title"));
|
|
1810
2046
|
}, [media.md]);
|
|
1811
2047
|
const inTopChrome = Boolean(media.md && titlebarSlot);
|
|
2048
|
+
const showAccessMode = devMode || carry.on.length > 0 || cast.length > 0 || chatPrefs.approvalMode === "manual";
|
|
1812
2049
|
const composer = {
|
|
1813
2050
|
value: draft,
|
|
1814
2051
|
onChange: setDraft,
|
|
@@ -1825,22 +2062,21 @@ function Thread({ placeholder = message(), initial, anonymous = false, settled =
|
|
|
1825
2062
|
// Private: the frame drops its ground and dashes its edge (@hanzo/ui ≥ 8.29.40); the
|
|
1826
2063
|
// toggled ghost in the head and this frame are the whole of what says it.
|
|
1827
2064
|
forgetful,
|
|
1828
|
-
children: anonymous ? undefined : (_jsxs(XStack, { flex: 1, minW: 0, items: "center", justify: "space-between", gap:
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
// A file or an image pasted into the field is held like a picked one
|
|
1843
|
-
// words paste as words.
|
|
2065
|
+
children: anonymous ? undefined : (_jsxs(XStack, { flex: 1, minW: 0, items: "center", justify: showAccessMode ? "space-between" : "flex-end", gap: "$1.5", flexWrap: "wrap", children: [showAccessMode ? (_jsxs(XStack, { items: "center", gap: "$0.5", minW: 0, children: [_jsxs(XStack, { render: "button", "data-slot": "composer-access-mode", "data-mode": chatPrefs.approvalMode === "manual" ? "manual" : "auto", "aria-label": chatPrefs.approvalMode === "manual" ? t("Ask first") : t("Auto-run"), items: "center", gap: "$1", height: 28, px: "$1.5", rounded: "$3", cursor: "pointer", borderWidth: 1, borderColor: "transparent", transition: "quickest", hoverStyle: { bg: "$hover", borderColor: "var(--border-strong)" }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: "solid", outlineColor: "var(--ring)" }, "$max-sm": { minH: 44 }, onClick: () => {
|
|
2066
|
+
const next = chatPrefs.approvalMode === "manual" ? "auto" : "manual";
|
|
2067
|
+
setChatPrefs({ approvalMode: next });
|
|
2068
|
+
carry.mode.set(next);
|
|
2069
|
+
}, children: [_jsx(ShieldCheck, { size: 13.5, strokeWidth: 1.8, color: "var(--text-secondary)", "aria-hidden": true }), _jsx(Text, { fontSize: "$1", lineHeight: 16, fontWeight: "500", color: "$aside", numberOfLines: 1, children: chatPrefs.approvalMode === "manual" ? t("Ask first") : t("Auto-run") })] }), _jsx(InfoHint, { text: t("Controls whether Hanzo runs tools automatically or asks before each step."), size: 13 })] })) : null, _jsx(XStack, { items: "center", gap: "$1", shrink: 0, minW: 0, children: _jsx(Tune, { mind: { ...mind, models: filteredListed }, effort: {
|
|
2070
|
+
value: chatPrefs.effort || "auto",
|
|
2071
|
+
set: (eff) => {
|
|
2072
|
+
setChatPrefs({ effort: eff });
|
|
2073
|
+
const next = shared(eff);
|
|
2074
|
+
if (next)
|
|
2075
|
+
mind.pace(next);
|
|
2076
|
+
},
|
|
2077
|
+
items: EFFORTS,
|
|
2078
|
+
}, mode: null, limits: limits, onUpgrade: (id) => setAsk({ model: nameOf(id, listed) }) }) })] })),
|
|
2079
|
+
// A file or an image pasted into the field is held like a picked one.
|
|
1844
2080
|
field: {
|
|
1845
2081
|
onPaste: (e) => {
|
|
1846
2082
|
if (!e.clipboardData?.files?.length)
|
|
@@ -1850,8 +2086,8 @@ function Thread({ placeholder = message(), initial, anonymous = false, settled =
|
|
|
1850
2086
|
},
|
|
1851
2087
|
},
|
|
1852
2088
|
// WHAT GOES WITH THE MESSAGE, above the frame and at its width: the
|
|
1853
|
-
// pause and its ways past, one chip a file, and talk mode's words.
|
|
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
|
|
2089
|
+
// 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
|
|
1855
2091
|
? worded(talk.refusal)
|
|
1856
2092
|
: talk.reply
|
|
1857
2093
|
? `Hanzo: ${talk.reply}`
|
|
@@ -1882,7 +2118,6 @@ function Thread({ placeholder = message(), initial, anonymous = false, settled =
|
|
|
1882
2118
|
carry.gear.set({ research: true });
|
|
1883
2119
|
setDraft((prev) => (prev.trim() ? prev : t("Search the web for ")));
|
|
1884
2120
|
},
|
|
1885
|
-
sketch: () => take(at, via),
|
|
1886
2121
|
thinking: {
|
|
1887
2122
|
on: chatPrefs.effort === "max",
|
|
1888
2123
|
set: (on) => {
|
|
@@ -1922,13 +2157,12 @@ function Thread({ placeholder = message(), initial, anonymous = false, settled =
|
|
|
1922
2157
|
],
|
|
1923
2158
|
slash: carry.skills,
|
|
1924
2159
|
at: carry.plugins,
|
|
1925
|
-
|
|
2160
|
+
status: null,
|
|
1926
2161
|
mode: null,
|
|
1927
2162
|
mind: null,
|
|
1928
2163
|
effort: undefined,
|
|
1929
2164
|
chips: anonymous ? undefined : families,
|
|
1930
2165
|
defaults: { chips: false, mode: false, model: false },
|
|
1931
|
-
status: null,
|
|
1932
2166
|
limits,
|
|
1933
2167
|
onUpgrade: (id) => setAsk({ model: nameOf(id, listed) }),
|
|
1934
2168
|
voice,
|
|
@@ -1980,7 +2214,7 @@ function Thread({ placeholder = message(), initial, anonymous = false, settled =
|
|
|
1980
2214
|
}, children: [_jsx(Schedule, { open: plan !== null, onOpenChange: (open) => {
|
|
1981
2215
|
if (!open)
|
|
1982
2216
|
setPlan(null);
|
|
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:
|
|
2217
|
+
}, prompt: plan ?? "", model: model, models: models.map((m) => ({ id: m.id, name: nameOf(m.id, listed) })) }), dragging ? (_jsx(YStack, { "data-slot": "drop-veil", "aria-hidden": true, position: "absolute", t: 0, r: 0, b: 0, l: 0, z: 20, p: "$4", items: "center", justify: "center", bg: "var(--background)", opacity: 0.94, pointerEvents: "none", children: _jsxs(YStack, { items: "center", justify: "center", gap: "$2", px: "$6", py: "$5", maxW: 420, width: "100%", bg: "var(--popover)", borderWidth: 2, borderStyle: "dashed", borderColor: "var(--border-strong)", rounded: "$5", children: [_jsx(XStack, { width: 44, height: 44, rounded: 999, bg: "$panel", borderWidth: 1, borderColor: "var(--border)", items: "center", justify: "center", children: _jsx(Upload, { size: 18, color: "var(--foreground)", "aria-hidden": true }) }), _jsx(Text, { fontSize: "$4", fontWeight: "600", color: "$ink", text: "center", children: t("Drop files, images, or PDFs to attach") }), _jsx(Text, { fontSize: "$2", color: "$soft", text: "center", children: t("Release anywhere in this chat to include them with your next message.") })] }) })) : null, inTopChrome && titleSlot
|
|
1984
2218
|
? 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
2219
|
e.stopPropagation?.();
|
|
1986
2220
|
if (e.key === "Enter") {
|
|
@@ -1991,7 +2225,7 @@ function Thread({ placeholder = message(), initial, anonymous = false, settled =
|
|
|
1991
2225
|
e.preventDefault?.();
|
|
1992
2226
|
setEditingTitle(false);
|
|
1993
2227
|
}
|
|
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" },
|
|
2228
|
+
} })) : 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" }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: "solid", outlineColor: "var(--ring)" }, onClick: () => {
|
|
1995
2229
|
setTitleDraft(shownTitle);
|
|
1996
2230
|
setEditingTitle(true);
|
|
1997
2231
|
}, 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)
|
|
@@ -2002,13 +2236,13 @@ function Thread({ placeholder = message(), initial, anonymous = false, settled =
|
|
|
2002
2236
|
}, children: t("Log in") }), _jsx(Button, { size: "xs", rounded: 9999, px: "$3", "data-slot": "header-signup", onPress: () => {
|
|
2003
2237
|
if (typeof window !== "undefined")
|
|
2004
2238
|
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: 32, height: 32, items: "center", justify: "center", rounded: "$3", bg: "transparent", cursor: "pointer", hoverStyle: { bg: "$hover" }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: "solid", outlineColor: "var(--ring)" },
|
|
2239
|
+
}, 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: 32, height: 32, items: "center", justify: "center", rounded: "$3", bg: "transparent", cursor: "pointer", hoverStyle: { bg: "$hover" }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: "solid", outlineColor: "var(--ring)" }, onClick: () => setForgetful(!forgetful), children: _jsx(Ghost, { size: 16, strokeWidth: 1.75, color: forgetful ? "var(--foreground)" : "var(--muted-foreground)", fill: forgetful ? "currentColor" : "none", "aria-hidden": true }) }) }), _jsx(TooltipContent, { children: forgetful ? t("Private chat is on: this conversation is not saved") : t("Private chat") })] })), open ? _jsx(Share, { thread: open }) : null, _jsx(Summary, { sections: sections, docked: dockSummary, open: summaryOpen, onOpenChange: setSummaryOpen, onOpen: () => setPanel(true), label: t("Summary") }), _jsx(PanelToggle, { open: panel, onToggle: () => setPanel(!panel) })] }) }), titlebarSlot)
|
|
2006
2240
|
: null, inTopChrome && !cast.length ? null : (_jsxs(XStack, { "data-slot": "conversation-head", group: true,
|
|
2007
2241
|
// On the rail's line from a tablet up; a phone's own bar is BAND.
|
|
2008
2242
|
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,
|
|
2009
2243
|
// The last mark's centre INSET from the pane's end edge, as the rail's first is from the
|
|
2010
2244
|
// window's start: half the 32px mark.
|
|
2011
|
-
paddingInlineEnd: INSET - 16, shrink: 0, "data-tauri-drag-region": "deep", onMouseDown: dragWindow, onDoubleClick: toggleWindowMaximize, "$max-md": !mine && !cast.length ? { display: 'none' } : undefined, children: [_jsxs(XStack, { items: "center", gap: "$2", minW: 0, children: [editingTitle && shownTitle && (sidebarClosed || !media.md) ? (_jsx(Input, { "data-slot": "conversation-title-input", "aria-label": t("Chat title"), value: titleDraft, autoFocus: true, maxLength: 200, size: "sm", minW:
|
|
2245
|
+
paddingInlineEnd: INSET - 16, shrink: 0, "data-tauri-drag-region": "deep", onMouseDown: dragWindow, onDoubleClick: toggleWindowMaximize, "$max-md": !mine && !cast.length ? { display: 'none' } : undefined, children: [_jsxs(XStack, { items: "center", gap: "$2", minW: 0, children: [editingTitle && shownTitle && (sidebarClosed || !media.md) ? (_jsx(Input, { "data-slot": "conversation-title-input", "aria-label": t("Chat title"), value: titleDraft, autoFocus: true, maxLength: 200, size: "sm", flex: 1, minW: 120, maxW: 360, onChangeText: setTitleDraft, onBlur: commitTitle, onKeyDown: (e) => {
|
|
2012
2246
|
e.stopPropagation?.();
|
|
2013
2247
|
if (e.key === "Enter") {
|
|
2014
2248
|
e.preventDefault?.();
|
|
@@ -2018,10 +2252,10 @@ function Thread({ placeholder = message(), initial, anonymous = false, settled =
|
|
|
2018
2252
|
e.preventDefault?.();
|
|
2019
2253
|
setEditingTitle(false);
|
|
2020
2254
|
}
|
|
2021
|
-
} })) : shownTitle && (sidebarClosed || !media.md) ? (_jsx(XStack, { render: "button", "data-slot": "conversation-title", "aria-label": shownTitle, items: "center", gap: "$1.5", px: "$2", py: "$1", rounded: "$3", minW: 0, shrink: 1, cursor: "pointer", hoverStyle: { bg: "$hover" },
|
|
2255
|
+
} })) : shownTitle && (sidebarClosed || !media.md) ? (_jsx(XStack, { render: "button", "data-slot": "conversation-title", "aria-label": shownTitle, items: "center", gap: "$1.5", px: "$2", py: "$1", rounded: "$3", minW: 0, shrink: 1, cursor: "pointer", hoverStyle: { bg: "$hover" }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: "solid", outlineColor: "var(--ring)" }, "$max-sm": { minH: 44 }, onClick: () => {
|
|
2022
2256
|
setTitleDraft(shownTitle);
|
|
2023
2257
|
setEditingTitle(true);
|
|
2024
|
-
}, children: _jsx(Text, { fontSize: 15, lineHeight: 20, fontWeight: "500", color: "$ink", numberOfLines: 1, shrink: 1, minW: 0, children: shownTitle }) })) : null, cast.length ? (_jsx(XStack, { role: "list", "aria-label": t("Agents in this chat"), items: "center", gap: "$1.5", minW: 0, overflowX: "auto", "$platform-web": { scrollbarWidth: "none" }, children: cast.map((name) => (_jsxs(XStack, { role: "listitem", items: "center", gap: "$1.5", paddingInlineStart: "$1", paddingInlineEnd: "$0.5", py: "$0.5", rounded: 999, borderWidth: 1, borderColor: "$borderColor", shrink: 0, children: [_jsx(Face, { src: faces[name]?.avatar ?? (name === withWhom ? portrait : undefined), emoji: faces[name]?.emoji ?? (name === withWhom ? persona?.emoji : undefined), name: name, size: 22 }), _jsx(Text, { fontSize: "$2", fontWeight: "600", color: "$color", numberOfLines: 1, display: "none", $sm: { display: "flex" }, children: name }), _jsx(Box, { render: "button", onClick: () => openAgent(name), "aria-label": t("Remove {name} from this chat", { name }), title: t("Remove {name}", { name }), width: 24, height: 24, rounded: 999, items: "center", justify: "center", hoverStyle: { bg: "$hover" }, children: _jsx(X, { size: 13, "aria-hidden": true, color: "var(--soft, var(--muted-foreground))" }) })] }, name))) })) : null] }), _jsxs(XStack, { "data-slot": "conversation-controls", "data-tauri-drag-region": "false", items: "center", gap: 4, shrink: 0, children: [anonymous ? (_jsxs(XStack, { items: "center", gap: "$2", children: [_jsx(Button, { size: "xs", variant: "outline", rounded: 9999, px: "$3", "data-slot": "header-login", onPress: () => {
|
|
2258
|
+
}, children: _jsx(Text, { fontSize: 15, lineHeight: 20, fontWeight: "500", color: "$ink", numberOfLines: 1, shrink: 1, minW: 0, children: shownTitle }) })) : null, cast.length ? (_jsx(XStack, { role: "list", "aria-label": t("Agents in this chat"), items: "center", gap: "$1.5", minW: 0, overflowX: "auto", "$platform-web": { scrollbarWidth: "none" }, children: cast.map((name) => (_jsxs(XStack, { role: "listitem", items: "center", gap: "$1.5", paddingInlineStart: "$1", paddingInlineEnd: "$0.5", py: "$0.5", rounded: 999, borderWidth: 1, borderColor: "$borderColor", shrink: 0, children: [_jsx(Face, { src: faces[name]?.avatar ?? (name === withWhom ? portrait : undefined), emoji: faces[name]?.emoji ?? (name === withWhom ? persona?.emoji : undefined), name: name, size: 22 }), _jsx(Text, { fontSize: "$2", fontWeight: "600", color: "$color", numberOfLines: 1, display: "none", $sm: { display: "flex" }, children: name }), _jsx(Box, { render: "button", onClick: () => openAgent(name), "aria-label": t("Remove {name} from this chat", { name }), title: t("Remove {name}", { name }), width: 24, height: 24, rounded: 999, items: "center", justify: "center", cursor: "pointer", hoverStyle: { bg: "$hover" }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: "solid", outlineColor: "var(--ring)" }, "$max-sm": { minW: 44, minH: 44 }, children: _jsx(X, { size: 13, "aria-hidden": true, color: "var(--soft, var(--muted-foreground))" }) })] }, name))) })) : null] }), _jsxs(XStack, { "data-slot": "conversation-controls", "data-tauri-drag-region": "false", items: "center", gap: 4, shrink: 0, children: [anonymous ? (_jsxs(XStack, { items: "center", gap: "$2", children: [_jsx(Button, { size: "xs", variant: "outline", rounded: 9999, px: "$3", "data-slot": "header-login", onPress: () => {
|
|
2025
2259
|
if (typeof window !== "undefined")
|
|
2026
2260
|
window.location.assign("/login?next=%2Fchat");
|
|
2027
2261
|
}, children: t("Log in") }), _jsx(XStack, { display: "none", $sm: { display: "flex" }, children: _jsx(Button, { size: "xs", rounded: 9999, px: "$3", "data-slot": "header-signup", onPress: () => {
|
|
@@ -2030,90 +2264,135 @@ function Thread({ placeholder = message(), initial, anonymous = false, settled =
|
|
|
2030
2264
|
}, children: t("Sign up for free") }) }), _jsx(XStack, { display: "flex", $sm: { display: "none" }, children: _jsx(Button, { size: "xs", rounded: 9999, px: "$3", "data-slot": "header-signup-compact", onPress: () => {
|
|
2031
2265
|
if (typeof window !== "undefined")
|
|
2032
2266
|
window.location.assign("/signup?next=%2Fchat");
|
|
2033
|
-
}, children: t("Sign up") }) })] })) : free && (sidebarClosed || !media.md) ? (_jsxs(XStack, { render: "button", "data-slot": "header-upgrade", "aria-label": t("Upgrade plan"), items: "center", gap: "$1.5", px: "$2", py: "$1", rounded: "$3", bg: "transparent", cursor: "pointer", hoverStyle: { bg: "$hover" },
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2267
|
+
}, children: t("Sign up") }) })] })) : free && (sidebarClosed || !media.md) ? (_jsxs(XStack, { render: "button", "data-slot": "header-upgrade", "aria-label": t("Upgrade plan"), items: "center", gap: "$1.5", px: "$2", py: "$1", rounded: "$3", bg: "transparent", cursor: "pointer", hoverStyle: { bg: "$hover" }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: "solid", outlineColor: "var(--ring)" }, "$max-sm": { minH: 44 }, onClick: () => window.location.assign(payUrl('/cart', { org: org(), returnUrl: window.location.href })), children: [_jsx(Sparkles, { size: 14, color: "var(--muted-foreground)", "aria-hidden": true }), _jsx(Text, { fontSize: 15, lineHeight: 20, fontWeight: "500", color: "$soft", numberOfLines: 1, children: t("Upgrade plan") })] })) : null, said.length > 0 ? (_jsx(ConversationMenu, { threads: currentThreadMap, active: open || currentThread.id, onSchedule: anonymous || forgetful ? undefined : () => setPlan(lastAsked()), children: _jsx(XStack, {}) })) : (_jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsx(XStack, { render: "button", "data-slot": "header-private-chat", "aria-label": t("Private chat"), "aria-pressed": forgetful, width: 32, height: 32, items: "center", justify: "center", rounded: "$3", bg: "transparent", cursor: "pointer", hoverStyle: { bg: "$hover" }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: "solid", outlineColor: "var(--ring)" }, "$max-sm": { minW: 44, minH: 44 }, onClick: () => setForgetful(!forgetful), children: _jsx(Ghost, { size: 16, strokeWidth: 1.75, color: forgetful ? "var(--foreground)" : "var(--muted-foreground)", fill: forgetful ? "currentColor" : "none", "aria-hidden": true }) }) }), _jsx(TooltipContent, { children: forgetful ? t("Private chat is on: this conversation is not saved") : t("Private chat") })] })), open ? _jsx(Share, { thread: open }) : null, _jsx(XStack, { "$max-md": { display: 'none' }, children: _jsx(Summary, { sections: sections, docked: dockSummary, open: summaryOpen, onOpenChange: setSummaryOpen, onOpen: () => setPanel(true), label: t("Summary") }) }), inTopChrome ? null : (_jsx(XStack, { "$max-md": { display: 'none' }, children: _jsx(PanelToggle, { open: panel, onToggle: () => setPanel(!panel) }) }))] })] })), wide && aside !== null ? (_jsx(Side, { children: _jsx(Panel, { side: deck, kinds: NONE, onHide: () => setPanel(false), label: t("Tabs"), ...browsing }) })) : null, !wide && panel ? _jsx(Panel, { side: deck, kinds: NONE, sheet: true, onHide: () => setPanel(false), label: t("Tabs"), ...browsing }) : null, _jsxs(XStack, { flex: 1, minH: 0, minW: 0, children: [_jsxs(YStack, { ref: talkRef, "data-slot": "talk", flex: 1, minH: 0, minW: 0, position: "relative", children: [_jsx(ChatHandoffProvider, { value: { openInDev }, children: _jsx(ChatSurface, { ...chat, messages: shown, send: guarded,
|
|
2268
|
+
// WHILE NOTHING HAS BEEN SAID, from a tablet up, the opening and the
|
|
2269
|
+
// composer are one pair centred in the pane (`center`: rows `1fr auto auto
|
|
2270
|
+
// 1fr`), so the heading reads close above the field and nothing stands at
|
|
2271
|
+
// the window's foot (owner, 2026-10-30). A phone keeps the composer at the
|
|
2272
|
+
// foot, over the keyboard, from the first moment; once a turn exists every
|
|
2273
|
+
// width does, and the transcript scrolls under it.
|
|
2274
|
+
center: media.md,
|
|
2275
|
+
// AS IT WAS WRITTEN. The package renders a turn's words plainly and
|
|
2276
|
+
// says so — it ships no markdown pipeline because the plugin set is the
|
|
2277
|
+
// surface's to choose — so an answer arrived here reading "```ts" with
|
|
2278
|
+
// the backticks on screen. `Prose` is the site's one renderer, reading
|
|
2279
|
+
// with the same `marked` the legal pages parse with and drawing every
|
|
2280
|
+
// token in gui elements, and the shared view draws through it too.
|
|
2281
|
+
// A user turn's Copy / Edit row sits under its bubble, never inside it (no dead gap in the bubble).
|
|
2282
|
+
turnActions: (turn) => {
|
|
2283
|
+
if (turn.role !== "user")
|
|
2284
|
+
return null;
|
|
2285
|
+
if (String(turn.id).startsWith(`${FAILED}:`))
|
|
2286
|
+
return null;
|
|
2287
|
+
if (editingTurnId === turn.id)
|
|
2288
|
+
return null;
|
|
2289
|
+
if (Array.isArray(turn.content)) {
|
|
2290
|
+
const plain = words(turn.content);
|
|
2291
|
+
return plain.trim() ? _jsx(UserTurnActions, { text: plain, canEdit: false }) : null;
|
|
2292
|
+
}
|
|
2293
|
+
const text = typeof turn.content === "string" ? turn.content : "";
|
|
2294
|
+
if (!text)
|
|
2295
|
+
return null;
|
|
2296
|
+
const read = told(text);
|
|
2062
2297
|
if (read.carried)
|
|
2063
|
-
return
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2298
|
+
return _jsx(UserTurnActions, { text: read.text, canEdit: false });
|
|
2299
|
+
return (_jsx(UserTurnActions, { text: text, canEdit: !chat.streaming && !anonBusy, onEdit: () => {
|
|
2300
|
+
setEditingTurnId(turn.id);
|
|
2301
|
+
setEditingTurnDraft(text);
|
|
2302
|
+
} }));
|
|
2303
|
+
}, body: (turn) => {
|
|
2304
|
+
if (String(turn.id).startsWith(`${FAILED}:`)) {
|
|
2305
|
+
const question = shown.find((one) => one.id === String(turn.id).slice(FAILED.length + 1));
|
|
2306
|
+
return question ? failure(question) : null;
|
|
2307
|
+
}
|
|
2308
|
+
const isLastTurn = shown[shown.length - 1]?.id === turn.id;
|
|
2309
|
+
const isStreamingThisTurn = Boolean((chat.streaming || anonBusy) && isLastTurn);
|
|
2310
|
+
// A QUESTION THAT CARRIED PICTURES draws them beside its words.
|
|
2311
|
+
if (turn.role === "user" && Array.isArray(turn.content)) {
|
|
2312
|
+
const parts = partsOf(turn.content);
|
|
2313
|
+
return (_jsx(YStack, { gap: "$1", "data-turn-id": String(turn.id), "data-turn-role": turn.role, children: _jsx(Parts, { parts: parts, prose: (text) => _jsx(Prose, { text: text }) }) }));
|
|
2314
|
+
}
|
|
2315
|
+
const said = typeof turn.content === "string" ? turn.content : "";
|
|
2316
|
+
// A QUESTION THAT CARRIED FILES draws its words and the files' chips;
|
|
2317
|
+
// the passages it handed the model are the model's to read, not ours.
|
|
2318
|
+
if (turn.role === "user" && said) {
|
|
2319
|
+
const read = told(said);
|
|
2320
|
+
if (read.carried)
|
|
2321
|
+
return (_jsx(YStack, { gap: "$1", "data-turn-id": String(turn.id), "data-turn-role": turn.role, children: _jsx(Carried, { text: read.text, attached: read.carried.attached, reused: read.carried.reused, onOpen: openFile, onSave: anonymous ? undefined : (url, id, f) => keepOne(url, id, f.name, f.type) }) }));
|
|
2322
|
+
if (editingTurnId === turn.id) {
|
|
2323
|
+
return (_jsxs(YStack, { gap: "$2", width: "100%", minW: 240, maxW: 560, "data-slot": "user-turn-editor", children: [_jsx(Input, { autoFocus: true, value: editingTurnDraft, onChangeText: setEditingTurnDraft, "aria-label": t("Edit message"), borderColor: "var(--border-strong)", focusVisibleStyle: { outlineWidth: 2, outlineStyle: "solid", outlineColor: "var(--ring)" }, onKeyDown: (e) => {
|
|
2324
|
+
if (e.key === "Escape") {
|
|
2325
|
+
e.preventDefault?.();
|
|
2326
|
+
setEditingTurnId(null);
|
|
2327
|
+
setEditingTurnDraft("");
|
|
2328
|
+
}
|
|
2329
|
+
else if (e.key === "Enter" && !e.shiftKey && !e.nativeEvent?.isComposing) {
|
|
2330
|
+
e.preventDefault?.();
|
|
2331
|
+
commitEditTurn(turn.id);
|
|
2332
|
+
}
|
|
2333
|
+
} }), _jsxs(XStack, { gap: "$1.5", justify: "flex-end", flexWrap: "wrap", children: [_jsx(Button, { size: "xs", variant: "outline", rounded: 999, onPress: () => {
|
|
2334
|
+
setEditingTurnId(null);
|
|
2335
|
+
setEditingTurnDraft("");
|
|
2336
|
+
}, children: t("Cancel") }), _jsx(Button, { size: "xs", rounded: 999, disabled: !editingTurnDraft.trim(), onPress: () => commitEditTurn(turn.id), children: t("Send") })] })] }));
|
|
2337
|
+
}
|
|
2338
|
+
return (_jsx(YStack, { gap: "$1", "data-turn-id": String(turn.id), "data-turn-role": turn.role, children: _jsx(Prose, { text: said }) }));
|
|
2339
|
+
}
|
|
2340
|
+
// WHILE THE ANSWER HAS NO WORDS YET: who is answering (the agents the
|
|
2341
|
+
// question addresses, or the whole cast when it names nobody), and the
|
|
2342
|
+
// model's reasoning as it streams (`reasoning` on the turn), dimmed and
|
|
2343
|
+
// cut to its last lines.
|
|
2344
|
+
const thought = turn.role === "assistant" && !said && chat.streaming ? (turn.reasoning ?? "").trim() : "";
|
|
2345
|
+
if (turn.role === "assistant" && !said && chat.streaming && (cast.length || thought)) {
|
|
2346
|
+
const q = [...shown].reverse().find((one) => one.role === "user");
|
|
2347
|
+
const whom = cast.length ? addressed(words(q?.content), cast) : [];
|
|
2348
|
+
return (_jsxs(YStack, { gap: "$1", "data-slot": "thinking", children: [_jsx(Text, { fontSize: "$2", color: "$soft", children: whom.length
|
|
2349
|
+
? whom.length > 1
|
|
2350
|
+
? thought
|
|
2351
|
+
? t("{names} are thinking…", { names: join(whom, t) })
|
|
2352
|
+
: t("{names} are answering…", { names: join(whom, t) })
|
|
2353
|
+
: thought
|
|
2354
|
+
? t("{names} is thinking…", { names: join(whom, t) })
|
|
2355
|
+
: t("{names} is answering…", { names: join(whom, t) })
|
|
2356
|
+
: t("Thinking…") }), thought ? (_jsx(Text, { fontSize: "$2", color: "$soft", opacity: 0.72, "data-slot": "thought", children: thought.length > THOUGHT ? `…${thought.slice(-THOUGHT).replace(/^\S*\s/, "")}` : thought })) : null] }));
|
|
2357
|
+
}
|
|
2358
|
+
const latestAssistantId = [...shown].reverse().find((one) => one.role === "assistant")?.id;
|
|
2359
|
+
const isLatestAssistant = turn.role === "assistant" && turn.id === latestAssistantId;
|
|
2360
|
+
// A CAST'S ANSWER IS SEVERAL PEOPLE'S. Each opens a line with their
|
|
2361
|
+
// name, as the brief asks, so each is drawn under their own face and
|
|
2362
|
+
// read in their own voice. A reply that names nobody is drawn whole.
|
|
2363
|
+
const parts = turn.role === "assistant" ? speakers(said, known) : null;
|
|
2364
|
+
if (parts && parts.some((part) => part.who)) {
|
|
2365
|
+
// Asked and silent: an agent the question addressed who has no part
|
|
2366
|
+
// in this reply.
|
|
2367
|
+
const at = shown.findIndex((one) => one.id === turn.id);
|
|
2368
|
+
const q = shown.slice(0, at).reverse().find((one) => one.role === "user");
|
|
2369
|
+
const silent = cast.length > 1 && !(chat.streaming && at === shown.length - 1)
|
|
2370
|
+
? addressed(words(q?.content), cast).filter((name) => !parts.some((part) => part.who?.toLowerCase() === name.toLowerCase()))
|
|
2371
|
+
: [];
|
|
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)] }));
|
|
2373
|
+
}
|
|
2374
|
+
const ms = turn.durationMs;
|
|
2375
|
+
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] }));
|
|
2377
|
+
},
|
|
2378
|
+
// The page's ONE heading, and it belongs to the empty transcript rather
|
|
2379
|
+
// than to a signed-out branch — the branch is gone, and the heading went
|
|
2380
|
+
// with it when it did. `Ask` passes its own, because the page embedding
|
|
2381
|
+
// it already has an `<h1>` and a second is the defect that took the
|
|
2382
|
+
// landings off /chat and /dev.
|
|
2383
|
+
empty: heading === null ? undefined : (_jsxs(YStack, { "data-slot": "opening", items: "center", justify: "flex-end", width: "100%", height: "100%", pt: "$6", pb: "$2", px: "$4", "$max-sm": { px: "$3", pt: "$4" }, children: [cast.length > 1 ? (_jsx(XStack, { items: "center", justify: "center", mb: "$4", children: cast.map((name, i) => (_jsx(Box, { marginInlineStart: i ? -16 : 0, rounded: 40, borderWidth: 2, borderColor: "$background", z: cast.length - i, children: _jsx(Face, { src: faces[name]?.avatar, emoji: faces[name]?.emoji, name: name, size: 72 }) }, name))) })) : portrait ? (_jsx(Box, { width: 160, height: 160, rounded: 24, overflow: "hidden", borderWidth: 1, borderColor: "var(--border-strong)", boxShadow: "var(--shadow-lg)", mb: "$4", bg: "$raised", children: _jsx(View, { render: _jsx("img", { src: portrait, alt: withWhom }), width: "100%", height: "100%", objectFit: "cover" }) })) : null, cast.length === 1 && !portrait ? (_jsx(Box, { mb: "$3", children: _jsx(Face, { emoji: mate?.emoji ?? persona?.emoji, name: withWhom, size: 72 }) })) : null, cast.length === 0 && !portrait ? (_jsx(Box, { mb: "$3", "data-slot": "opening-mark", children: _jsx(ProviderMark, { org: "hanzo", size: 44, ink: true }) })) : null, _jsx(Text, { render: "h1", fontSize: "$7", lineHeight: "$7", fontWeight: "700", color: "$ink", text: "center", mb: "$2", "$max-sm": { fontSize: "$6", lineHeight: "$6" }, children: join(cast, t) || heading || (firstName ? t("Good to see you, {name}. What’s next?", { name: firstName }) : t("What’s next?")) }), cast.length === 1 && (mate?.description ?? persona?.description) ? (_jsx(Text, { fontSize: "$3", color: "$soft", text: "center", maxW: 500, mb: "$4", lineHeight: "$4", children: mate?.description ?? persona?.description })) : null] })),
|
|
2384
|
+
// The transcript reads at the same measure as Composer (`--container-prose`, 48rem),
|
|
2385
|
+
// so user bubbles, assistant output cards, and the composer share exact left/right edges.
|
|
2386
|
+
gap: 28, column: { maxW: "var(--container-prose, 48rem)", px: "$4", "$max-sm": { px: "$3" } }, composer: composer }) }), _jsx(ToBottom, { within: talkBox })] }), dockSummary && summaryOpen ? (_jsx(OutputsCard, { sections: sections, label: t("Summary"), onOpen: () => setPanel(true), onClose: () => setSummaryOpen(false) })) : null] }), _jsx(AgentMaker, {}), carry.dialog, _jsx(Dialog, { open: anonPluginsOpen, onOpenChange: setAnonPluginsOpen, children: _jsxs(DialogContent, { maxW: 480, width: "calc(100vw - 24px)", gap: "$3", "data-slot": "anon-plugins-dialog", children: [_jsx(DialogTitle, { children: t("Plugins & skills") }), _jsx(Text, { fontSize: "$2", color: "$soft", children: t("Enable plugins and skills for this conversation, or type / and @ in the composer.") }), _jsxs(YStack, { maxH: 320, overflow: "scroll", gap: "$1.5", children: [carry.plugins.rows.map((p) => (_jsxs(XStack, { render: "button", onClick: () => carry.plugins.pick(p.id), items: "center", justify: "space-between", p: "$2.5", rounded: "$3", borderWidth: 1, borderColor: p.on ? "$ink" : "$edge", bg: p.on ? "$hover" : "transparent", hoverStyle: { bg: "$hover", borderColor: "var(--border-strong)" }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: "solid", outlineColor: "var(--ring)" }, "$max-sm": { minH: 44 }, cursor: "pointer", children: [_jsxs(XStack, { items: "center", gap: "$2.5", minW: 0, flex: 1, children: [p.icon, _jsxs(YStack, { minW: 0, flex: 1, children: [_jsx(Text, { fontSize: "$2", fontWeight: "600", color: "$ink", numberOfLines: 1, children: p.label }), p.note ? (_jsx(Text, { fontSize: "$1", color: "$soft", numberOfLines: 1, children: p.note })) : null] })] }), _jsx(Text, { fontSize: "$1", fontWeight: "600", color: p.on ? "$ink" : "$soft", children: p.on ? t("On") : t("Plugin") })] }, `plugin:${p.id}`))), carry.skills.rows.slice(0, 24).map((s) => (_jsxs(XStack, { render: "button", onClick: () => carry.skills.pick(s.id), items: "center", justify: "space-between", p: "$2", rounded: "$3", borderWidth: 1, borderColor: s.on ? "$ink" : "$edge", bg: s.on ? "$hover" : "transparent", hoverStyle: { bg: "$hover", borderColor: "var(--border-strong)" }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: "solid", outlineColor: "var(--ring)" }, "$max-sm": { minH: 44 }, cursor: "pointer", children: [_jsxs(XStack, { items: "center", gap: "$2", minW: 0, flex: 1, children: [s.icon, _jsxs(Text, { fontSize: "$2", color: "$ink", numberOfLines: 1, children: ["/", s.label] })] }), _jsx(Text, { fontSize: "$1", fontWeight: "600", color: s.on ? "$ink" : "$soft", children: s.on ? t("On") : t("Skill") })] }, `skill:${s.id}`)))] })] }) }), _jsx(Dialog, { open: anonGateOpen, onOpenChange: setAnonGateOpen, children: _jsxs(DialogContent, { maxW: 480, width: "calc(100vw - 24px)", rounded: "$6", gap: "$3.5", children: [_jsx(DialogTitle, { children: t("Sign in to continue chatting") }), _jsx(Text, { fontSize: "$3", color: "$soft", lineHeight: "$4", children: t("Sign in or create a free Hanzo account to save this conversation and continue chatting.") }), _jsxs(YStack, { gap: "$2", pt: "$1", children: [_jsx(Button, { variant: "primary", size: "lg", width: "100%", onPress: () => window.location.assign("/signup?next=%2Fchat"), children: t("Create free account") }), _jsx(Button, { variant: "outline", size: "default", width: "100%", onPress: () => enter(LOGIN), children: t("Sign in") })] }), _jsxs(YStack, { gap: "$2", pt: "$2.5", borderTopWidth: 1, borderColor: "$borderColor", children: [_jsx(Text, { fontSize: "$1", fontWeight: "500", color: "$soft", children: t("Need more capacity? Upgrade anytime") }), _jsx(XStack, { gap: "$2", flexWrap: "wrap", children: [
|
|
2110
2387
|
["Go", "Pro"],
|
|
2111
2388
|
["Dev", "Max"],
|
|
2112
|
-
].flat().map((label) => (_jsx(XStack, { render: "button",
|
|
2389
|
+
].flat().map((label) => (_jsx(XStack, { render: "button", onClick: () => {
|
|
2113
2390
|
setAnonGateOpen(false);
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2391
|
+
requestUpgrade({ tier: label.toLowerCase() });
|
|
2392
|
+
}, flex: 1, minW: 88, px: "$2.5", py: "$2", rounded: "$4", borderWidth: 1, borderColor: "var(--border-strong)", items: "center", justify: "center", cursor: "pointer", transition: "quickest", hoverStyle: { bg: "$hover", borderColor: "$ink" }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: "solid", outlineColor: "var(--ring)" }, "$max-sm": { minH: 44 }, children: _jsx(Text, { fontSize: "$2", fontWeight: "600", color: "$ink", children: label }) }, label))) })] })] }) }), _jsx(Dialog, { open: lightbox !== null, onOpenChange: (isOpen) => {
|
|
2393
|
+
if (!isOpen)
|
|
2394
|
+
setLightbox(null);
|
|
2395
|
+
}, children: _jsxs(DialogContent, { "data-slot": "image-lightbox", showCloseButton: false, maxW: 900, width: "calc(100vw - 24px)", maxH: "90dvh", p: "$4", gap: "$3", rounded: "$5", bg: "var(--popover)", borderWidth: 1, borderColor: "var(--border-strong)", children: [_jsxs(XStack, { items: "center", justify: "space-between", gap: "$3", children: [_jsx(DialogTitle, { fontSize: "$3", fontWeight: "600", color: "$ink", numberOfLines: 1, flex: 1, minW: 0, children: lightbox?.name ?? t("Image preview") }), _jsxs(XStack, { items: "center", gap: "$2", shrink: 0, children: [_jsxs(Button, { size: "sm", variant: "outline", rounded: 999, borderColor: "var(--border-strong)", disabled: !lightbox?.url, "$max-sm": { minH: 44 }, onPress: downloadLightbox, children: [_jsx(Download, { size: 14, "aria-hidden": true }), t("Download")] }), _jsxs(Button, { size: "sm", variant: "outline", rounded: 999, borderColor: "var(--border-strong)", "aria-label": t("Close"), "$max-sm": { minH: 44 }, onPress: () => setLightbox(null), children: [_jsx(X, { size: 14, "aria-hidden": true }), t("Close")] })] })] }), _jsx(YStack, { items: "center", justify: "center", width: "100%", minH: 220, maxH: "72dvh", overflow: "hidden", rounded: "$4", bg: "var(--background)", borderWidth: 1, borderColor: "var(--border)", p: "$2", children: lightbox?.url ? (_jsx(View, { render: _jsx("img", { src: lightbox.url, alt: lightbox.name }), maxW: "100%", maxH: "68dvh", objectFit: "contain", display: "block", rounded: "$3" })) : (_jsx(Text, { fontSize: "$2", color: "$soft", children: t("Loading preview…") })) })] }) }), _jsx(Upgrade, { ask: ask, onClose: () => setAsk(null) }), _jsx(NeedMoreUsageModal, { open: needMoreUsageOpen, onClose: () => setNeedMoreUsageOpen(false), resetsAt: pause?.resets_at ?? simulatedResetAt, onBuyCredits: async () => {
|
|
2117
2396
|
setActWrong("");
|
|
2118
2397
|
const hasCreditsReady = Boolean(pause?.actions?.some((a) => a.kind === "credits"));
|
|
2119
2398
|
await setCreditsAfterAllowance(true).catch(() => { });
|