@hanzo/app 0.3.5 → 0.3.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/Chat.js CHANGED
@@ -27,7 +27,7 @@ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-run
27
27
  // branch is gone. If the gateway refuses an anonymous free turn, that answer
28
28
  // belongs in the thread where the reader can see it, not in a caption that
29
29
  // pre-emptively refuses on the gateway's behalf.
30
- import { useCallback, useContext, useEffect, useMemo, useRef, useState } from "react";
30
+ import { useCallback, useEffect, useMemo, useRef, useState } from "react";
31
31
  import { english, isolate, phrase } from "@hanzo/i18n";
32
32
  import { useI18n } from "@hanzo/i18n/react";
33
33
  import { billed, detail, familyOf, planRequired, plainly, refused } from "./failure.js";
@@ -59,7 +59,7 @@ import { refused as worded, speech, useDictation, useTalk, useVoice } from "@han
59
59
  import { Check, Clock, FileText, Ghost, Image as ImageMark, Library as LibraryMark, Paperclip, Sparkles, X } from "lucide-react";
60
60
  import { FREE, ENSO } from "./lib/ai.js";
61
61
  import { openThread, useOpen } from "./open.js";
62
- import { Side, Framed } from "./Shell.js";
62
+ import { Side } from "./Shell.js";
63
63
  import { SEED, look, useSections, useSites } from "./RightPane.js";
64
64
  import { Share } from "./Share.js";
65
65
  import { ConversationMenu, ThreadMore, useThreadList } from "./thread.js";
@@ -73,7 +73,7 @@ import { enter, LOGIN } from './lib/destination.js';
73
73
  import { first } from './lib/first.js';
74
74
  import { BAD } from "./lib/mix.js";
75
75
  import { brand } from './where.js';
76
- import { BAND, HEAD, TOUCH_HEAD, inPane } from './ground.js';
76
+ import { BAND, HEAD, INSET, TOUCH_HEAD, inPane } from './ground.js';
77
77
  import { UsageControl } from './Usage.js';
78
78
  import { shared, useChatPreferences } from './lib/chatPreferences.js';
79
79
  import { handleHint } from './hint.js';
@@ -512,8 +512,6 @@ function Thread({ placeholder = message(), initial, anonymous = false, heading,
512
512
  // never resets Dev's.
513
513
  const [chatPrefs, setChatPrefs] = useChatPreferences();
514
514
  const ai = useAi();
515
- // In the app's frame the composer floats on the pane as a pane of its own.
516
- const framed = useContext(Framed);
517
515
  const opened = useOpen();
518
516
  const { thread: open, open: reopen, agents: cast, openAgent, seat, emptied, aside, showAside, showSettings } = opened;
519
517
  // What the conversation carries beside its words (@hanzo/build `useCarry`):
@@ -1401,9 +1399,11 @@ function Thread({ placeholder = message(), initial, anonymous = false, heading,
1401
1399
  // (the defaults @hanzo/ui and @hanzo/build each call ASK), said here so both are the reader's.
1402
1400
  label: t("Ask anything"),
1403
1401
  placeholder: t("Type / for skills"),
1404
- // At the thread's measure, and in the app's frame floating on the pane as a pane of its own.
1402
+ // At the thread's measure.
1405
1403
  column: true,
1406
- framed,
1404
+ // Private: the frame drops its ground and dashes its edge (@hanzo/ui ≥ 8.29.40); the
1405
+ // toggled ghost in the head and this frame are the whole of what says it.
1406
+ forgetful,
1407
1407
  // A file or an image pasted into the field is held like a picked one;
1408
1408
  // words paste as words.
1409
1409
  field: {
@@ -1483,13 +1483,7 @@ function Thread({ placeholder = message(), initial, anonymous = false, heading,
1483
1483
  onLanguage: speakIn,
1484
1484
  talk,
1485
1485
  // While nothing has been said: what is worth doing next.
1486
- starters: said.length === 0
1487
- ? forgetful
1488
- ? (_jsxs(XStack, { items: "center", justify: "center", gap: "$2", py: "$2", px: "$3", rounded: "$3", bg: "var(--white-05)", borderWidth: 1, borderColor: "$borderColor", children: [_jsx(Ghost, { size: 14, strokeWidth: 1.75, color: "var(--primary)" }), _jsx(Text, { fontSize: "$2", color: "$soft", children: t("Private chat is active. Messages are temporary and won't be saved.") })] }))
1489
- : !anonymous
1490
- ? _jsx(Suggestions, { rows: hints.rows, onAct: hint, onDismiss: hints.dismiss })
1491
- : undefined
1492
- : undefined,
1486
+ starters: said.length === 0 && !anonymous && !forgetful ? _jsx(Suggestions, { rows: hints.rows, onAct: hint, onDismiss: hints.dismiss }) : undefined,
1493
1487
  };
1494
1488
  return (_jsxs(YStack, { width: "100%", height: "100%", minH: 0, position: "relative", "data-slot": "conversation",
1495
1489
  // A LINK IN AN ANSWER OPENS IN A TAB beside the conversation when the tab
@@ -1535,7 +1529,10 @@ function Thread({ placeholder = message(), initial, anonymous = false, heading,
1535
1529
  setPlan(null);
1536
1530
  }, prompt: plan ?? "", model: model, models: models.map((m) => ({ id: m.id, name: nameOf(m.id, listed) })) }), dragging ? (_jsx(YStack, { "aria-hidden": true, position: "absolute", t: 0, r: 0, b: 0, l: 0, z: 10, items: "center", justify: "center", bg: "var(--surface-scrim)", borderWidth: 2, borderStyle: "dashed", borderColor: "$borderColor", rounded: "var(--pane-round)", pointerEvents: "none", children: _jsxs(XStack, { items: "center", gap: "$2", px: "$4", py: "$2.5", rounded: "$10", bg: "$background", borderWidth: 1, borderColor: "$borderColor", children: [_jsx(Paperclip, { size: 15, "aria-hidden": true }), _jsx(Text, { fontSize: "$4", color: "$ink", children: t("Drop files to attach") })] }) })) : null, _jsxs(XStack, { "data-slot": "conversation-head",
1537
1531
  // On the rail's line from a tablet up (HEAD, less the pane's edge); a phone's own bar is BAND.
1538
- height: BAND, $md: { height: inPane(HEAD) }, $touchable: { height: inPane(TOUCH_HEAD) }, display: "grid", gridTemplateColumns: "minmax(0, 1fr) auto", items: "center", gap: "$3", paddingInlineStart: "$4", paddingInlineEnd: "$2", 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: [mine ? (_jsx(Text, { fontSize: 15, lineHeight: 20, color: "$ink", numberOfLines: 1, shrink: 1, minW: 0, children: tidy(mine.title) })) : 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: [free ? (_jsxs(Button, { size: "xs", variant: "outline", "data-slot": "header-upgrade", gap: "$1.5", px: "$2.5", py: "$1", rounded: "$4", cursor: "pointer", hoverStyle: { bg: 'var(--white-10)' }, onPress: () => window.location.assign(payUrl('/cart', { org: org(), returnUrl: window.location.href })), "aria-label": t("Upgrade plan"), children: [_jsx(Sparkles, { size: 13, color: "var(--primary)", "aria-hidden": true }), _jsx(Text, { fontSize: "$1", fontWeight: "600", color: "$ink", children: t("Upgrade plan") })] })) : null, open ? _jsx(Share, { thread: open }) : 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)" }, onPress: () => setForgetful(!forgetful), children: _jsx(Ghost, { size: 16, strokeWidth: 1.75, color: forgetful ? "var(--foreground)" : "var(--muted-foreground)", fill: forgetful ? "currentColor" : "none", "aria-hidden": true }) }) }), _jsx(TooltipContent, { children: forgetful ? t("Private chat is on: this conversation is not saved") : t("Private chat") })] })), _jsx(XStack, { "$max-md": { display: 'none' }, children: _jsx(Summary, { sections: sections, onOpen: () => setPanel(true), label: t("Summary") }) }), _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, _jsx(YStack, { "data-slot": "talk", flex: 1, minH: 0, children: _jsx(ChatSurface, { ...chat, messages: shown, send: guarded,
1532
+ height: BAND, $md: { height: inPane(HEAD) }, $touchable: { height: inPane(TOUCH_HEAD) }, display: "grid", gridTemplateColumns: "minmax(0, 1fr) auto", items: "center", gap: "$3", paddingInlineStart: "$4",
1533
+ // The last mark's centre INSET from the pane's end edge, as the rail's first is from the
1534
+ // window's start: the edge's 1px, then half the 32px mark.
1535
+ paddingInlineEnd: INSET - 1 - 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: [mine ? (_jsx(Text, { fontSize: 15, lineHeight: 20, color: "$ink", numberOfLines: 1, shrink: 1, minW: 0, children: tidy(mine.title) })) : 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: [free ? (_jsxs(Button, { size: "xs", variant: "outline", "data-slot": "header-upgrade", gap: "$1.5", px: "$2.5", py: "$1", rounded: "$4", cursor: "pointer", hoverStyle: { bg: 'var(--white-10)' }, onPress: () => window.location.assign(payUrl('/cart', { org: org(), returnUrl: window.location.href })), "aria-label": t("Upgrade plan"), children: [_jsx(Sparkles, { size: 13, color: "var(--primary)", "aria-hidden": true }), _jsx(Text, { fontSize: "$1", fontWeight: "600", color: "$ink", children: t("Upgrade plan") })] })) : null, open ? _jsx(Share, { thread: open }) : 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)" }, onPress: () => setForgetful(!forgetful), children: _jsx(Ghost, { size: 16, strokeWidth: 1.75, color: forgetful ? "var(--foreground)" : "var(--muted-foreground)", fill: forgetful ? "currentColor" : "none", "aria-hidden": true }) }) }), _jsx(TooltipContent, { children: forgetful ? t("Private chat is on: this conversation is not saved") : t("Private chat") })] })), _jsx(XStack, { "$max-md": { display: 'none' }, children: _jsx(Summary, { sections: sections, onOpen: () => setPanel(true), label: t("Summary") }) }), _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, _jsx(YStack, { "data-slot": "talk", flex: 1, minH: 0, children: _jsx(ChatSurface, { ...chat, messages: shown, send: guarded,
1539
1536
  // WHILE NOTHING HAS BEEN SAID, from a tablet up, the opening and the
1540
1537
  // composer are one pair centred in the pane (`center`: rows `1fr auto auto
1541
1538
  // 1fr`), so the heading reads close above the field and nothing stands at
package/dist/Rail.d.ts CHANGED
@@ -2,7 +2,7 @@ import { type ReactNode } from 'react';
2
2
  import { type Host } from '@hanzo/build';
3
3
  import { type Place } from './lib/host.js';
4
4
  /** The rail's width, px. */
5
- export declare const RAIL = 44;
5
+ export declare const RAIL: number;
6
6
  /** A mark, px: a 36px square on a 44px pitch. */
7
7
  export declare const MARK = 36;
8
8
  /** The places the rail holds beside the products, by the builder address each opens. */
package/dist/Rail.js CHANGED
@@ -45,10 +45,10 @@ import { out } from './help.js';
45
45
  import { BETAS } from './lib/betas.js';
46
46
  import { HOSTED_APPS } from './lib/hosted.js';
47
47
  import { Account } from './Account.js';
48
- import { HEAD, TOUCH_HEAD } from './ground.js';
48
+ import { HEAD, INSET, TOUCH_HEAD } from './ground.js';
49
49
  import { app, hosted, WORKSPACE } from './lib/host.js';
50
50
  /** The rail's width, px. */
51
- export const RAIL = 44;
51
+ export const RAIL = 2 * INSET;
52
52
  /** A mark, px: a 36px square on a 44px pitch. */
53
53
  export const MARK = 36;
54
54
  /** A mark on a touch screen, px: a thumb's 44. */
package/dist/Usage.js CHANGED
@@ -2,8 +2,8 @@
2
2
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { useEffect, useState, useSyncExternalStore } from 'react';
4
4
  import { useI18n } from '@hanzo/i18n/react';
5
- import { Activity, ArrowUpRight } from 'lucide-react';
6
- import { Anchor, Button, Popover, PopoverContent, PopoverTrigger, Progress, Text, XStack, YStack } from '@hanzo/ui';
5
+ import { ArrowUpRight } from 'lucide-react';
6
+ import { Anchor, Button, Popover, PopoverContent, PopoverTrigger, Progress, SizableText, Text, XStack, YStack } from '@hanzo/ui';
7
7
  import { ComposerStatusProvider } from '@hanzo/ui/chat';
8
8
  import { UsageMeter } from '@hanzo/ui/product/UsageMeter';
9
9
  import { label } from '@hanzo/build/plan';
@@ -87,7 +87,7 @@ export function UsageControl({ context, read }) {
87
87
  read.reload(); };
88
88
  const integer = (n) => format.number(n, { maximumFractionDigits: 0 });
89
89
  const metric = (name, n) => _jsxs(XStack, { justify: "space-between", gap: "$3", children: [_jsx(Text, { fontSize: "$2", color: "$soft", children: name }), _jsx(Text, { fontSize: "$2", color: "$ink", fontVariant: ['tabular-nums'], children: _jsx("bdi", { children: integer(n) }) })] }, name);
90
- return (_jsxs(Popover, { open: open, onOpenChange: toggle, placement: "top-end", children: [_jsx(PopoverTrigger, { asChild: true, children: _jsxs(Button, { type: "button", variant: "ghost", size: "sm", px: "$2", minW: 32, height: 32, hitSlop: 6, "aria-label": t('Context, tokens and plan usage'), "data-slot": "composer-usage", children: [_jsx(Activity, { size: 15, "aria-hidden": true }), _jsx(Text, { fontSize: "$1", color: highest !== null && highest >= 95 ? '$bad' : '$soft', children: percent !== null ? `${percent}%` : highest !== null ? `${Math.round(highest)}%` : t('Usage') })] }) }), _jsx(PopoverContent, { solid: true, width: 360, maxW: "calc(100vw - 24px)", maxH: "min(680px, calc(100dvh - 100px))", overflowY: "auto", "aria-label": t('Context, tokens and plan usage'), "data-slot": "composer-usage-panel", children: _jsxs(YStack, { gap: "$4", minW: 0, children: [_jsxs(XStack, { justify: "space-between", items: "center", gap: "$3", children: [_jsx(Text, { fontSize: "$3", fontWeight: "600", color: "$ink", children: t('Usage') }), _jsxs(Button, { type: "button", size: "sm", variant: "link", onClick: () => { setOpen(false); showSettings('usage'); }, "data-slot": "composer-see-usage", children: [t('See all usage'), " ", _jsx(ArrowUpRight, { size: 13 })] })] }), context && estimate ? (_jsxs(YStack, { gap: "$2", "data-slot": "composer-context", children: [_jsxs(XStack, { justify: "space-between", gap: "$2", children: [_jsx(Text, { fontSize: "$2", fontWeight: "600", children: t('Context · estimated') }), _jsx(Text, { fontSize: "$1", color: "$soft", children: capacity ? t('{used} / {max} tokens', { used: integer(estimate.total), max: integer(capacity) }) : t('{used} tokens', { used: integer(estimate.total) }) })] }), percent !== null ? _jsx(Progress, { value: Math.min(100, percent), height: 5, "aria-label": t('Estimated context used'), indicatorColor: percent >= 90 ? '$bad' : '$good' }) : null, estimate.rows.filter((r) => r.tokens > 0).map((r) => metric(t(r.name), r.tokens)), _jsx(Text, { fontSize: "$1", color: "$soft", children: t('Text estimate; model tokenization and attachments can change the total.') }), !capacity ? _jsx(Text, { fontSize: "$1", color: "$soft", children: t('This model does not report a context capacity.') }) : null] })) : null, _jsxs(YStack, { gap: "$2", "data-slot": "composer-reported-tokens", children: [_jsx(Text, { fontSize: "$2", fontWeight: "600", children: t('Last response · reported tokens') }), tokens ? _jsxs(_Fragment, { children: [metric(t('Input'), tokens.input), metric(t('Output'), tokens.output), tokens.cached !== undefined ? metric(t('Cached input'), tokens.cached) : null, tokens.reasoning !== undefined ? metric(t('Reasoning'), tokens.reasoning) : null, metric(t('Total'), tokens.total)] }) : _jsx(Text, { fontSize: "$2", color: "$soft", children: t('No token counts reported for this conversation yet. See all usage for account totals.') })] }), _jsxs(YStack, { gap: "$2", "data-slot": "composer-account-usage", children: [_jsx(Text, { fontSize: "$2", fontWeight: "600", children: t('Account · last 30 days') }), aggregate?.data ? _jsxs(_Fragment, { children: [metric(t('Tokens'), aggregate.data.totals.tokens), metric(t('Input'), aggregate.data.totals.promptTokens), metric(t('Output'), aggregate.data.totals.completionTokens), metric(t('Requests'), aggregate.data.totals.requests)] }) : _jsx(Text, { fontSize: "$2", color: "$soft", children: aggregate?.error ?? t('Reading account usage…') })] }), _jsxs(YStack, { gap: "$2", "data-slot": "composer-plan-usage", children: [_jsx(Text, { fontSize: "$2", fontWeight: "600", children: title }), limits ? _jsx(UsageMeter, { limits: limits, size: "sm" }) : _jsx(Text, { fontSize: "$2", color: "$soft", children: t(answered ? 'Plan usage is unavailable. Try again.' : 'Reading plan usage…') }), answered && !limits ? _jsx(Button, { type: "button", size: "sm", variant: "link", onClick: usage.reload, children: t('Retry') }) : null] }), _jsxs(XStack, { gap: "$3", justify: "space-between", flexWrap: "wrap", children: [_jsx(Button, { asChild: true, size: "sm", children: _jsx(Anchor, { href: payPage('/cart'), "data-slot": "composer-upgrade", children: t('Upgrade plan') }) }), _jsx(Button, { asChild: true, size: "sm", variant: "outline", children: _jsx(Anchor, { href: payPage('/amount/card'), "data-slot": "composer-buy-credits", children: t('Buy credits') }) })] })] }) })] }));
90
+ return (_jsxs(Popover, { open: open, onOpenChange: toggle, placement: "top-end", children: [_jsx(PopoverTrigger, { asChild: true, children: _jsx(XStack, { render: "button", type: 'button', items: "center", height: 28, px: 5, rounded: 8, bg: "transparent", hoverStyle: { bg: '$hover' }, transition: "quickest", cursor: "pointer", "$max-sm": { height: 36 }, "aria-label": t('Context, tokens and plan usage'), "data-slot": "composer-usage", children: _jsx(SizableText, { size: "$3", color: highest !== null && highest >= 95 ? '$bad' : '$soft', children: percent !== null ? `${percent}%` : highest !== null ? `${Math.round(highest)}%` : t('Usage') }) }) }), _jsx(PopoverContent, { solid: true, width: 360, maxW: "calc(100vw - 24px)", maxH: "min(680px, calc(100dvh - 100px))", overflowY: "auto", "aria-label": t('Context, tokens and plan usage'), "data-slot": "composer-usage-panel", children: _jsxs(YStack, { gap: "$4", minW: 0, children: [_jsxs(XStack, { justify: "space-between", items: "center", gap: "$3", children: [_jsx(Text, { fontSize: "$3", fontWeight: "600", color: "$ink", children: t('Usage') }), _jsxs(Button, { type: "button", size: "sm", variant: "link", onClick: () => { setOpen(false); showSettings('usage'); }, "data-slot": "composer-see-usage", children: [t('See all usage'), " ", _jsx(ArrowUpRight, { size: 13 })] })] }), context && estimate ? (_jsxs(YStack, { gap: "$2", "data-slot": "composer-context", children: [_jsxs(XStack, { justify: "space-between", gap: "$2", children: [_jsx(Text, { fontSize: "$2", fontWeight: "600", children: t('Context · estimated') }), _jsx(Text, { fontSize: "$1", color: "$soft", children: capacity ? t('{used} / {max} tokens', { used: integer(estimate.total), max: integer(capacity) }) : t('{used} tokens', { used: integer(estimate.total) }) })] }), percent !== null ? _jsx(Progress, { value: Math.min(100, percent), height: 5, "aria-label": t('Estimated context used'), indicatorColor: percent >= 90 ? '$bad' : '$good' }) : null, estimate.rows.filter((r) => r.tokens > 0).map((r) => metric(t(r.name), r.tokens)), _jsx(Text, { fontSize: "$1", color: "$soft", children: t('Text estimate; model tokenization and attachments can change the total.') }), !capacity ? _jsx(Text, { fontSize: "$1", color: "$soft", children: t('This model does not report a context capacity.') }) : null] })) : null, _jsxs(YStack, { gap: "$2", "data-slot": "composer-reported-tokens", children: [_jsx(Text, { fontSize: "$2", fontWeight: "600", children: t('Last response · reported tokens') }), tokens ? _jsxs(_Fragment, { children: [metric(t('Input'), tokens.input), metric(t('Output'), tokens.output), tokens.cached !== undefined ? metric(t('Cached input'), tokens.cached) : null, tokens.reasoning !== undefined ? metric(t('Reasoning'), tokens.reasoning) : null, metric(t('Total'), tokens.total)] }) : _jsx(Text, { fontSize: "$2", color: "$soft", children: t('No token counts reported for this conversation yet. See all usage for account totals.') })] }), _jsxs(YStack, { gap: "$2", "data-slot": "composer-account-usage", children: [_jsx(Text, { fontSize: "$2", fontWeight: "600", children: t('Account · last 30 days') }), aggregate?.data ? _jsxs(_Fragment, { children: [metric(t('Tokens'), aggregate.data.totals.tokens), metric(t('Input'), aggregate.data.totals.promptTokens), metric(t('Output'), aggregate.data.totals.completionTokens), metric(t('Requests'), aggregate.data.totals.requests)] }) : _jsx(Text, { fontSize: "$2", color: "$soft", children: aggregate?.error ?? t('Reading account usage…') })] }), _jsxs(YStack, { gap: "$2", "data-slot": "composer-plan-usage", children: [_jsx(Text, { fontSize: "$2", fontWeight: "600", children: title }), limits ? _jsx(UsageMeter, { limits: limits, size: "sm" }) : _jsx(Text, { fontSize: "$2", color: "$soft", children: t(answered ? 'Plan usage is unavailable. Try again.' : 'Reading plan usage…') }), answered && !limits ? _jsx(Button, { type: "button", size: "sm", variant: "link", onClick: usage.reload, children: t('Retry') }) : null] }), _jsxs(XStack, { gap: "$3", justify: "space-between", flexWrap: "wrap", children: [_jsx(Button, { asChild: true, size: "sm", children: _jsx(Anchor, { href: payPage('/cart'), "data-slot": "composer-upgrade", children: t('Upgrade plan') }) }), _jsx(Button, { asChild: true, size: "sm", variant: "outline", children: _jsx(Anchor, { href: payPage('/amount/card'), "data-slot": "composer-buy-credits", children: t('Buy credits') }) })] })] }) })] }));
91
91
  }
92
92
  /** Every shared composer in the app gets the same account usage entry. */
93
93
  export function UsageProvider({ children }) {
package/dist/ground.d.ts CHANGED
@@ -34,6 +34,13 @@ export declare const BAND = 52;
34
34
  */
35
35
  export declare const HEAD = 36;
36
36
  export declare const TOUCH_HEAD = 44;
37
+ /**
38
+ * A corner mark's centre from its edge, px: the rail's first mark from the
39
+ * window's start edge (the rail is twice this wide), and the pane head's last
40
+ * mark from the pane's end edge, so the two top corners mirror each other
41
+ * (owner, 2026-10-30: "top left / top right").
42
+ */
43
+ export declare const INSET = 22;
37
44
  /**
38
45
  * A row INSIDE a pane is 2px shorter than the row it lines up with: the pane's
39
46
  * 1px top edge sets its content 1px down, so its centre stays on the line.
package/dist/ground.js CHANGED
@@ -34,6 +34,13 @@ export const BAND = 52;
34
34
  */
35
35
  export const HEAD = 36;
36
36
  export const TOUCH_HEAD = 44;
37
+ /**
38
+ * A corner mark's centre from its edge, px: the rail's first mark from the
39
+ * window's start edge (the rail is twice this wide), and the pane head's last
40
+ * mark from the pane's end edge, so the two top corners mirror each other
41
+ * (owner, 2026-10-30: "top left / top right").
42
+ */
43
+ export const INSET = 22;
37
44
  /**
38
45
  * A row INSIDE a pane is 2px shorter than the row it lines up with: the pane's
39
46
  * 1px top edge sets its content 1px down, so its centre stays on the line.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hanzo/app",
3
- "version": "0.3.5",
3
+ "version": "0.3.7",
4
4
  "description": "Hanzo's app: the shell and its apps (Home, Chat, Inbox, Contacts, Meet, Calendar, Drive, Board, Work, Bots), once, for every Hanzo surface.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -60,7 +60,7 @@
60
60
  "@hanzo/logo": ">=1.0.26",
61
61
  "@hanzo/studio": ">=0.1.0",
62
62
  "@hanzo/tabs": ">=0.1.8",
63
- "@hanzo/ui": ">=8.29.33",
63
+ "@hanzo/ui": ">=8.29.40",
64
64
  "@hanzo/usage": ">=0.1.18",
65
65
  "@hanzo/voice": ">=0.1.16",
66
66
  "@hanzogui/shell": "^8.3.20",
@@ -81,7 +81,7 @@
81
81
  "@hanzo/logo": "1.0.26",
82
82
  "@hanzo/studio": "0.1.0",
83
83
  "@hanzo/tabs": "github:hanzo-inc/tabs",
84
- "@hanzo/ui": "8.29.33",
84
+ "@hanzo/ui": "8.29.40",
85
85
  "@hanzo/usage": "0.1.18",
86
86
  "@hanzo/voice": "0.1.19",
87
87
  "@hanzogui/config": "8.3.5",