@hanzo/app 0.2.42 → 0.2.44

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
@@ -34,7 +34,7 @@ import { billed, detail, familyOf, planRequired, plainly, refused } from "./fail
34
34
  import { english } from "./say.js";
35
35
  import { Prose } from "./Prose.js";
36
36
  import { useAgent, useAi, useChat, } from "@hanzo/ai/react";
37
- import { Chat as ChatSurface, Failure, Parts, words } from "@hanzo/ui/chat";
37
+ import { Chat as ChatSurface, EFFORTS, Failure, MEASURE, Parts, 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 { channel, drop, hold, landed, localOf, spend, take, usePane, useWorkFile } from "./pane.js";
@@ -57,7 +57,7 @@ import { useHydrated } from "./lib/hydrated.js";
57
57
  import { base, served } from "./lib/ai.js";
58
58
  import { onServed } from "./lib/served.js";
59
59
  import { refused as worded, speech, useDictation, useTalk, useVoice } from "@hanzo/voice";
60
- import { Check, Clock, FileText, Image as ImageMark, Library as LibraryMark, Paperclip, Sparkles, X, Zap } from "lucide-react";
60
+ import { Check, Clock, FileText, Image as ImageMark, Library as LibraryMark, Paperclip, Sparkles, X } from "lucide-react";
61
61
  import { FREE, ENSO } from "./lib/ai.js";
62
62
  import { openThread, useOpen } from "./open.js";
63
63
  import { Beside, Framed } from "./Shell.js";
@@ -67,7 +67,7 @@ import { ConversationMenu, ThreadMore, useThreadList } from "./thread.js";
67
67
  import { Schedule } from "./Schedule.js";
68
68
  import { keepFile, useAttach, useKeep } from "./keep.js";
69
69
  import { dragWindow, toggleWindowMaximize } from "./WindowControls.js";
70
- import { artifacts, lead, nameOf, PAGE, Panel, PanelToggle, prompt, renders, Reply, Served, Summary, useDeck, useKey, Suggestions, useCarry, useLanguage, useMention, useMind, useSuggestions, book, hand, taken, want, path as devPath, CHAT_MODES, usePanel, frames, name as tabName, } from "@hanzo/build";
70
+ import { artifacts, lead, nameOf, PAGE, Panel, PanelToggle, renders, Reply, Served, Summary, useDeck, useKey, Suggestions, useCarry, useLanguage, useMind, useSuggestions, taken, CHAT_MODES, usePanel, frames, name as tabName, } from "@hanzo/build";
71
71
  import { checkoutUrl, payUrl } from './lib/pay.js';
72
72
  import { Upgrade, useFree } from './Upgrade.js';
73
73
  import { enter, LOGIN } from './lib/destination.js';
@@ -75,8 +75,8 @@ import { first } from './lib/first.js';
75
75
  import { BAD } from "./lib/mix.js";
76
76
  import { brand } from './where.js';
77
77
  import { BAND } from './ground.js';
78
- import { ThinkingEffort } from './ThinkingEffort.js';
79
78
  import { shared, useChatPreferences } from './lib/chatPreferences.js';
79
+ import { handleHint } from './hint.js';
80
80
  // NO REASONING PANEL HERE. Every assistant turn opened a "Thinking" disclosure
81
81
  // listing seven steps — "Planning CSS extraction for chat styles", "Designing
82
82
  // responsive top bar grid layout" — typed into this file as a literal array.
@@ -87,12 +87,6 @@ import { shared, useChatPreferences } from './lib/chatPreferences.js';
87
87
  //
88
88
  // The queued-message box went with it: a second unmounted component, holding
89
89
  // the file's last use of the chevrons imported for the panel.
90
- /**
91
- * The room's reading measure: the design system's prose width, which is what
92
- * the Width setting (@hanzo/appearance) retunes. 48rem is 768px, the width this
93
- * room has always read at, so an untouched setting changes nothing.
94
- */
95
- const MEASURE = "var(--container-prose, 48rem)";
96
90
  /**
97
91
  * The text this screen arrived with, TYPED INTO THE COMPOSER — never sent.
98
92
  *
@@ -512,7 +506,7 @@ function Thread({ placeholder = message(), initial, anonymous = false, heading,
512
506
  const { limits, notice, reload: reread } = useLimits(!anonymous, org(), (id) => nameOf(id, catalog.current));
513
507
  const mind = useMind(target, anonymous ? "free" : limits?.plan);
514
508
  catalog.current = mind.models;
515
- // Chat's effort is its own (ThinkingEffort, sent as `reasoning_effort`); a
509
+ // Chat's effort is its own (six steps, sent as `reasoning_effort`); a
516
510
  // pick of one Dev offers too moves Dev's, where it is made, and opening Chat
517
511
  // never resets Dev's.
518
512
  const [chatPrefs, setChatPrefs] = useChatPreferences();
@@ -1354,32 +1348,13 @@ function Thread({ placeholder = message(), initial, anonymous = false, heading,
1354
1348
  window.location.assign(dev(slug));
1355
1349
  },
1356
1350
  };
1357
- // THE COMPOSER'S OPTIONS, held apart so its keys (the `/` and `@` lists' arrows,
1358
- // Ctrl+U) hook in through `useMention` before the frame is drawn.
1351
+ // THE COMPOSER'S SLOTS (@hanzo/ui/chat): this room hands it what it carries,
1352
+ // and the composer draws the rest the way the person's setting says.
1359
1353
  // What pressing a suggestion does, at once: open what it names, send its prompt
1360
1354
  // here (the room is a new chat while one shows), hand its run to Dev, or make
1361
1355
  // its scheduled task and show it in Scheduled tasks.
1362
- const hint = (a) => {
1363
- switch (a.kind) {
1364
- case "open":
1365
- if (a.item)
1366
- want(a.item);
1367
- if (/^https:\/\//.test(a.to))
1368
- window.open(a.to, "_blank", "noopener,noreferrer");
1369
- else
1370
- go(a.to.startsWith("/") ? a.to : app(a.to));
1371
- return;
1372
- case "send":
1373
- submit(a.prompt);
1374
- return;
1375
- case "task":
1376
- hand("task", a.prompt);
1377
- go(app(""));
1378
- return;
1379
- case "schedule":
1380
- void book(target, a, "chat").then((made) => go(app(devPath({ kind: "automation", id: made.id }))), (e) => setPrepWrong(e instanceof Error && e.message ? e.message : t("The scheduled task could not be made.")));
1381
- return;
1382
- }
1356
+ const hint = (a, row) => {
1357
+ handleHint(a, row, { reopen, submit, target, setPrepWrong, t });
1383
1358
  };
1384
1359
  // A chat a suggestion in Dev left for this room is sent once the room is a new
1385
1360
  // chat: the address's own conversation let go of, nothing said yet.
@@ -1392,7 +1367,8 @@ function Thread({ placeholder = message(), initial, anonymous = false, heading,
1392
1367
  submit(p);
1393
1368
  // eslint-disable-next-line react-hooks/exhaustive-deps
1394
1369
  }, [open, said.length]);
1395
- const composing = {
1370
+ const families = useFamilies(mind, (id) => setAsk({ model: nameOf(id, listed) }));
1371
+ const composer = {
1396
1372
  value: draft,
1397
1373
  onChange: setDraft,
1398
1374
  onSend: () => submit(),
@@ -1404,9 +1380,8 @@ function Thread({ placeholder = message(), initial, anonymous = false, heading,
1404
1380
  // (the defaults @hanzo/ui and @hanzo/build each call ASK), said here so both are the reader's.
1405
1381
  label: t("Ask anything"),
1406
1382
  placeholder: t("Type / for skills"),
1407
- // A phone's pill is the tall one: the field across the top, the controls under it.
1408
- narrow: !media.sm,
1409
- // In the app's frame the composer floats on the pane as a pane of its own.
1383
+ // At the thread's measure, and in the app's frame floating on the pane as a pane of its own.
1384
+ column: true,
1410
1385
  framed,
1411
1386
  // A file or an image pasted into the field is held like a picked one;
1412
1387
  // words paste as words.
@@ -1441,7 +1416,7 @@ function Thread({ placeholder = message(), initial, anonymous = false, heading,
1441
1416
  memory: { on: carry.gear.gear.memory, set: (on) => carry.gear.set({ memory: on }) },
1442
1417
  },
1443
1418
  // Who is in the room, then what the conversation carries, as chips after `+`.
1444
- on: [
1419
+ carried: [
1445
1420
  ...room.map((name) => ({
1446
1421
  id: `agent:${name}`,
1447
1422
  label: name,
@@ -1452,11 +1427,33 @@ function Thread({ placeholder = message(), initial, anonymous = false, heading,
1452
1427
  ],
1453
1428
  slash: anonymous ? undefined : carry.skills,
1454
1429
  at: anonymous ? undefined : carry.plugins,
1455
- // Auto vs Manual approval lives in Settings rather than floating under the composer.
1456
- mode: null,
1457
- // The model under the frame (@hanzo/build) only where Settings' model
1458
- // selector is on; the effort is ThinkingEffort, beside send.
1459
- model: chatPrefs.showModelSelector ? mind : null,
1430
+ // The mode is Auto or Manual approval, the one Settings keeps; the person
1431
+ // turns the pill on in Settings → Appearance, and it is off until they do.
1432
+ mode: anonymous
1433
+ ? null
1434
+ : {
1435
+ ...carry.mode,
1436
+ set: (m) => {
1437
+ const approval = m === "manual" ? "manual" : "auto";
1438
+ setChatPrefs({ approvalMode: approval });
1439
+ carry.mode.set(approval);
1440
+ },
1441
+ },
1442
+ // The model, only where the person turned the model selector on; the effort, always.
1443
+ mind,
1444
+ effort: {
1445
+ value: chatPrefs.effort || "high",
1446
+ set: (eff) => {
1447
+ setChatPrefs({ effort: eff });
1448
+ const next = shared(eff);
1449
+ if (next)
1450
+ mind.pace(next);
1451
+ },
1452
+ items: EFFORTS,
1453
+ },
1454
+ // Chat keeps to the effort alone until the person asks for more: the family chips, the mode.
1455
+ chips: anonymous ? undefined : families,
1456
+ defaults: { chips: false, mode: false },
1460
1457
  limits,
1461
1458
  onUpgrade: (id) => setAsk({ model: nameOf(id, listed) }),
1462
1459
  voice,
@@ -1464,9 +1461,8 @@ function Thread({ placeholder = message(), initial, anonymous = false, heading,
1464
1461
  onLanguage: speakIn,
1465
1462
  talk,
1466
1463
  // While nothing has been said: what is worth doing next.
1467
- below: said.length === 0 && !anonymous ? _jsx(Suggestions, { rows: hints.rows, onAct: hint, onDismiss: hints.dismiss }) : undefined,
1464
+ starters: said.length === 0 && !anonymous ? _jsx(Suggestions, { rows: hints.rows, onAct: hint, onDismiss: hints.dismiss }) : undefined,
1468
1465
  };
1469
- const mention = useMention(composing);
1470
1466
  return (_jsxs(YStack, { flex: 1, minH: 0, width: "100%", position: "relative", "data-slot": "chat-room",
1471
1467
  // A LINK IN AN ANSWER OPENS IN A TAB beside the conversation when the tab
1472
1468
  // can show it — a site or preview we host — and in a browser tab of its
@@ -1510,12 +1506,10 @@ function Thread({ placeholder = message(), initial, anonymous = false, heading,
1510
1506
  if (!open)
1511
1507
  setPlan(null);
1512
1508
  }, 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", height: BAND, items: "center", justify: "space-between", gap: "$3", paddingInlineStart: "$4", paddingInlineEnd: "$2", shrink: 0, "data-tauri-drag-region": "deep", onMouseDown: dragWindow, onDoubleClick: toggleWindowMaximize, "$max-md": !mine && !room.length ? { display: 'none' } : undefined, children: [_jsxs(XStack, { items: "center", gap: "$2", minW: 0, flex: 1, children: [mine ? (_jsx(Text, { fontSize: 15, lineHeight: 20, color: "$ink", numberOfLines: 1, shrink: 1, minW: 0, children: tidy(mine.title) })) : null, room.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: room.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, mine ? (_jsx(ConversationMenu, { threads: alone, active: open, onSchedule: anonymous ? undefined : () => setPlan(lastAsked()), children: _jsx(XStack, { children: _jsx(ThreadMore, { t: mine }) }) })) : null, _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(Beside, { 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(ChatSurface, { ...chat, messages: shown, send: guarded,
1513
- // AN EMPTY ROOM CENTRES ITS COMPOSER on a laptop. While nothing has been
1514
- // said the opening (the heading) and the composer sit as one group in the
1515
- // middle of the height; the moment a turn exists the transcript takes the
1516
- // height and the composer docks under it. A phone keeps it at the foot,
1517
- // over the keyboard, from the first moment.
1518
- center: media.sm,
1509
+ // THE COMPOSER IS FIXED TO THE FOOT, on a laptop and on a phone, empty or
1510
+ // not: while nothing has been said the opening (the heading) stands at the
1511
+ // foot of the height above it; once a turn exists the transcript scrolls
1512
+ // under it. Over the keyboard, from the first moment.
1519
1513
  // AS IT WAS WRITTEN. The package renders a turn's words plainly and
1520
1514
  // says so — it ships no markdown pipeline because the plugin set is the
1521
1515
  // surface's to choose — so an answer arrived here reading "```ts" with
@@ -1580,22 +1574,8 @@ function Thread({ placeholder = message(), initial, anonymous = false, heading,
1580
1574
  // with it when it did. `Ask` passes its own, because the page embedding
1581
1575
  // it already has an `<h1>` and a second is the defect that took the
1582
1576
  // landings off /chat and /dev.
1583
- empty: heading === null ? undefined : (_jsxs(YStack, { "data-slot": "opening", items: "center", width: "100%", pt: "$6", pb: "$2", ...(media.sm ? null : { flex: 1, justify: "flex-end" }), children: [room.length > 1 ? (_jsx(XStack, { items: "center", justify: "center", mb: "$4", children: room.map((name, i) => (_jsx(Box, { marginInlineStart: i ? -16 : 0, rounded: 40, borderWidth: 2, borderColor: "$background", z: room.length - i, children: _jsx(Face, { src: faces[name]?.avatar, emoji: faces[name]?.emoji, name: name, size: 72 }) }, name))) })) : portrait ? (_jsx(Box, { width: 160, height: 160, rounded: 24, overflow: "hidden", borderWidth: 2, borderColor: "var(--white-15)", boxShadow: "0 10px 24px color-mix(in srgb, var(--pure-black) 70%, transparent)", mb: "$4", bg: "var(--neutral-900)", children: _jsx(View, { render: _jsx("img", { src: portrait, alt: withWhom }), width: "100%", height: "100%", objectFit: "cover" }) })) : null, room.length === 1 && !portrait ? (_jsx(Box, { mb: "$3", children: _jsx(Face, { emoji: mate?.emoji ?? persona?.emoji, name: withWhom, size: 72 }) })) : null, _jsx(Text, { render: "h1", fontSize: "$7", lineHeight: "$7", fontWeight: "700", color: "$ink", text: "center", mb: "$1", children: join(room, t) || heading || (firstName ? t("What’s up, {name}?", { name: firstName }) : t("What’s up?")) }), room.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] })),
1577
+ empty: heading === null ? undefined : (_jsxs(YStack, { "data-slot": "opening", items: "center", width: "100%", pt: "$6", pb: "$2", flex: 1, justify: "flex-end", children: [room.length > 1 ? (_jsx(XStack, { items: "center", justify: "center", mb: "$4", children: room.map((name, i) => (_jsx(Box, { marginInlineStart: i ? -16 : 0, rounded: 40, borderWidth: 2, borderColor: "$background", z: room.length - i, children: _jsx(Face, { src: faces[name]?.avatar, emoji: faces[name]?.emoji, name: name, size: 72 }) }, name))) })) : portrait ? (_jsx(Box, { width: 160, height: 160, rounded: 24, overflow: "hidden", borderWidth: 2, borderColor: "var(--white-15)", boxShadow: "0 10px 24px color-mix(in srgb, var(--pure-black) 70%, transparent)", mb: "$4", bg: "var(--neutral-900)", children: _jsx(View, { render: _jsx("img", { src: portrait, alt: withWhom }), width: "100%", height: "100%", objectFit: "cover" }) })) : null, room.length === 1 && !portrait ? (_jsx(Box, { mb: "$3", children: _jsx(Face, { emoji: mate?.emoji ?? persona?.emoji, name: withWhom, size: 72 }) })) : null, _jsx(Text, { render: "h1", fontSize: "$7", lineHeight: "$7", fontWeight: "700", color: "$ink", text: "center", mb: "$1", children: join(room, t) || heading || (firstName ? t("What’s up, {name}?", { name: firstName }) : t("What’s up?")) }), room.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] })),
1584
1578
  // The transcript reads at the same measure. `Thread` defaults to 768
1585
1579
  // itself; handing it the column here is what lets Width reach it.
1586
- column: { maxW: MEASURE }, composer: (() => {
1587
- const basePrompt = prompt({
1588
- ...composing,
1589
- field: mention.field,
1590
- }, mention.state);
1591
- return {
1592
- ...basePrompt,
1593
- send: (_jsxs(XStack, { items: "center", gap: "$1.5", shrink: 0, children: [chatPrefs.showTurboApproval ? (_jsxs(XStack, { items: "center", gap: "$1", px: "$2", py: "$1", rounded: 999, borderWidth: 1, borderColor: "$borderColor", bg: "$background", "aria-label": t("Turbo Approval: {mode}", { mode: chatPrefs.approvalMode }), children: [_jsx(Zap, { size: 12, color: "var(--primary)", "aria-hidden": true }), _jsx(Text, { fontSize: "$1", fontWeight: "600", color: "$ink", children: chatPrefs.approvalMode === "manual" ? t("Manual") : t("Turbo") })] })) : null, _jsx(ThinkingEffort, { effort: chatPrefs.effort || 'high', onChange: (eff) => {
1594
- setChatPrefs({ effort: eff });
1595
- const next = shared(eff);
1596
- if (next)
1597
- mind.pace(next);
1598
- }, disabled: chat.streaming || talk.open }), basePrompt.send] })),
1599
- };
1600
- })() }), _jsx(AgentMaker, {}), carry.dialog, _jsx(Upgrade, { ask: ask, onClose: () => setAsk(null) })] }));
1580
+ column: { maxW: MEASURE }, composer: composer }), _jsx(AgentMaker, {}), carry.dialog, _jsx(Upgrade, { ask: ask, onClose: () => setAsk(null) })] }));
1601
1581
  }
@@ -7,7 +7,7 @@ import { phrase } from '@hanzo/i18n';
7
7
  import { useI18n } from '@hanzo/i18n/react';
8
8
  import { ArrowUpRight, Check, ExternalLink, Lock, Sparkles } from 'lucide-react';
9
9
  import { shared, useChatPreferences } from './lib/chatPreferences.js';
10
- import { EFFORT_STEPS } from './ThinkingEffort.js';
10
+ import { EFFORTS } from '@hanzo/ui/chat/pure';
11
11
  import { Box, Button, Input, Separator, Text, XStack, YStack, } from '@hanzo/ui';
12
12
  import { tap } from './lib/tap.js';
13
13
  import { useIam, useIamIdentity, useOrganizations } from '@hanzo/iam/react';
@@ -86,7 +86,7 @@ function Model() {
86
86
  const { isAuthenticated } = useIam();
87
87
  const { tier } = useTier(isAuthenticated, org());
88
88
  const paid = Boolean(tier?.plan && tier.plan !== 'free');
89
- return (_jsxs(YStack, { gap: "$5", maxW: 540, children: [_jsxs(YStack, { gap: "$2", children: [_jsx(Text, { fontSize: "$4", fontWeight: "600", color: "$ink", children: t('Default model') }), _jsx(Text, { fontSize: "$2", color: "$soft", children: t('Used for new chats and runs. An agent with its own model keeps that choice.') }), _jsx(XStack, { self: "flex-start", pt: "$1", children: _jsx(ModelPicker, { models: models, scope: "chat", value: choice.model, onChange: (id) => choose({ model: id }), size: "sm" }) })] }), _jsx(Separator, {}), _jsxs(YStack, { gap: "$2", children: [_jsx(Text, { fontSize: "$4", fontWeight: "600", color: "$ink", children: t('Default reasoning effort') }), _jsx(Text, { fontSize: "$2", color: "$soft", children: t('Sets how deeply models think before answering. Defaults to High across all plans.') }), _jsx(XStack, { gap: "$2", pt: "$1", flexWrap: "wrap", children: EFFORT_STEPS.map((step) => {
89
+ return (_jsxs(YStack, { gap: "$5", maxW: 540, children: [_jsxs(YStack, { gap: "$2", children: [_jsx(Text, { fontSize: "$4", fontWeight: "600", color: "$ink", children: t('Default model') }), _jsx(Text, { fontSize: "$2", color: "$soft", children: t('Used for new chats and runs. An agent with its own model keeps that choice.') }), _jsx(XStack, { self: "flex-start", pt: "$1", children: _jsx(ModelPicker, { models: models, scope: "chat", value: choice.model, onChange: (id) => choose({ model: id }), size: "sm" }) })] }), _jsx(Separator, {}), _jsxs(YStack, { gap: "$2", children: [_jsx(Text, { fontSize: "$4", fontWeight: "600", color: "$ink", children: t('Default reasoning effort') }), _jsx(Text, { fontSize: "$2", color: "$soft", children: t('Sets how deeply models think before answering. Defaults to High across all plans.') }), _jsx(XStack, { gap: "$2", pt: "$1", flexWrap: "wrap", children: EFFORTS.map((step) => {
90
90
  const active = (chatPrefs.effort || 'high') === step.id;
91
91
  return (_jsx(Box, { render: _jsx("button", { type: "button" }), ...tap, onClick: () => {
92
92
  setChatPrefs({ effort: step.id });
@@ -100,7 +100,7 @@ function Model() {
100
100
  ].map((opt) => {
101
101
  const active = (chatPrefs.approvalMode || 'auto') === opt.id;
102
102
  return (_jsxs(Box, { render: _jsx("button", { type: "button" }), ...tap, onClick: () => setChatPrefs({ approvalMode: opt.id }), ...CHOICE, flex: 1, p: 10, bg: active ? 'var(--edge, var(--white-14))' : 'transparent', borderColor: active ? 'var(--borderColor, var(--white-22))' : 'var(--white-08)', children: [_jsxs(XStack, { items: "center", justify: "space-between", children: [_jsx(Text, { fontSize: "$2", fontWeight: "600", color: "$ink", children: opt.label }), active ? _jsx(Check, { size: 12, color: "var(--primary)", "aria-hidden": true }) : null] }), _jsx(Text, { fontSize: "$1", color: "$soft", children: opt.desc })] }, opt.id));
103
- }) })] }), _jsx(Separator, {}), _jsxs(YStack, { gap: "$3", children: [_jsx(XStack, { items: "center", justify: "space-between", children: _jsxs(YStack, { gap: "$0.5", children: [_jsxs(XStack, { items: "center", gap: "$1.5", children: [_jsx(Text, { fontSize: "$4", fontWeight: "600", color: "$ink", children: t('Advanced composer controls') }), !paid ? (_jsxs(XStack, { items: "center", gap: "$1", px: "$2", py: "$0.5", rounded: 9999, bg: "var(--edge, var(--white-10))", children: [_jsx(Lock, { size: 11, color: "$soft", "aria-hidden": true }), _jsx(Text, { fontSize: "$1", fontWeight: "600", color: "$soft", children: t('Paid plan') })] })) : null] }), _jsx(Text, { fontSize: "$2", color: "$soft", children: t('Customize composer controls and third-party model access.') })] }) }), _jsx(YStack, { p: "$3", rounded: "$3", borderWidth: 1, borderColor: "$borderColor", gap: "$2", children: _jsxs(XStack, { items: "center", justify: "space-between", children: [_jsxs(YStack, { flex: 1, pr: "$2", children: [_jsx(Text, { fontSize: "$3", fontWeight: "600", color: "$ink", children: t('Show model selector in composer') }), _jsx(Text, { fontSize: "$2", color: "$soft", children: t('By default, chat composers simplify controls to reasoning effort only. Enable this to pick models on the fly in the composer.') })] }), _jsx(Button, { size: "sm", variant: chatPrefs.showModelSelector ? 'default' : 'outline', disabled: !paid, onClick: () => paid && setChatPrefs({ showModelSelector: !chatPrefs.showModelSelector }), children: chatPrefs.showModelSelector ? t('Enabled') : t('Disabled') })] }) }), _jsx(YStack, { p: "$3", rounded: "$3", borderWidth: 1, borderColor: "$borderColor", gap: "$2", children: _jsxs(XStack, { items: "center", justify: "space-between", children: [_jsxs(YStack, { flex: 1, pr: "$2", children: [_jsx(Text, { fontSize: "$3", fontWeight: "600", color: "$ink", children: t('Enable third-party models') }), _jsx(Text, { fontSize: "$2", color: "$soft", children: t('Third-party models (OpenAI, Anthropic, Google, DeepSeek) are billed from your pre-paid credit topup. First-party models (Enso, Zen, Kai) are covered by your plan.') })] }), _jsx(Button, { size: "sm", variant: chatPrefs.allowThirdPartyModels ? 'default' : 'outline', disabled: !paid, onClick: () => paid && setChatPrefs({ allowThirdPartyModels: !chatPrefs.allowThirdPartyModels }), children: chatPrefs.allowThirdPartyModels ? t('Enabled') : t('Disabled') })] }) }), _jsx(YStack, { p: "$3", rounded: "$3", borderWidth: 1, borderColor: "$borderColor", gap: "$2", children: _jsxs(XStack, { items: "center", justify: "space-between", children: [_jsxs(YStack, { flex: 1, pr: "$2", children: [_jsx(Text, { fontSize: "$3", fontWeight: "600", color: "$ink", children: t('Show language selector beside +') }), _jsx(Text, { fontSize: "$2", color: "$soft", children: t('Display the dictation language indicator next to the + context button on the composer row.') })] }), _jsx(Button, { size: "sm", variant: chatPrefs.showLanguage ? 'default' : 'outline', onClick: () => setChatPrefs({ showLanguage: !chatPrefs.showLanguage }), children: chatPrefs.showLanguage ? t('Enabled') : t('Disabled') })] }) }), _jsx(YStack, { p: "$3", rounded: "$3", borderWidth: 1, borderColor: "$borderColor", gap: "$2", children: _jsxs(XStack, { items: "center", justify: "space-between", children: [_jsxs(YStack, { flex: 1, pr: "$2", children: [_jsx(Text, { fontSize: "$3", fontWeight: "600", color: "$ink", children: t('Show turbo approval indicator') }), _jsx(Text, { fontSize: "$2", color: "$soft", children: t('Display the turbo / manual approval badge next to the thinking effort and send controls.') })] }), _jsx(Button, { size: "sm", variant: chatPrefs.showTurboApproval ? 'default' : 'outline', onClick: () => setChatPrefs({ showTurboApproval: !chatPrefs.showTurboApproval }), children: chatPrefs.showTurboApproval ? t('Enabled') : t('Disabled') })] }) }), !paid ? (_jsx(XStack, { pt: "$1", children: _jsxs(Button, { size: "sm", variant: "outline", onClick: () => window.location.assign(site('/pricing')), children: [_jsx(Sparkles, { size: 14, color: "var(--primary)", "aria-hidden": true }), t('Upgrade to unlock advanced model controls')] }) })) : null] })] }));
103
+ }) })] }), _jsx(Separator, {}), _jsxs(YStack, { gap: "$3", children: [_jsx(XStack, { items: "center", justify: "space-between", children: _jsxs(YStack, { gap: "$0.5", children: [_jsxs(XStack, { items: "center", gap: "$1.5", children: [_jsx(Text, { fontSize: "$4", fontWeight: "600", color: "$ink", children: t('Advanced composer controls') }), !paid ? (_jsxs(XStack, { items: "center", gap: "$1", px: "$2", py: "$0.5", rounded: 9999, bg: "var(--edge, var(--white-10))", children: [_jsx(Lock, { size: 11, color: "$soft", "aria-hidden": true }), _jsx(Text, { fontSize: "$1", fontWeight: "600", color: "$soft", children: t('Paid plan') })] })) : null] }), _jsx(Text, { fontSize: "$2", color: "$soft", children: t('Third-party model access, and the language dictation listens in.') })] }) }), _jsx(YStack, { p: "$3", rounded: "$3", borderWidth: 1, borderColor: "$borderColor", gap: "$2", children: _jsxs(XStack, { items: "center", justify: "space-between", children: [_jsxs(YStack, { flex: 1, pr: "$2", children: [_jsx(Text, { fontSize: "$3", fontWeight: "600", color: "$ink", children: t('Enable third-party models') }), _jsx(Text, { fontSize: "$2", color: "$soft", children: t('Third-party models (OpenAI, Anthropic, Google, DeepSeek) are billed from your pre-paid credit topup. First-party models (Enso, Zen, Kai) are covered by your plan.') })] }), _jsx(Button, { size: "sm", variant: chatPrefs.allowThirdPartyModels ? 'default' : 'outline', disabled: !paid, onClick: () => paid && setChatPrefs({ allowThirdPartyModels: !chatPrefs.allowThirdPartyModels }), children: chatPrefs.allowThirdPartyModels ? t('Enabled') : t('Disabled') })] }) }), _jsx(YStack, { p: "$3", rounded: "$3", borderWidth: 1, borderColor: "$borderColor", gap: "$2", children: _jsxs(XStack, { items: "center", justify: "space-between", children: [_jsxs(YStack, { flex: 1, pr: "$2", children: [_jsx(Text, { fontSize: "$3", fontWeight: "600", color: "$ink", children: t('Show language selector beside +') }), _jsx(Text, { fontSize: "$2", color: "$soft", children: t('Display the dictation language indicator next to the + context button on the composer row.') })] }), _jsx(Button, { size: "sm", variant: chatPrefs.showLanguage ? 'default' : 'outline', onClick: () => setChatPrefs({ showLanguage: !chatPrefs.showLanguage }), children: chatPrefs.showLanguage ? t('Enabled') : t('Disabled') })] }) }), !paid ? (_jsx(XStack, { pt: "$1", children: _jsxs(Button, { size: "sm", variant: "outline", onClick: () => window.location.assign(site('/pricing')), children: [_jsx(Sparkles, { size: 14, color: "var(--primary)", "aria-hidden": true }), t('Upgrade to unlock advanced model controls')] }) })) : null] })] }));
104
104
  }
105
105
  /**
106
106
  * WHAT THE GATEWAY SERVES, read from the same `/v1/models` the rooms read.
package/dist/agents.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { Host } from '@hanzo/build';
2
- export type { Link, Shelf, ShelfRow as Row } from '@hanzo/build';
2
+ export type { Link, Shelf, ShelfRow as Row } from '@hanzo/ui/chat';
3
3
  /**
4
4
  * The model that draws an agent's face: Hanzo's own image SKU (hanzo-inc/zen
5
5
  * catalog.yaml `zen-image`), named on every call, because the endpoint takes
package/dist/dev.js CHANGED
@@ -41,7 +41,6 @@ import { CAST } from './agents.js';
41
41
  import { app, place, settings, visit } from './lib/host.js';
42
42
  import { link } from './lib/tags.js';
43
43
  import { payUrl } from './lib/pay.js';
44
- import { useChatPreferences } from './lib/chatPreferences.js';
45
44
  /** Where the builder links out: every one of them an address of this site. */
46
45
  const LINKS = {
47
46
  github: app('-/sync'),
@@ -81,7 +80,6 @@ export function useDevHost() {
81
80
  const { router, path: pathname } = useRooms();
82
81
  const here = path(route(at(pathname)));
83
82
  const look = useLook();
84
- const [prefs] = useChatPreferences();
85
83
  // The token's claims change only when the token does: a sign-in, a refresh.
86
84
  const memberships = useMemo(() => orgs(), [accessToken]); // eslint-disable-line react-hooks/exhaustive-deps
87
85
  const scoped = useMemo(() => org(), [accessToken]); // eslint-disable-line react-hooks/exhaustive-deps
@@ -113,8 +111,6 @@ export function useDevHost() {
113
111
  links: LINKS,
114
112
  // The sidebar lists Settings' sections and Customize's tabs (Column.tsx), and Customize › Agents offers the cast.
115
113
  sections: true,
116
- // The model is named, and its picker offered, only where Settings' model selector is on (as in Chat).
117
- models: prefs.showModelSelector,
118
114
  cast: CAST,
119
115
  // An address of the app moves the app, another of this site moves in the
120
116
  // router, and another origin is left in this tab. platform.hanzo.ai is
@@ -138,5 +134,5 @@ export function useDevHost() {
138
134
  },
139
135
  signIn: () => enter(),
140
136
  signOut: () => void logout(),
141
- }), [scoped, memberships, look.pref.theme, look.set, prefs.showModelSelector, name, email, avatar, here, router, logout]);
137
+ }), [scoped, memberships, look.pref.theme, look.set, name, email, avatar, here, router, logout]);
142
138
  }
package/dist/hint.d.ts ADDED
@@ -0,0 +1,18 @@
1
+ import type { Act, Hint } from '@hanzo/build';
2
+ export interface HintActions {
3
+ reopen: (threadId: string) => void;
4
+ submit: (query: string) => void;
5
+ target?: unknown;
6
+ setPrepWrong?: (err: string | null) => void;
7
+ t?: (s: string) => string;
8
+ }
9
+ /**
10
+ * Executes a suggestion action:
11
+ * - open: if it points to a chat thread (/chat/<id>), reopens that thread immediately and updates history;
12
+ * if external, opens in a new tab;
13
+ * if another app route, navigates via go;
14
+ * fallback: submits row title as query.
15
+ * - send / task: submits prompt or title directly into the chat room.
16
+ * - schedule: books automation or falls back to submitting the prompt.
17
+ */
18
+ export declare function handleHint(a: Act, row: Hint | undefined, actions: HintActions): void;
package/dist/hint.js ADDED
@@ -0,0 +1,76 @@
1
+ import { book, hand, want, path as devPath } from '@hanzo/build';
2
+ import { app, go } from './lib/host.js';
3
+ /**
4
+ * Executes a suggestion action:
5
+ * - open: if it points to a chat thread (/chat/<id>), reopens that thread immediately and updates history;
6
+ * if external, opens in a new tab;
7
+ * if another app route, navigates via go;
8
+ * fallback: submits row title as query.
9
+ * - send / task: submits prompt or title directly into the chat room.
10
+ * - schedule: books automation or falls back to submitting the prompt.
11
+ */
12
+ export function handleHint(a, row, actions) {
13
+ const { reopen, submit, target, setPrepWrong, t = (s) => s } = actions;
14
+ switch (a.kind) {
15
+ case 'open': {
16
+ const chatMatch = a.to.match(/\/chat\/([^?#/]+)/);
17
+ if (chatMatch && chatMatch[1]) {
18
+ const threadId = decodeURIComponent(chatMatch[1]);
19
+ reopen(threadId);
20
+ go(a.to);
21
+ return;
22
+ }
23
+ if (a.item)
24
+ want(a.item);
25
+ if (/^https:\/\//.test(a.to)) {
26
+ if (typeof window !== 'undefined')
27
+ window.open(a.to, '_blank', 'noopener,noreferrer');
28
+ return;
29
+ }
30
+ if (a.to && a.to !== '/chat') {
31
+ go(a.to.startsWith('/') ? a.to : app(a.to));
32
+ return;
33
+ }
34
+ const query = row?.title;
35
+ if (query) {
36
+ submit(query);
37
+ return;
38
+ }
39
+ return;
40
+ }
41
+ case 'send': {
42
+ const query = a.prompt || row?.title || '';
43
+ if (query)
44
+ submit(query);
45
+ return;
46
+ }
47
+ case 'task': {
48
+ const query = a.prompt || row?.title || '';
49
+ if (query) {
50
+ submit(query);
51
+ }
52
+ else {
53
+ hand('task', '');
54
+ go(app(''));
55
+ }
56
+ return;
57
+ }
58
+ case 'schedule': {
59
+ if (target) {
60
+ void book(target, a, 'chat').then((made) => go(app(devPath({ kind: 'automation', id: made.id }))), (e) => {
61
+ if (a.prompt)
62
+ submit(a.prompt);
63
+ else if (setPrepWrong)
64
+ setPrepWrong(e instanceof Error && e.message ? e.message : t('The scheduled task could not be made.'));
65
+ });
66
+ }
67
+ else if (a.prompt) {
68
+ submit(a.prompt);
69
+ }
70
+ return;
71
+ }
72
+ }
73
+ if (row?.title) {
74
+ submit(row.title);
75
+ }
76
+ }
@@ -1,17 +1,16 @@
1
- import { type Effort } from '@hanzo/build/mind';
2
- import { type EffortLevel } from '../ThinkingEffort.js';
1
+ import { type Effort as Level } from '@hanzo/build/mind';
2
+ import { type Effort } from '@hanzo/ui/chat/pure';
3
3
  export type ApprovalMode = 'auto' | 'manual';
4
+ export declare const DEFAULT_EFFORT: Effort;
4
5
  export interface ChatPreferences {
5
- showModelSelector: boolean;
6
6
  allowThirdPartyModels: boolean;
7
- effort: EffortLevel;
7
+ effort: Effort;
8
8
  approvalMode: ApprovalMode;
9
9
  showLanguage?: boolean;
10
- showTurboApproval?: boolean;
11
10
  effortVersion?: number;
12
11
  }
13
12
  /** The effort Dev takes for one chosen here (@hanzo/build `EFFORTS`: Auto, High, XHigh, Max), or null for Low and Medium, which only Chat offers. */
14
- export declare function shared(effort: EffortLevel): Effort | null;
13
+ export declare function shared(effort: Effort): Level | null;
15
14
  export declare function getChatPreferences(): ChatPreferences;
16
15
  export declare function setChatPreferences(patch: Partial<ChatPreferences>): ChatPreferences;
17
16
  export declare function useChatPreferences(): [ChatPreferences, (patch: Partial<ChatPreferences>) => void];
@@ -1,31 +1,33 @@
1
1
  /**
2
- * Chat composer preferences:
3
- * - showModelSelector: whether model selector is visible in composer (default: false, paid plan feature)
2
+ * What Chat does, kept in this browser. What the composer DRAWS (the key that
3
+ * sends, the chips, the model selector, the mode) is not here: it is one setting
4
+ * for every composer (@hanzo/appearance `composing`, Settings → Appearance).
4
5
  * - allowThirdPartyModels: whether 3rd-party models (OpenAI, Anthropic, etc.) are enabled via pre-paid credit (default: false)
5
6
  * - approvalMode: whether tools/actions run automatically ('auto') or ask for confirmation first ('manual') (default: 'auto')
7
+ * - effort: the reasoning effort a message asks for (default: high)
8
+ * - showLanguage: dictation listens in the person's own language rather than Auto
6
9
  */
7
10
  import { useEffect, useState } from 'react';
8
- import { EFFORTS } from '@hanzo/build/mind';
9
- import { DEFAULT_EFFORT, EFFORT_STEPS } from '../ThinkingEffort.js';
11
+ import { EFFORTS as DEV } from '@hanzo/build/mind';
12
+ import { EFFORTS } from '@hanzo/ui/chat/pure';
13
+ export const DEFAULT_EFFORT = 'high';
10
14
  const STORAGE_KEY = 'hanzo.chat.preferences';
11
15
  const AUTONOMY_KEY = 'hanzo.agent.autonomy';
12
16
  const EVENT_NAME = 'hanzo:chat:preferences';
13
17
  const EFFORT_SCHEMA_VERSION = 3;
14
18
  const DEFAULT_PREFERENCES = {
15
- showModelSelector: false,
16
19
  allowThirdPartyModels: false,
17
20
  effort: DEFAULT_EFFORT,
18
21
  approvalMode: 'auto',
19
22
  showLanguage: false,
20
- showTurboApproval: false,
21
23
  effortVersion: EFFORT_SCHEMA_VERSION,
22
24
  };
23
25
  /** The effort Dev takes for one chosen here (@hanzo/build `EFFORTS`: Auto, High, XHigh, Max), or null for Low and Medium, which only Chat offers. */
24
26
  export function shared(effort) {
25
- return EFFORTS.some((e) => e.id === effort) ? effort : null;
27
+ return DEV.some((e) => e.id === effort) ? effort : null;
26
28
  }
27
29
  function validEffort(v) {
28
- return EFFORT_STEPS.some((s) => s.id === v) ? v : DEFAULT_EFFORT;
30
+ return EFFORTS.some((s) => s.id === v) ? v : DEFAULT_EFFORT;
29
31
  }
30
32
  function validApprovalMode(v, fallbackAutonomy) {
31
33
  if (v === 'manual' || v === 'auto')
@@ -49,12 +51,10 @@ export function getChatPreferences() {
49
51
  const parsed = JSON.parse(raw);
50
52
  const migratedEffort = parsed.effortVersion === EFFORT_SCHEMA_VERSION ? validEffort(parsed.effort) : DEFAULT_EFFORT;
51
53
  return {
52
- showModelSelector: Boolean(parsed.showModelSelector),
53
54
  allowThirdPartyModels: Boolean(parsed.allowThirdPartyModels),
54
55
  effort: migratedEffort,
55
56
  approvalMode: validApprovalMode(parsed.approvalMode, autonomy),
56
57
  showLanguage: Boolean(parsed.showLanguage),
57
- showTurboApproval: Boolean(parsed.showTurboApproval),
58
58
  effortVersion: EFFORT_SCHEMA_VERSION,
59
59
  };
60
60
  }
package/dist/lib/host.js CHANGED
@@ -194,6 +194,11 @@ export function go(address, replace = false) {
194
194
  window.history.replaceState(null, '', address);
195
195
  else
196
196
  window.history.pushState(null, '', address);
197
+ if (typeof window !== 'undefined' && typeof window.dispatchEvent === 'function') {
198
+ const ev = typeof PopStateEvent !== 'undefined' ? new PopStateEvent('popstate') : typeof Event !== 'undefined' ? new Event('popstate') : null;
199
+ if (ev)
200
+ window.dispatchEvent(ev);
201
+ }
197
202
  }
198
203
  /**
199
204
  * Move to an address of this site: one of the app's (`place`) by `go`, which
@@ -35,7 +35,6 @@ export const OUT = '/login?from=logout';
35
35
  * the session. A third-party app the person signed into keeps its own.
36
36
  */
37
37
  export function useSignOut() {
38
- // @ts-expect-error everywhere option added in @hanzo/ui / IAM shared sign-out
39
38
  const signOut = useUiSignOut({ to: OUT, track, everywhere: true });
40
39
  return useCallback(async () => {
41
40
  // Google One Tap signs a returning person in on its own (`auto_select`), which
package/dist/look.js CHANGED
@@ -16,7 +16,7 @@ import { setActivePlatform, BUILTIN_MODS, applyMod, exportMod, importMod, inject
16
16
  import { api } from './lib/api.js';
17
17
  import { useChatPreferences } from './lib/chatPreferences.js';
18
18
  import { useOrg } from './host.js';
19
- import { EFFORT_STEPS } from './ThinkingEffort.js';
19
+ import { EFFORTS } from '@hanzo/ui/chat/pure';
20
20
  import { brand } from './where.js';
21
21
  import { tap } from './lib/tap.js';
22
22
  const CHOICE = { rounded: 8, borderWidth: 1, borderStyle: 'solid', cursor: 'pointer' };
@@ -91,7 +91,7 @@ export function Look() {
91
91
  ].map((opt) => {
92
92
  const active = (chatPrefs.approvalMode || 'auto') === opt.id;
93
93
  return (_jsxs(Box, { render: _jsx("button", { type: "button" }), ...tap, onClick: () => setChatPrefs({ approvalMode: opt.id }), ...CHOICE, flex: 1, p: "$2.5", bg: active ? 'var(--edge, var(--white-14))' : 'transparent', borderColor: active ? 'var(--borderColor, var(--white-22))' : 'var(--white-08)', children: [_jsxs(XStack, { items: "center", justify: "space-between", children: [_jsx(Text, { fontSize: "$3", fontWeight: active ? '600' : '500', color: "$ink", children: opt.label }), active ? _jsx(Check, { size: 16, color: "var(--primary)", "aria-hidden": true }) : null] }), _jsx(Text, { fontSize: "$1", color: "$soft", children: opt.note })] }, opt.id));
94
- }) })] }), _jsx(Separator, {}), _jsxs(YStack, { gap: "$2", "data-slot": "settings-reasoning-effort", children: [_jsx(Text, { fontSize: "$4", fontWeight: "600", color: "$ink", children: t('Default Reasoning Effort') }), _jsx(Text, { fontSize: "$2", color: "$soft", children: t('Sets how deeply models think before answering. Defaults to High.') }), _jsx(XStack, { gap: "$2", pt: "$1", flexWrap: "wrap", children: EFFORT_STEPS.map((step) => {
94
+ }) })] }), _jsx(Separator, {}), _jsxs(YStack, { gap: "$2", "data-slot": "settings-reasoning-effort", children: [_jsx(Text, { fontSize: "$4", fontWeight: "600", color: "$ink", children: t('Default Reasoning Effort') }), _jsx(Text, { fontSize: "$2", color: "$soft", children: t('Sets how deeply models think before answering. Defaults to High.') }), _jsx(XStack, { gap: "$2", pt: "$1", flexWrap: "wrap", children: EFFORTS.map((step) => {
95
95
  const active = (chatPrefs.effort || 'high') === step.id;
96
96
  return (_jsx(Box, { render: _jsx("button", { type: "button" }), ...tap, onClick: () => setChatPrefs({ effort: step.id }), ...CHOICE, py: 6, px: 12, bg: active ? 'var(--edge, var(--white-14))' : 'transparent', borderColor: active ? 'var(--borderColor, var(--white-22))' : 'var(--white-08)', children: _jsxs(XStack, { items: "center", gap: "$1.5", children: [_jsx(Text, { fontSize: "$2", fontWeight: active ? '600' : '400', color: active ? '$ink' : '$soft', children: step.label }), active ? _jsx(Check, { size: 12, color: "var(--primary)", "aria-hidden": true }) : null] }) }, step.id));
97
97
  }) })] })] }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hanzo/app",
3
- "version": "0.2.42",
3
+ "version": "0.2.44",
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",
@@ -50,8 +50,8 @@
50
50
  },
51
51
  "peerDependencies": {
52
52
  "@hanzo/ai": ">=0.6.23",
53
- "@hanzo/appearance": ">=0.2.6",
54
- "@hanzo/build": ">=0.2.83",
53
+ "@hanzo/appearance": ">=0.2.12",
54
+ "@hanzo/build": ">=0.2.84",
55
55
  "@hanzo/composer": ">=0.2.0",
56
56
  "@hanzo/event": ">=0.3.56",
57
57
  "@hanzo/gui": "^8.3.5",
@@ -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.0",
63
+ "@hanzo/ui": ">=8.29.16",
64
64
  "@hanzo/usage": ">=0.1.18",
65
65
  "@hanzo/voice": ">=0.1.16",
66
66
  "@hanzogui/shell": "^8.3.20",
@@ -70,8 +70,8 @@
70
70
  },
71
71
  "devDependencies": {
72
72
  "@hanzo/ai": "0.6.23",
73
- "@hanzo/appearance": "0.2.8",
74
- "@hanzo/build": "0.2.83",
73
+ "@hanzo/appearance": "0.2.12",
74
+ "@hanzo/build": "0.2.84",
75
75
  "@hanzo/composer": "0.2.0",
76
76
  "@hanzo/design": "0.5.34",
77
77
  "@hanzo/event": "0.3.56",
@@ -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.0",
84
+ "@hanzo/ui": "8.29.23",
85
85
  "@hanzo/usage": "0.1.18",
86
86
  "@hanzo/voice": "0.1.19",
87
87
  "@hanzogui/config": "8.3.5",
@@ -1,21 +0,0 @@
1
- import React from 'react';
2
- export type EffortLevel = 'auto' | 'low' | 'medium' | 'high' | 'xhigh' | 'max';
3
- export declare const DEFAULT_EFFORT: EffortLevel;
4
- export interface EffortStep {
5
- id: EffortLevel;
6
- label: string;
7
- note: string;
8
- }
9
- export declare const EFFORT_STEPS: readonly EffortStep[];
10
- export interface ThinkingEffortProps {
11
- effort?: EffortLevel;
12
- onChange: (effort: EffortLevel) => void;
13
- disabled?: boolean;
14
- }
15
- /**
16
- * Native iOS widget-style Thinking effort selector matching standard Safari mobile symmetry:
17
- * - Subtle pill button showing only the active effort level ("High ⌄")
18
- * - Segmented slider popover with discrete stop dots and smooth active fill
19
- * - Default level: "high" across all plans
20
- */
21
- export declare function ThinkingEffort({ effort, onChange, disabled }: ThinkingEffortProps): React.JSX.Element;
@@ -1,97 +0,0 @@
1
- 'use client';
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { useRef, useState } from 'react';
4
- import { Box, Popover, PopoverContent, PopoverTrigger, Text, XStack, YStack } from '@hanzo/ui';
5
- import { ChevronDown, ChevronRight } from 'lucide-react';
6
- import { useI18n } from '@hanzo/i18n/react';
7
- export const DEFAULT_EFFORT = 'high';
8
- export const EFFORT_STEPS = [
9
- { id: 'auto', label: 'Auto', note: 'Adaptive reasoning based on task complexity' },
10
- { id: 'low', label: 'Low', note: 'A quick pass with minimal thinking' },
11
- { id: 'medium', label: 'Medium', note: 'Thinks before answering' },
12
- { id: 'high', label: 'High', note: 'Deep reasoning for complex problems' },
13
- { id: 'xhigh', label: 'XHigh', note: 'Extended multi-step reasoning for hard tasks' },
14
- { id: 'max', label: 'Max', note: 'Maximum compute and exhaustive verification' },
15
- ];
16
- /**
17
- * Native iOS widget-style Thinking effort selector matching standard Safari mobile symmetry:
18
- * - Subtle pill button showing only the active effort level ("High ⌄")
19
- * - Segmented slider popover with discrete stop dots and smooth active fill
20
- * - Default level: "high" across all plans
21
- */
22
- export function ThinkingEffort({ effort = DEFAULT_EFFORT, onChange, disabled = false }) {
23
- const { t } = useI18n();
24
- const [open, setOpen] = useState(false);
25
- const [dragging, setDragging] = useState(false);
26
- const trackRef = useRef(null);
27
- const foundIndex = EFFORT_STEPS.findIndex((s) => s.id === effort);
28
- const activeIndex = foundIndex >= 0 ? foundIndex : EFFORT_STEPS.findIndex((s) => s.id === DEFAULT_EFFORT);
29
- const current = EFFORT_STEPS[activeIndex] ?? EFFORT_STEPS[3];
30
- const updateFromPosition = (clientX) => {
31
- if (!trackRef.current)
32
- return;
33
- const rect = trackRef.current.getBoundingClientRect();
34
- const relativeX = Math.max(0, Math.min(clientX - rect.left, rect.width));
35
- const ratio = rect.width > 0 ? relativeX / rect.width : 0;
36
- const stepIndex = Math.round(ratio * (EFFORT_STEPS.length - 1));
37
- const selected = EFFORT_STEPS[stepIndex];
38
- if (selected && selected.id !== effort) {
39
- onChange(selected.id);
40
- }
41
- };
42
- const handlePointerDown = (e) => {
43
- if (disabled)
44
- return;
45
- setDragging(true);
46
- e.target.setPointerCapture?.(e.pointerId);
47
- updateFromPosition(e.clientX);
48
- };
49
- const handlePointerMove = (e) => {
50
- if (!dragging || disabled)
51
- return;
52
- updateFromPosition(e.clientX);
53
- };
54
- const handlePointerUp = (e) => {
55
- if (dragging) {
56
- setDragging(false);
57
- e.target.releasePointerCapture?.(e.pointerId);
58
- }
59
- };
60
- const percentage = (activeIndex / (EFFORT_STEPS.length - 1)) * 100;
61
- return (_jsxs(Popover, { open: open, onOpenChange: setOpen, allowFlip: true, children: [_jsx(PopoverTrigger, { disabled: disabled, children: _jsxs(XStack, { "data-slot": "thinking-effort-pill", role: "button", tabIndex: disabled ? -1 : 0, "aria-label": t('Thinking effort: {label}', { label: current.label }), "aria-haspopup": "dialog", "aria-expanded": open, items: "center", gap: "$1", px: "$2.5", height: 32, rounded: 9999, cursor: disabled ? 'default' : 'pointer', bg: "var(--edge, var(--white-10))", borderWidth: 1, borderColor: "var(--pane-edge, var(--white-10))", hoverStyle: disabled ? undefined : { bg: '$hover' }, focusVisibleStyle: { outlineColor: '$outlineColor', outlineWidth: 2, outlineStyle: 'solid' }, opacity: disabled ? 0.45 : 1, onKeyDown: (e) => {
62
- if (disabled)
63
- return;
64
- if (e.key === 'Enter' || e.key === ' ' || e.key === 'ArrowUp' || e.key === 'ArrowDown') {
65
- e.preventDefault();
66
- setOpen(true);
67
- }
68
- }, children: [_jsx(Text, { fontSize: "$2", fontWeight: "500", color: "$ink", children: t(current.label) }), _jsx(ChevronDown, { size: 12, color: "var(--soft, var(--muted-foreground))", "aria-hidden": true })] }) }), _jsx(PopoverContent, { solid: true, align: "end", p: "$3", width: 260, minW: 260, maxW: 260, items: "stretch", rounded: "$4", bg: "var(--pane-fill, var(--surface-card))", borderWidth: 1, borderColor: "var(--pane-edge, var(--white-15))", boxShadow: "var(--shadow-sheet-1)", backdropFilter: "var(--pane-blur, blur(24px) saturate(190%))", children: _jsxs(YStack, { gap: "$3", width: "100%", minW: 234, maxW: 234, self: "stretch", "data-slot": "thinking-effort-card", role: "dialog", "aria-label": t('Thinking effort'), children: [_jsxs(XStack, { items: "center", justify: "center", gap: "$1", cursor: "pointer", onClick: () => {
69
- if (disabled)
70
- return;
71
- const next = EFFORT_STEPS[(activeIndex + 1) % EFFORT_STEPS.length];
72
- if (next)
73
- onChange(next.id);
74
- }, children: [_jsx(Text, { fontSize: "$3", fontWeight: "600", color: "$ink", children: current.label }), _jsx(ChevronRight, { size: 14, color: "var(--soft, var(--muted-foreground))", "aria-hidden": true })] }), _jsxs(Box, { ref: trackRef, "data-slot": "thinking-slider-track", role: "slider", "aria-valuemin": 0, "aria-valuemax": EFFORT_STEPS.length - 1, "aria-valuenow": activeIndex, "aria-valuetext": current.label, position: "relative", width: "100%", height: 28, rounded: 9999, bg: "var(--edge, var(--white-14))", cursor: "pointer", onPointerDown: handlePointerDown, onPointerMove: handlePointerMove, onPointerUp: handlePointerUp, onPointerCancel: () => setDragging(false),
75
- // inline-style: touch-action for discrete slider gestures
76
- style: { touchAction: 'none' }, children: [_jsx(Box, { position: "absolute", insetInlineStart: 0, t: 0, b: 0, rounded: 9999, bg: "var(--accent, var(--primary))",
77
- // inline-style: dynamic percentage width of active effort slider fill
78
- style: {
79
- width: `calc(${percentage}% + 14px)`,
80
- maxWidth: '100%',
81
- transition: dragging ? 'none' : 'width 0.2s cubic-bezier(0.16, 1, 0.3, 1)',
82
- } }), EFFORT_STEPS.map((step, idx) => {
83
- const dotPercent = (idx / (EFFORT_STEPS.length - 1)) * 100;
84
- const isPassed = idx <= activeIndex;
85
- return (_jsx(Box, { position: "absolute", t: "50%",
86
- // inline-style: discrete dot step stop position on track
87
- style: {
88
- left: `calc(14px + (100% - 28px) * ${dotPercent / 100})`,
89
- transform: 'translate(-50%, -50%)',
90
- }, width: 4, height: 4, rounded: 9999, bg: isPassed ? 'var(--pure-white)' : 'var(--white-40)', pointerEvents: "none" }, step.id));
91
- }), _jsx(Box, { "data-slot": "thinking-slider-thumb", position: "absolute", t: 2, width: 24, height: 24, rounded: 9999, bg: "var(--pure-white)", boxShadow: "0 2px 6px var(--surface-overlay)", pointerEvents: "none",
92
- // inline-style: discrete thumb position computed from active step
93
- style: {
94
- left: `calc(2px + (100% - 28px) * ${percentage / 100})`,
95
- transition: dragging ? 'none' : 'left 0.2s cubic-bezier(0.16, 1, 0.3, 1)',
96
- } })] }), _jsx(XStack, { width: "100%", minH: 32, items: "center", justify: "center", px: "$1", children: _jsx(Text, { fontSize: "$1", color: "$soft", text: "center", children: t(current.note) }) })] }) })] }));
97
- }