@hanzo/app 0.3.51 → 0.3.53

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/App.js CHANGED
@@ -357,7 +357,7 @@ function Window({ bar, betas }) {
357
357
  // scrolls inside, collapsed to its border (Projects drew blank). The rest of the row
358
358
  // beside the rail and the sidebar, never width 100%: a View does not shrink, so at the
359
359
  // row's full width again the pane stood past the window's edge.
360
- flex: 1, minW: 0, minH: 0, marginInlineStart: closed || alone ? 0 : 'var(--pane-gap)', "$max-md": { marginInlineStart: 0, pb: `max(var(--pane-gap), ${FOOT})` }, children: [bar ? null : _jsx(Bar, { host: host, mode: mode, places: sidebar, open: drawer.state !== 'shut', go: move, onMenu: drawer.open, onChat: toChat, onDev: toDev }), _jsx(XStack, { "data-slot": "panes", flex: 1, display: "grid", gridTemplateAreas: '"pane side"', gridTemplateColumns: "minmax(0, 1fr) auto", gridTemplateRows: "minmax(0, 1fr)", minW: 0, minH: 0, children: anonSettings && host.person === null ? (_jsx(YStack, { render: "main", "data-slot": "pane", ...pane(), overflow: "hidden", flex: 1, minW: 0, minH: 0, children: _jsx(AnonSettingsPane, { host: host, onClose: () => {
360
+ flex: 1, minW: 0, minH: 0, marginInlineStart: closed || alone ? 0 : 'var(--pane-gap)', "$max-md": { marginInlineStart: 0, pb: `max(var(--pane-gap), ${FOOT})` }, children: [bar ? null : _jsx(Bar, { host: host, mode: mode, places: sidebar, open: drawer.state !== 'shut', go: move, onMenu: drawer.open }), _jsx(XStack, { "data-slot": "panes", flex: 1, display: "grid", gridTemplateAreas: '"pane side"', gridTemplateColumns: "minmax(0, 1fr) auto", gridTemplateRows: "minmax(0, 1fr)", minW: 0, minH: 0, children: anonSettings && host.person === null ? (_jsx(YStack, { render: "main", "data-slot": "pane", ...pane(), overflow: "hidden", flex: 1, minW: 0, minH: 0, children: _jsx(AnonSettingsPane, { host: host, onClose: () => {
361
361
  setAnonSettings(false);
362
362
  if (typeof window !== 'undefined') {
363
363
  window.dispatchEvent(new CustomEvent('hanzo:anon-settings', { detail: { open: false } }));
package/dist/Bar.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { type Host } from '@hanzo/build';
2
2
  import type { RailLink } from '@hanzo/ui/chat';
3
3
  import { type Place } from './lib/host.js';
4
- export declare function Bar({ host, mode, places, open, go, onMenu, onChat, onDev, }: {
4
+ export declare function Bar({ host, mode, places, open, go, onMenu, }: {
5
5
  host: Host;
6
6
  mode: Place['mode'];
7
7
  /** The mode's places, where they are not Dev's (Studio's `nav`). */
@@ -14,6 +14,4 @@ export declare function Bar({ host, mode, places, open, go, onMenu, onChat, onDe
14
14
  /** Moves the app, the drawer away first. */
15
15
  go: (address: string) => void;
16
16
  onMenu: () => void;
17
- onChat: () => void;
18
- onDev: () => void;
19
17
  }): import("react").JSX.Element;
package/dist/Bar.js CHANGED
@@ -1,37 +1,32 @@
1
1
  'use client';
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  // A phone's bar, which has neither rail nor sidebar to move the app: the
4
- // drawer's button at the start, Chat | Dev in the middle, and New at the end
5
- // (the owner's iPhone reference; LLM.md "The app is `App`"). Right to left the
6
- // row turns with the page, and the drawer's mark is mirrored.
4
+ // drawer's button at the start and New at the end. The drawer lists the places
5
+ // (Chat, Dev, Studio, Tabs, Library, Scheduled tasks, Customize) as rows, so the
6
+ // bar carries no switch of its own. Right to left the row turns with the page,
7
+ // and the drawer's mark is mirrored.
7
8
  //
8
- // (≡) ( Chat | Dev ) (✎)
9
+ // (≡) (✎)
9
10
  //
10
- // The three are glass: the pane's material (ground.ts) cut round, its edge one
11
- // step stronger so a circle on the bare floor reads as one. Measured on the
11
+ // Both are glass: the pane's material (ground.ts) cut round, its edge one step
12
+ // stronger so a circle on the bare floor reads as one. Measured on the
12
13
  // reference at 440×956: the buttons are 44px circles 20px in from each edge,
13
- // the pill 158×48 with a 40px segment inside a 4px rim, its labels at 15px
14
- // medium, all centred on one line 48px tall under the device's top inset.
14
+ // all centred on one line 48px tall under the device's top inset.
15
15
  //
16
- // Chat | Dev moves the app the way the rail does (`onChat`, `onDev`: where each
17
- // was last). In Studio neither is lit. New is Chat's New chat, and elsewhere the
18
- // mode's own New row (@hanzo/build's and @hanzo/studio's `nav`, `NEW`), so the
19
- // bar names it as the sidebar does.
16
+ // New is Chat's New chat, and elsewhere the mode's own New row (@hanzo/build's
17
+ // and @hanzo/studio's `nav`, `NEW`), so the bar names it as the sidebar does;
18
+ // its icon is the mode's `make` mark (@hanzo/build `MARKS`): the pen in Chat,
19
+ // `</>` in Dev, the terminal in Tabs.
20
20
  import { useI18n } from '@hanzo/i18n/react';
21
- import { SquarePen } from 'lucide-react';
22
- import { Text, XStack } from '@hanzo/gui';
23
- import { nav, NEW } from '@hanzo/build';
24
- import { ToggleGroup, ToggleGroupItem } from '@hanzo/ui';
21
+ import { XStack } from '@hanzo/gui';
22
+ import { MARKS, nav, NEW } from '@hanzo/build';
25
23
  import { BAND, pane } from './ground.js';
26
24
  import { empty } from './open.js';
27
25
  import { talk } from './lib/host.js';
26
+ import { dispatchTabsAction } from './Sidebar.js';
28
27
  /** A button, px: compact and refined. */
29
28
  const ROUND = 34;
30
- /** The bar's line under the device's top inset, px: the pill's height. */
31
- const LINE = 34;
32
- /** A segment, px: compact switcher button. */
33
- const SEGMENT = 56;
34
- /** The glass the three are cut from. */
29
+ /** The glass the two are cut from. */
35
30
  const GLASS = {
36
31
  ...pane(),
37
32
  borderWidth: 1,
@@ -48,11 +43,7 @@ function Round({ label, onPress, opacity, pointerEvents, children, ...rest }) {
48
43
  function Lines() {
49
44
  return (_jsx("svg", { width: 15, height: 9, viewBox: "0 0 19 11", fill: "none", stroke: "currentColor", strokeWidth: 2, strokeLinecap: "round", "aria-hidden": true, "data-i18n-mirror": true, children: _jsx("path", { d: "M1 1h17M1 10h10.7" }) }));
50
45
  }
51
- /** One side of the pill. */
52
- function Segment({ value, children }) {
53
- return (_jsx(ToggleGroupItem, { value: value, size: "sm", width: SEGMENT, height: 24, maxH: 24, minH: 0, $touchable: { minH: 0 }, p: 0, px: 0, py: 0, m: 0, borderWidth: 0, overflow: "hidden", boxSizing: "border-box", rounded: 9999, bg: "transparent", borderColor: "transparent", hoverStyle: { bg: '$hover' }, activeStyle: { bg: '$raised', borderColor: 'transparent', borderWidth: 0 }, children: _jsx(Text, { fontSize: "$2", fontWeight: "600", color: "$ink", numberOfLines: 1, children: children }) }));
54
- }
55
- export function Bar({ host, mode, places, open = false, go, onMenu, onChat, onDev, }) {
46
+ export function Bar({ host, mode, places, open = false, go, onMenu, }) {
56
47
  const { t } = useI18n();
57
48
  const made = mode === 'chat' ? null : (places ?? nav(host, (p) => host.go(p), t)).flatMap((g) => g.links).find((l) => l.id === NEW);
58
49
  const fresh = mode === 'chat'
@@ -63,6 +54,9 @@ export function Bar({ host, mode, places, open = false, go, onMenu, onChat, onDe
63
54
  go(talk());
64
55
  },
65
56
  }
66
- : { label: made?.label ?? t('New'), onPress: made?.onPress };
67
- return (_jsxs(XStack, { "data-slot": "app-bar", display: "grid", gridTemplateColumns: "1fr auto 1fr", items: "center", height: `calc(${BAND}px + var(--safe-top) + var(--pane-gap))`, pt: "calc(var(--safe-top) + var(--pane-gap))", px: "$4.5", shrink: 0, $md: { display: 'none' }, children: [_jsx(XStack, { justifySelf: "start", children: _jsx(Round, { label: t('Open sidebar'), "data-slot": "bar-menu", onPress: onMenu, pointerEvents: open ? 'none' : 'auto', children: _jsx(Lines, {}) }) }), _jsx(XStack, { "data-slot": "bar-mode", ...GLASS, height: LINE, p: "$1", overflow: "hidden", boxSizing: "border-box", items: "center", justifySelf: "center", children: _jsxs(ToggleGroup, { type: "single", "aria-label": t('App'), value: mode === 'chat' || mode === 'dev' ? mode : '', disableDeactivation: true, onValueChange: (v) => (v === 'chat' ? onChat() : v === 'dev' ? onDev() : undefined), children: [_jsx(Segment, { value: "chat", children: t('Chat') }), _jsx(Segment, { value: "dev", children: "Dev" })] }) }), _jsx(XStack, { justifySelf: "end", children: fresh.onPress ? (_jsx(Round, { label: fresh.label, "data-slot": "bar-new", onPress: fresh.onPress, children: _jsx(SquarePen, { size: 16, strokeWidth: 1.75, "aria-hidden": true }) })) : (_jsx(XStack, { width: ROUND, height: ROUND, "aria-hidden": true })) })] }));
57
+ : mode === 'tabs'
58
+ ? { label: t('New terminal'), onPress: () => dispatchTabsAction({ kind: 'shell' }) }
59
+ : { label: made?.label ?? t('New'), onPress: made?.onPress };
60
+ const Make = mode === 'chat' || mode === 'dev' || mode === 'tabs' || mode === 'studio' ? MARKS[mode].make : MARKS.chat.make;
61
+ return (_jsxs(XStack, { "data-slot": "app-bar", items: "center", justify: "space-between", height: `calc(${BAND}px + var(--safe-top) + var(--pane-gap))`, pt: "calc(var(--safe-top) + var(--pane-gap))", px: "$4.5", shrink: 0, $md: { display: 'none' }, children: [_jsx(Round, { label: t('Open sidebar'), "data-slot": "bar-menu", onPress: onMenu, pointerEvents: open ? 'none' : 'auto', children: _jsx(Lines, {}) }), fresh.onPress ? (_jsx(Round, { label: fresh.label, "data-slot": "bar-new", onPress: fresh.onPress, children: _jsx(Make, { size: 16, strokeWidth: 1.75, "aria-hidden": true }) })) : (_jsx(XStack, { width: ROUND, height: ROUND, "aria-hidden": true }))] }));
68
62
  }
package/dist/Chat.js CHANGED
@@ -69,7 +69,7 @@ import { keepFile, useAttach, useKeep } from "./keep.js";
69
69
  import { useKept } from "./kept.js";
70
70
  import { dragWindow, toggleWindowMaximize } from "./WindowControls.js";
71
71
  import { artifacts, lead, nameOf, PAGE, Panel, PanelToggle, renders, Reply, Summary, useDeck, useKey, Suggestions, useCarry, useLanguage, useMind, useSuggestions, taken, CHAT_MODES, usePanel, frames, name as tabName, } from "@hanzo/build";
72
- import { checkoutUrl, payUrl } from './lib/pay.js';
72
+ import { checkoutUrl, payUrl, topUp } from './lib/pay.js';
73
73
  import { Upgrade, useFree } from './Upgrade.js';
74
74
  import { enter, LOGIN } from './lib/destination.js';
75
75
  import { first } from './lib/first.js';
@@ -556,7 +556,7 @@ function Thread({ placeholder = message(), initial, anonymous = false, settled =
556
556
  const catalog = useRef([]);
557
557
  const planUsage = useLimits(!anonymous, org(), (id) => nameOf(id, catalog.current));
558
558
  const { limits, notice, reload: reread } = planUsage;
559
- const mind = useMind(target, anonymous ? "free" : limits?.plan);
559
+ const mind = useMind(target, anonymous ? "free" : limits?.plan, anonymous ? undefined : topUp);
560
560
  catalog.current = mind.models;
561
561
  // Chat's effort is its own (six steps, sent as `reasoning_effort`); a
562
562
  // pick of one Dev offers too moves Dev's, where it is made, and opening Chat
@@ -1904,7 +1904,8 @@ function Thread({ placeholder = message(), initial, anonymous = false, settled =
1904
1904
  },
1905
1905
  },
1906
1906
  // The model, only where the person turned the model selector on; the effort, always.
1907
- mind: anonymous ? null : mind,
1907
+ // The picker lists what the person has turned on: third-party models (paid from the balance) unless they turned them off.
1908
+ mind: anonymous ? null : { ...mind, models: filteredListed },
1908
1909
  effort: {
1909
1910
  value: chatPrefs.effort || "auto",
1910
1911
  set: (eff) => {
@@ -0,0 +1,53 @@
1
+ /**
2
+ * The account chooser: who is signed in on this browser, and a press to be any one
3
+ * of them. One view for every site that signs people in on its own origin.
4
+ *
5
+ * IAM holds a session for each person signed in here and lists them (`GET
6
+ * /v1/iam/accounts`, lib/accounts); this draws that list and decides nothing.
7
+ *
8
+ * a row the sign-in for that account: the host's `pick` (IAM's
9
+ * `resume` with the account named, then on to the code it
10
+ * answers)
11
+ * Sign out that account alone (IAM's `logout_hint`); the page is drawn
12
+ * again from what IAM still holds
13
+ * Use another account the sign-in form (`onOther`), which keeps these sessions
14
+ * Sign out of all every account, and the page the person was on
15
+ *
16
+ * What differs by site is handed in: `pick` (analytics, an app's request being
17
+ * answered), `frame` (the card around the rows) and `refusal` (how a refusal is
18
+ * said). A tab that holds tokens for an account IAM lists no session for is offered
19
+ * as the one row (`listed` false), and its Sign out is the whole sign-out.
20
+ */
21
+ import { type ComponentType, type ReactNode } from 'react';
22
+ import { type Account, type Accounts } from './lib/accounts.js';
23
+ /** The card the rows sit in; the page's own (hanzo.ai's Sheet), else a plain column. */
24
+ export type Frame = ComponentType<{
25
+ label: string;
26
+ children: ReactNode;
27
+ }>;
28
+ /** How a refusal is said; the page's own, else plain text in the alert role. */
29
+ export type Refusal = ComponentType<{
30
+ text: string | null;
31
+ }>;
32
+ export interface ChooseProps {
33
+ /** The accounts to choose among: IAM's list, else this tab's own. */
34
+ rows: Account[];
35
+ /** Whether `rows` is IAM's list, each with a session to end alone. */
36
+ listed: boolean;
37
+ known: Pick<Accounts, 'leave'>;
38
+ /** The sign-in form instead. */
39
+ onOther: () => void;
40
+ /**
41
+ * Be the account pressed: true once it is on its way, false where IAM has no
42
+ * session to spend for it (the form is then asked for the credential).
43
+ */
44
+ pick: (account: Account) => Promise<boolean>;
45
+ frame?: ComponentType<{
46
+ label: string;
47
+ children: ReactNode;
48
+ }>;
49
+ refusal?: Refusal;
50
+ /** Said above the rows (another app's request being answered). */
51
+ note?: ReactNode;
52
+ }
53
+ export declare function Choose({ rows, listed, known, onOther, pick, frame: Frame, refusal: Wrong, note }: ChooseProps): import("react").JSX.Element;
package/dist/Choose.js ADDED
@@ -0,0 +1,68 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ /**
4
+ * The account chooser: who is signed in on this browser, and a press to be any one
5
+ * of them. One view for every site that signs people in on its own origin.
6
+ *
7
+ * IAM holds a session for each person signed in here and lists them (`GET
8
+ * /v1/iam/accounts`, lib/accounts); this draws that list and decides nothing.
9
+ *
10
+ * a row the sign-in for that account: the host's `pick` (IAM's
11
+ * `resume` with the account named, then on to the code it
12
+ * answers)
13
+ * Sign out that account alone (IAM's `logout_hint`); the page is drawn
14
+ * again from what IAM still holds
15
+ * Use another account the sign-in form (`onOther`), which keeps these sessions
16
+ * Sign out of all every account, and the page the person was on
17
+ *
18
+ * What differs by site is handed in: `pick` (analytics, an app's request being
19
+ * answered), `frame` (the card around the rows) and `refusal` (how a refusal is
20
+ * said). A tab that holds tokens for an account IAM lists no session for is offered
21
+ * as the one row (`listed` false), and its Sign out is the whole sign-out.
22
+ */
23
+ import { useState } from 'react';
24
+ import { useIam } from '@hanzo/iam/react';
25
+ import { useI18n } from '@hanzo/i18n/react';
26
+ import { Text, XStack, YStack } from '@hanzo/gui';
27
+ import { Avatar, Button } from '@hanzo/ui';
28
+ import { TextLink } from '@hanzo/ui/marketing';
29
+ import { label } from './lib/accounts.js';
30
+ import { useSignOut } from './lib/signout.js';
31
+ const Plain = ({ label: name, children }) => (_jsx(YStack, { render: "section", "aria-label": name, width: "100%", maxW: 420, mx: "auto", gap: "$4", children: children }));
32
+ const Said = ({ text }) => text ? (_jsx(Text, { role: "alert", fontSize: "$3", color: "$ink", text: "center", children: text })) : null;
33
+ /** Where this page is, the request included: what a sign-out comes back to, so the page's own request is still the page's. */
34
+ const here = () => `${window.location.pathname}${window.location.search}`;
35
+ export function Choose({ rows, listed, known, onOther, pick, frame: Frame = Plain, refusal: Wrong = Said, note }) {
36
+ const { t } = useI18n();
37
+ const { user } = useIam();
38
+ const out = useSignOut(typeof window === 'undefined' ? undefined : here());
39
+ const [busy, setBusy] = useState(false);
40
+ const [wrong, setWrong] = useState(null);
41
+ const signedIn = user;
42
+ async function go(a) {
43
+ setBusy(true);
44
+ setWrong(null);
45
+ try {
46
+ if (!(await pick(a)))
47
+ onOther();
48
+ }
49
+ catch {
50
+ setWrong(t('Something went wrong. Try again.'));
51
+ setBusy(false);
52
+ }
53
+ }
54
+ async function leave(a) {
55
+ setBusy(true);
56
+ setWrong(null);
57
+ if (!listed)
58
+ return void out();
59
+ if (!(await known.leave(a, here())))
60
+ setWrong(t('Something went wrong. Try again.'));
61
+ setBusy(false);
62
+ }
63
+ return (_jsxs(Frame, { label: t('Accounts'), children: [note, _jsx(YStack, { render: "ul", "aria-label": t('Signed in on this browser'), m: 0, p: 0, gap: "$2", children: rows.map((a) => {
64
+ const { title, line } = label(a);
65
+ const who = a.email || title;
66
+ return (_jsxs(XStack, { render: "li", items: "center", gap: "$2", children: [_jsxs(XStack, { render: _jsx("button", { type: "button" }), disabled: busy, onClick: () => void go(a), "aria-label": t('Continue as {who}', { who }), "aria-current": signedIn && (a.sub === signedIn.id || a.email === signedIn.email) ? true : undefined, flex: 1, minW: 0, items: "center", gap: "$3", px: "$3", py: "$2.5", rounded: "$4", borderWidth: 1, borderColor: "$edge", bg: "transparent", cursor: "pointer", hoverStyle: { bg: '$hover' }, children: [_jsx(Avatar, { src: a.avatar || null, name: title, colorSeed: a.sub, alt: "", size: 36, width: 36, height: 36, rounded: 999 }), _jsxs(YStack, { flex: 1, minW: 0, gap: 2, children: [_jsx(Text, { fontSize: "$3", fontWeight: "600", color: "$ink", numberOfLines: 1, text: "start", children: title }), line || a.owner ? (_jsx(Text, { fontSize: "$2", color: "$soft", numberOfLines: 1, text: "start", children: [line, a.owner].filter(Boolean).join(' · ') })) : null] })] }), _jsx(Button, { type: "button", size: "xs", variant: "ghost", disabled: busy, "aria-label": t('Sign out {name}', { name: title }), onClick: () => void leave(a), children: t('Sign out') })] }, a.sub));
67
+ }) }), _jsx(Wrong, { text: wrong }), _jsx(TextLink, { onPress: onOther, children: t('Use another account') }), rows.length > 1 ? _jsx(TextLink, { onPress: () => void out(), children: t('Sign out of all accounts') }) : null] }));
68
+ }
package/dist/Home.js CHANGED
@@ -16,9 +16,10 @@ import { dev } from './lib/host.js';
16
16
  import { phrase } from '@hanzo/i18n';
17
17
  import { useI18n } from '@hanzo/i18n/react';
18
18
  import { useEffect, useMemo, useState } from 'react';
19
- import { AtSign, Blocks, Bot, Code2, FolderGit2, Hash, MessageSquare, Plus, UserPlus } from 'lucide-react';
19
+ import { AtSign, Blocks, Bot, FolderGit2, Hash, Plus, UserPlus } from 'lucide-react';
20
20
  import { useAgents, usePeople, useSessions, useThreads } from '@hanzo/ai/react';
21
21
  import { Composer } from '@hanzo/ui/chat';
22
+ import { MARKS } from '@hanzo/build';
22
23
  import { Crew } from './crew.js';
23
24
  import { Box, Text, XStack, YStack } from '@hanzo/ui';
24
25
  import { tap } from './lib/tap.js';
@@ -236,7 +237,7 @@ function Chats() {
236
237
  const { t } = useI18n();
237
238
  const { threads, loading } = useThreads();
238
239
  const { open } = useOpen();
239
- return (_jsx(Card, { kind: "chats", icon: _jsx(MessageSquare, { size: 14, "aria-hidden": true }), title: t('Chats'), children: loading && threads.length === 0 ? (_jsx(Waiting, { subject: t('your chats') })) : threads.length === 0 ? (_jsx(Quiet, { children: t('No chats yet.') })) : (_jsx(YStack, { gap: "$1", children: threads.slice(0, 3).map((one) => (_jsx(Row, { onPress: () => open(one.id), children: one.title || t('Untitled') }, one.id))) })) }));
240
+ return (_jsx(Card, { kind: "chats", icon: _jsx(MARKS.chat.icon, { size: 14, "aria-hidden": true }), title: t('Chats'), children: loading && threads.length === 0 ? (_jsx(Waiting, { subject: t('your chats') })) : threads.length === 0 ? (_jsx(Quiet, { children: t('No chats yet.') })) : (_jsx(YStack, { gap: "$1", children: threads.slice(0, 3).map((one) => (_jsx(Row, { onPress: () => open(one.id), children: one.title || t('Untitled') }, one.id))) })) }));
240
241
  }
241
242
  /**
242
243
  * What is going, then what to do next.
@@ -315,5 +316,5 @@ function Mates({ owner }) {
315
316
  }
316
317
  function Build() {
317
318
  const { t } = useI18n();
318
- return (_jsxs(Card, { kind: "build", icon: _jsx(Code2, { size: 14, "aria-hidden": true }), title: t('Build'), children: [_jsx(Quiet, { children: t('Hanzo Dev writes it, runs it, ships it.') }), _jsx(Go, { href: dev(), children: t('Open Dev') })] }));
319
+ return (_jsxs(Card, { kind: "build", icon: _jsx(MARKS.dev.icon, { size: 14, "aria-hidden": true }), title: t('Build'), children: [_jsx(Quiet, { children: t('Hanzo Dev writes it, runs it, ships it.') }), _jsx(Go, { href: dev(), children: t('Open Dev') })] }));
319
320
  }
@@ -0,0 +1,6 @@
1
+ import { type Account } from './lib/accounts.js';
2
+ export declare function Others({ out, pick, add }: {
3
+ out: () => void | Promise<void>;
4
+ pick?: (account: Account) => void | Promise<void>;
5
+ add?: () => void | Promise<void>;
6
+ }): import("react").JSX.Element;
package/dist/Others.js ADDED
@@ -0,0 +1,24 @@
1
+ 'use client';
2
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ /**
4
+ * The account menu's rows for the accounts signed in on this browser: each other
5
+ * account one press away, Add account, Sign out of this one alone when there are
6
+ * others, and the way out of all of them (Log out when there is one). They go
7
+ * inside a host's own `DropdownMenuContent`, after its own rows; what a press does
8
+ * is lib/accounts' unless the host hands its own (`pick`, `add`), for a site whose
9
+ * sign-in page is its own.
10
+ */
11
+ import { LogOut, UserPlus } from 'lucide-react';
12
+ import { useI18n } from '@hanzo/i18n/react';
13
+ import { Text, XStack, YStack } from '@hanzo/gui';
14
+ import { Avatar, DropdownMenuItem } from '@hanzo/ui';
15
+ import { label, useAccounts } from './lib/accounts.js';
16
+ export function Others({ out, pick, add }) {
17
+ const { t } = useI18n();
18
+ const { accounts, current, switchTo, add: start, leave } = useAccounts();
19
+ const others = accounts.filter((a) => a.sub !== current?.sub);
20
+ return (_jsxs(_Fragment, { children: [others.map((a) => {
21
+ const { title, line } = label(a);
22
+ return (_jsx(DropdownMenuItem, { onSelect: () => void (pick ?? switchTo)(a), children: _jsxs(XStack, { items: "center", gap: 8, width: "100%", children: [_jsx(Avatar, { src: a.avatar || null, name: title, colorSeed: a.sub, alt: "", size: 22, width: 22, height: 22, rounded: 999 }), _jsxs(YStack, { minW: 0, flex: 1, children: [_jsx(Text, { fontSize: "$2", color: "$ink", numberOfLines: 1, children: title }), line ? (_jsx(Text, { fontSize: "$1", color: "$soft", numberOfLines: 1, children: line })) : null] })] }) }, a.sub));
23
+ }), _jsx(DropdownMenuItem, { onSelect: () => void (add ?? start)(), children: _jsxs(XStack, { items: "center", gap: 8, width: "100%", children: [_jsx(UserPlus, { size: 15, color: "var(--muted-foreground)", "aria-hidden": true }), _jsx(Text, { fontSize: "$2", color: "$ink", children: t('Add account') })] }) }), others.length > 0 && current ? (_jsx(DropdownMenuItem, { onSelect: () => void leave(current), children: _jsxs(XStack, { items: "center", gap: 8, width: "100%", children: [_jsx(LogOut, { size: 15, color: "var(--muted-foreground)", "aria-hidden": true }), _jsx(Text, { fontSize: "$2", color: "$ink", children: t('Sign out {name}', { name: label(current).title }) })] }) })) : null, _jsx(DropdownMenuItem, { onSelect: () => void out(), children: _jsxs(XStack, { items: "center", gap: 8, width: "100%", children: [_jsx(LogOut, { size: 15, color: "var(--destructive)", "aria-hidden": true }), _jsx(Text, { fontSize: "$2", color: "var(--destructive)", children: others.length > 0 ? t('Sign out of all accounts') : t('Log out') })] }) })] }));
24
+ }
package/dist/Rail.js CHANGED
@@ -5,8 +5,10 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
5
5
  // More (Team, on a host of its own, then the apps in beta this reader may open
6
6
  // and Betas, the list of every app in beta; none of it in Studio), and the
7
7
  // account at the foot. It
8
- // is how the app moves between its products; a phone, which has no rail,
9
- // switches Chat and Dev in its bar (Bar.tsx).
8
+ // is how the app moves between its products; a phone's drawer holds it down its
9
+ // start edge, as a laptop's window does, and its bar carries no switch of its
10
+ // own. Every mark is @hanzo/build's `MARKS`, the one source the sidebars, the
11
+ // bar, the palette and the landing pages draw from.
10
12
  //
11
13
  // Studio is the app's third mode (@hanzo/studio at /studio), each of the three
12
14
  // opened where the reader left it.
@@ -30,14 +32,14 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
30
32
  // a browser tab. A host that is a window draws the toggle in its bar beside Back
31
33
  // and Forward (App.tsx `bar`), and its rail starts with Chat. A phone has no
32
34
  // rail: its menu (Drawer.tsx) lists the places as rows (`rows`) under the mode's
33
- // own — Studio, Tabs, then More, which Library, Scheduled tasks and Customize
34
- // lead there. Chat and Dev are the phone's bar's (Bar.tsx), and the account is
35
- // the menu's foot.
35
+ // own — Design, Studio, Tabs, then More, which Library, Scheduled tasks and
36
+ // Customize lead there. Chat and Dev are the rail's marks beside them, and the
37
+ // account is the menu's foot.
36
38
  import { useI18n } from '@hanzo/i18n/react';
37
- import { Bot, CircleHelp, Clapperboard, Clock, Code2, Compass, Ellipsis, FlaskConical, Library, MessageSquare, PanelLeft, Puzzle, Settings, Sparkles, SquareTerminal, Users, WandSparkles } from 'lucide-react';
39
+ import { Bot, CircleHelp, Compass, Ellipsis, FlaskConical, PanelLeft, Settings, Sparkles, Users } from 'lucide-react';
38
40
  import { useState } from 'react';
39
41
  import { Text, XStack, YStack } from '@hanzo/gui';
40
- import { route } from '@hanzo/build';
42
+ import { MARKS, route } from '@hanzo/build';
41
43
  import { DropdownMenu } from '@hanzo/ui';
42
44
  import { SidebarItem } from '@hanzo/ui/chat';
43
45
  import { BetasDialog, useBetas } from './Betas.js';
@@ -106,9 +108,9 @@ export function Rail({ host, mode, at, open, toggle, inside = null, rows = false
106
108
  const rest = [
107
109
  ...(rows
108
110
  ? [
109
- { key: 'library', label: t('Library'), icon: _jsx(Library, { size: 16, "aria-hidden": true }), onSelect: to(RAISED.library) },
110
- { key: 'scheduled', label: t('Scheduled tasks'), icon: _jsx(Clock, { size: 16, "aria-hidden": true }), onSelect: to(RAISED.scheduled) },
111
- { key: 'customize', label: t('Customize'), icon: _jsx(Puzzle, { size: 16, "aria-hidden": true }), onSelect: to(RAISED.customize) },
111
+ { key: 'library', label: t('Library'), icon: _jsx(MARKS.library.icon, { size: 16, "aria-hidden": true }), onSelect: to(RAISED.library) },
112
+ { key: 'scheduled', label: t('Scheduled tasks'), icon: _jsx(MARKS.scheduled.icon, { size: 16, "aria-hidden": true }), onSelect: to(RAISED.scheduled) },
113
+ { key: 'customize', label: t('Customize'), icon: _jsx(MARKS.customize.icon, { size: 16, "aria-hidden": true }), onSelect: to(RAISED.customize) },
112
114
  ...(team ? [{ type: 'separator', key: 'raised' }] : []),
113
115
  ]
114
116
  : []),
@@ -123,12 +125,12 @@ export function Rail({ host, mode, at, open, toggle, inside = null, rows = false
123
125
  ];
124
126
  const betasDialog = _jsx(BetasDialog, { open: betas, onOpenChange: setBetas, go: reach });
125
127
  if (rows)
126
- return (_jsxs(YStack, { "data-slot": "places", render: "nav", "aria-label": t('Products'), pt: "$2", shrink: 0, children: [_jsxs(YStack, { role: "list", gap: 2, children: [anon ? null : (_jsx(YStack, { role: "listitem", children: _jsx(Row, { label: "Design", on: mode === 'design', onPress: onDesign, "data-slot": "place-design", icon: _jsx(WandSparkles, { size: 16, "aria-hidden": true }) }) })), !anon && opened('studio') ? (_jsx(YStack, { role: "listitem", children: _jsx(Row, { label: "Studio", on: mode === 'studio', onPress: onStudio, "data-slot": "place-studio", icon: _jsx(Clapperboard, { size: 16, "aria-hidden": true }) }) })) : null, anon ? null : (_jsx(YStack, { role: "listitem", children: _jsx(Row, { label: "Tabs", on: mode === 'tabs', onPress: onTabs, "data-slot": "place-tabs", icon: _jsx(SquareTerminal, { size: 16, "aria-hidden": true }) }) })), apps.map((a) => (_jsx(YStack, { role: "listitem", children: _jsx(Row, { label: a.name, on: inside === a.id, onPress: () => go(hosted(a.id)), "data-slot": `place-app-${a.id}`, icon: _jsx(a.icon, { size: 16, "aria-hidden": true }) }) }, a.id))), anon ? null : (_jsx(YStack, { role: "listitem", children: _jsx(DropdownMenu, { placement: "bottom-start", minWidth: 220, trigger: _jsx(Row, { label: t('More'), "data-slot": "place-more", "aria-haspopup": "menu", icon: _jsx(Ellipsis, { size: 16, "aria-hidden": true }) }), items: rest }) }))] }), betasDialog] }));
128
+ return (_jsxs(YStack, { "data-slot": "places", render: "nav", "aria-label": t('Products'), pt: "$2", shrink: 0, children: [_jsxs(YStack, { role: "list", gap: 2, children: [anon ? null : (_jsx(YStack, { role: "listitem", children: _jsx(Row, { label: "Design", on: mode === 'design', onPress: onDesign, "data-slot": "place-design", icon: _jsx(MARKS.design.icon, { size: 16, "aria-hidden": true }) }) })), !anon && opened('studio') ? (_jsx(YStack, { role: "listitem", children: _jsx(Row, { label: "Studio", on: mode === 'studio', onPress: onStudio, "data-slot": "place-studio", icon: _jsx(MARKS.studio.icon, { size: 16, "aria-hidden": true }) }) })) : null, anon ? null : (_jsx(YStack, { role: "listitem", children: _jsx(Row, { label: "Tabs", on: mode === 'tabs', onPress: onTabs, "data-slot": "place-tabs", icon: _jsx(MARKS.tabs.icon, { size: 16, "aria-hidden": true }) }) })), apps.map((a) => (_jsx(YStack, { role: "listitem", children: _jsx(Row, { label: a.name, on: inside === a.id, onPress: () => go(hosted(a.id)), "data-slot": `place-app-${a.id}`, icon: _jsx(a.icon, { size: 16, "aria-hidden": true }) }) }, a.id))), anon ? null : (_jsx(YStack, { role: "listitem", children: _jsx(DropdownMenu, { placement: "bottom-start", minWidth: 220, trigger: _jsx(Row, { label: t('More'), "data-slot": "place-more", "aria-haspopup": "menu", icon: _jsx(Ellipsis, { size: 16, "aria-hidden": true }) }), items: rest }) }))] }), betasDialog] }));
127
129
  return (_jsxs(YStack, { "data-slot": "rail", render: "nav", "aria-label": t('Products'), width: RAIL, flex: 1,
128
130
  // As tall as the window and no taller: its marks scroll inside it (below), never the page.
129
131
  minH: 0,
130
132
  // The first mark stands at the pane's top edge, one head row high (HEAD), the account on the sidebar's foot (Sidebar's `pb`).
131
- pt: (HEAD - MARK) / 2, pb: "$2", gap: 4, shrink: 0, items: "center", $touchable: { pt: (TOUCH_HEAD - TOUCH) / 2 }, children: [toggle ? (_jsx(YStack, { children: _jsx(Toggle, { open: open, onPress: toggle }) })) : null, _jsxs(YStack, { flex: 1, minH: 0, overflowY: "auto", overflowX: "hidden", items: "center", gap: 4, width: "100%", "$platform-web": { scrollbarWidth: 'none' }, children: [_jsx(Mark, { label: t('Chat'), on: mode === 'chat', onPress: onChat, "data-slot": "rail-chat", children: _jsx(MessageSquare, { size: 18, "aria-hidden": true }) }), _jsx(Mark, { label: "Dev", on: mode === 'dev' && !here, onPress: onDev, "data-slot": "rail-dev", children: _jsx(Code2, { size: 18, "aria-hidden": true }) }), anon ? null : (_jsx(Mark, { label: "Design", on: mode === 'design', onPress: onDesign, "data-slot": "rail-design", children: _jsx(WandSparkles, { size: 18, "aria-hidden": true }) })), !anon && opened('studio') ? (_jsx(Mark, { label: "Studio", on: mode === 'studio', onPress: onStudio, "data-slot": "rail-studio", children: _jsx(Clapperboard, { size: 18, "aria-hidden": true }) })) : null, anon ? null : (_jsx(Mark, { label: "Tabs", on: mode === 'tabs', onPress: onTabs, "data-slot": "rail-tabs", children: _jsx(SquareTerminal, { size: 18, "aria-hidden": true }) })), apps.map((a) => (_jsx(Mark, { label: a.name, on: inside === a.id, onPress: () => go(hosted(a.id)), "data-slot": `rail-app-${a.id}`, children: _jsx(a.icon, { size: 18, "aria-hidden": true }) }, a.id))), _jsx(Mark, { label: t('Library'), on: here === 'library', onPress: to(RAISED.library), "data-slot": "rail-library", children: _jsx(Library, { size: 18, "aria-hidden": true }) }), anon ? null : (_jsx(Mark, { label: t('Scheduled tasks'), on: here === 'scheduled', onPress: to(RAISED.scheduled), "data-slot": "rail-scheduled", children: _jsx(Clock, { size: 18, "aria-hidden": true }) })), anon ? null : (_jsx(Mark, { label: t('Customize'), on: here === 'customize', onPress: to(RAISED.customize), "data-slot": "rail-customize", children: _jsx(Puzzle, { size: 18, "aria-hidden": true }) })), anon ? null : (_jsx(Mark, { label: t('Betas'), on: mode === 'beta', onPress: () => go('/beta'), "data-slot": "rail-betas", children: _jsx(FlaskConical, { size: 18, "aria-hidden": true }) })), betasDialog, !anon && rest.length ? (_jsx(DropdownMenu
133
+ pt: (HEAD - MARK) / 2, pb: "$2", gap: 4, shrink: 0, items: "center", $touchable: { pt: (TOUCH_HEAD - TOUCH) / 2 }, children: [toggle ? (_jsx(YStack, { children: _jsx(Toggle, { open: open, onPress: toggle }) })) : null, _jsxs(YStack, { flex: 1, minH: 0, overflowY: "auto", overflowX: "hidden", items: "center", gap: 4, width: "100%", "$platform-web": { scrollbarWidth: 'none' }, children: [_jsx(Mark, { label: t('Chat'), on: mode === 'chat', onPress: onChat, "data-slot": "rail-chat", children: _jsx(MARKS.chat.icon, { size: 18, "aria-hidden": true }) }), _jsx(Mark, { label: "Dev", on: mode === 'dev' && !here, onPress: onDev, "data-slot": "rail-dev", children: _jsx(MARKS.dev.icon, { size: 18, "aria-hidden": true }) }), anon ? null : (_jsx(Mark, { label: "Design", on: mode === 'design', onPress: onDesign, "data-slot": "rail-design", children: _jsx(MARKS.design.icon, { size: 18, "aria-hidden": true }) })), !anon && opened('studio') ? (_jsx(Mark, { label: "Studio", on: mode === 'studio', onPress: onStudio, "data-slot": "rail-studio", children: _jsx(MARKS.studio.icon, { size: 18, "aria-hidden": true }) })) : null, anon ? null : (_jsx(Mark, { label: "Tabs", on: mode === 'tabs', onPress: onTabs, "data-slot": "rail-tabs", children: _jsx(MARKS.tabs.icon, { size: 18, "aria-hidden": true }) })), apps.map((a) => (_jsx(Mark, { label: a.name, on: inside === a.id, onPress: () => go(hosted(a.id)), "data-slot": `rail-app-${a.id}`, children: _jsx(a.icon, { size: 18, "aria-hidden": true }) }, a.id))), _jsx(Mark, { label: t('Library'), on: here === 'library', onPress: to(RAISED.library), "data-slot": "rail-library", children: _jsx(MARKS.library.icon, { size: 18, "aria-hidden": true }) }), anon ? null : (_jsx(Mark, { label: t('Scheduled tasks'), on: here === 'scheduled', onPress: to(RAISED.scheduled), "data-slot": "rail-scheduled", children: _jsx(MARKS.scheduled.icon, { size: 18, "aria-hidden": true }) })), anon ? null : (_jsx(Mark, { label: t('Customize'), on: here === 'customize', onPress: to(RAISED.customize), "data-slot": "rail-customize", children: _jsx(MARKS.customize.icon, { size: 18, "aria-hidden": true }) })), anon ? null : (_jsx(Mark, { label: t('Betas'), on: mode === 'beta', onPress: () => go('/beta'), "data-slot": "rail-betas", children: _jsx(FlaskConical, { size: 18, "aria-hidden": true }) })), betasDialog, !anon && rest.length ? (_jsx(DropdownMenu
132
134
  // Toward the content: right of the rail, left of it right to left.
133
135
  , {
134
136
  // Toward the content: right of the rail, left of it right to left.
package/dist/Search.js CHANGED
@@ -30,9 +30,9 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
30
30
  import { useEffect, useMemo, useState } from 'react';
31
31
  import { isolate, english } from '@hanzo/i18n';
32
32
  import { useI18n } from '@hanzo/i18n/react';
33
- import { BookOpen, Bot, Building2, CircleHelp, Clock, Code2, FlaskConical, FolderGit2, Gift, Keyboard, LogOut, MessageCircle, MessageSquare, Plug, Settings, Sparkles, SquarePen, SquareTerminal, SunMoon, Users, WandSparkles, } from 'lucide-react';
33
+ import { BookOpen, Bot, Building2, CircleHelp, FlaskConical, FolderGit2, Gift, Keyboard, LogOut, MessageCircle, Plug, Settings, Sparkles, SunMoon, Users, } from 'lucide-react';
34
34
  import { useAi } from '@hanzo/ai/react';
35
- import { library, nav, NEW, path as written, sections, tabs, useSessions } from '@hanzo/build';
35
+ import { library, MARKS, nav, NEW, path as written, sections, tabs, useSessions } from '@hanzo/build';
36
36
  import { nav as made } from '@hanzo/studio';
37
37
  import { Dialog, DialogContent, DialogTitle } from '@hanzo/ui';
38
38
  import { CommandMenu } from '@hanzo/ui/product/CommandMenu';
@@ -74,12 +74,12 @@ export function places(host, go, t = english) {
74
74
  const anon = host?.person === null;
75
75
  const builder = (p) => go(app(p));
76
76
  const top = [
77
- { id: 'chat', label: t('Chat'), icon: _jsx(MessageSquare, { ...ICON }), run: () => go(talk()) },
78
- { id: 'dev', label: 'Dev', icon: _jsx(Code2, { ...ICON }), run: () => go(app('')) },
77
+ { id: 'chat', label: t('Chat'), icon: _jsx(MARKS.chat.icon, { ...ICON }), run: () => go(talk()) },
78
+ { id: 'dev', label: 'Dev', icon: _jsx(MARKS.dev.icon, { ...ICON }), run: () => go(app('')) },
79
79
  ...(!anon
80
80
  ? [
81
- { id: 'studio', label: 'Studio', icon: _jsx(WandSparkles, { ...ICON }), run: () => go(studio('')) },
82
- { id: 'tabs', label: 'Tabs', icon: _jsx(SquareTerminal, { ...ICON }), run: () => go(TERMINALS) },
81
+ { id: 'studio', label: 'Studio', icon: _jsx(MARKS.studio.icon, { ...ICON }), run: () => go(studio('')) },
82
+ { id: 'tabs', label: 'Tabs', icon: _jsx(MARKS.tabs.icon, { ...ICON }), run: () => go(TERMINALS) },
83
83
  ...(host ? [{ id: 'team', label: 'Team', icon: _jsx(Users, { ...ICON }), keywords: ['workspace'], run: () => out(WORKSPACE) }] : []),
84
84
  ...(host ? rows(nav(host, builder, t).map((g) => ({ links: g.links.filter((l) => l.id !== NEW) })), '', 'dev') : []),
85
85
  ]
@@ -138,12 +138,16 @@ function tune(go) {
138
138
  /** The palette's actions, named through `t`; a host that cannot do one (no theme to change, no org to pick) is not offered it. */
139
139
  export function actions(host, go, signOut, keys, t = english) {
140
140
  const anon = host?.person === null;
141
- const upload = host && !anon ? library(host, (p) => go(app(p)), t)[0]?.links.find((l) => l.id === 'upload') : undefined;
141
+ // The Library's own acts (@hanzo/build `library`): Make something new and Upload, where the build has them.
142
+ const acts = host && !anon ? (library(host, (p) => go(app(p)), t)[0]?.links ?? []) : [];
143
+ const make = acts.find((l) => l.id === 'make');
144
+ const upload = acts.find((l) => l.id === 'upload');
142
145
  const list = [
143
- { id: 'new-chat', label: t('New chat'), icon: _jsx(SquarePen, { ...ICON }), run: () => (empty(), go(talk())) },
144
- { id: 'new-task', label: t('New Dev task'), icon: _jsx(Code2, { ...ICON }), keywords: ['run'], run: () => go(app('')) },
145
- !anon && { id: 'new-creation', label: t('New Studio creation'), icon: _jsx(WandSparkles, { ...ICON }), keywords: ['image', 'video'], run: () => go(studio('')) },
146
- !anon && { id: 'new-scheduled', label: t('New scheduled task'), icon: _jsx(Clock, { ...ICON }), keywords: ['automation'], run: () => go(app(written({ kind: 'automation', id: 'new' }))) },
146
+ { id: 'new-chat', label: t('New chat'), icon: _jsx(MARKS.chat.make, { ...ICON }), run: () => (empty(), go(talk())) },
147
+ { id: 'new-task', label: t('New Dev task'), icon: _jsx(MARKS.dev.make, { ...ICON }), keywords: ['run'], run: () => go(app('')) },
148
+ !anon && { id: 'new-creation', label: t('New Studio creation'), icon: _jsx(MARKS.studio.make, { ...ICON }), keywords: ['image', 'video'], run: () => go(studio('')) },
149
+ !anon && { id: 'new-scheduled', label: t('New scheduled task'), icon: _jsx(MARKS.scheduled.icon, { ...ICON }), keywords: ['automation'], run: () => go(app(written({ kind: 'automation', id: 'new' }))) },
150
+ !!make && { id: 'make', label: t('Make something new'), icon: make.icon, keywords: ['template', 'gallery', 'library'], run: () => make.onPress?.() },
147
151
  !!upload && { id: 'upload', label: t('Upload'), icon: upload.icon, keywords: ['file', 'library'], run: () => upload.onPress?.() },
148
152
  { id: 'model', label: t('Switch model'), icon: _jsx(Sparkles, { ...ICON }), keywords: ['model'], run: () => tune(go) },
149
153
  !!host?.chooseTheme && {
@@ -238,7 +242,7 @@ export function Search({ onClose, go, actions: frame = [], mode = 'chat', host,
238
242
  label: tidy(s.title, 80, t('Untitled run')),
239
243
  at: s.updatedAt || s.createdAt,
240
244
  keywords: [s.status ?? ''],
241
- icon: _jsx(Code2, { ...ICON }),
245
+ icon: _jsx(MARKS.dev.icon, { ...ICON }),
242
246
  run: () => go(app(s.id)),
243
247
  }));
244
248
  const mine = mode === 'dev'
@@ -101,7 +101,7 @@ function Model() {
101
101
  ].map((opt) => {
102
102
  const active = (chatPrefs.approvalMode || 'auto') === opt.id;
103
103
  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));
104
- }) })] }), _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
+ }) })] }), _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 paid from your pre-paid balance on any plan. First-party models (Enso, Zen, Kai) are covered by your plan.') })] }), _jsx(Button, { size: "sm", variant: chatPrefs.allowThirdPartyModels ? 'default' : 'outline', onClick: () => setChatPrefs({ allowThirdPartyModels: !chatPrefs.allowThirdPartyModels, thirdPartyChosen: true }), 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] })] }));
105
105
  }
106
106
  /**
107
107
  * WHAT THE GATEWAY SERVES, read from the same `/v1/models` the apps read.
package/dist/Sidebar.d.ts CHANGED
@@ -2,6 +2,11 @@ import { type Host } from '@hanzo/build';
2
2
  import { type RailLink } from '@hanzo/ui/chat';
3
3
  import { type ReactNode } from 'react';
4
4
  import { type Place } from './lib/host.js';
5
+ export declare function dispatchTabsAction(detail: {
6
+ kind: string;
7
+ id?: string;
8
+ machine?: string;
9
+ }): void;
5
10
  export declare function Sidebar({ host, mode, thread, go, onShut, onSeek, onBack, drawer, rail, foot, places, }: {
6
11
  host: Host;
7
12
  mode: Place['mode'];
package/dist/Sidebar.js CHANGED
@@ -29,8 +29,8 @@ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-run
29
29
  import { locales, phrase } from '@hanzo/i18n';
30
30
  import { useI18n } from '@hanzo/i18n/react';
31
31
  import { Text, XStack, YStack } from '@hanzo/gui';
32
- import { ArrowLeft, ArrowRight, Bell, ChevronDown, ChevronUp, Cloud, Globe, Image as ImageMark, Monitor, Puzzle, Search, Sparkles, SquarePen, SquareTerminal } from 'lucide-react';
33
- import { DOTS, Gutter, library, NEW, own, tabs, useLanguage, useScheduled, useSessions } from '@hanzo/build';
32
+ import { ArrowLeft, ArrowRight, Bell, ChevronDown, ChevronUp, Cloud, Globe, Image as ImageMark, Monitor, Puzzle, Search, Sparkles } from 'lucide-react';
33
+ import { DOTS, Gutter, library, MARKS, NEW, own, tabs, useLanguage, useScheduled, useSessions } from '@hanzo/build';
34
34
  import { tidy } from './lib/title.js';
35
35
  import { Button, DropdownMenu, Switch } from '@hanzo/ui';
36
36
  import { Sidebar as Base, SidebarIconButton, SidebarItem, StatusDot } from '@hanzo/ui/chat';
@@ -76,7 +76,7 @@ const RECENT = 6;
76
76
  const TITLE = { library: phrase('Library'), scheduled: phrase('Scheduled tasks'), customize: phrase('Customize') };
77
77
  /** A header mark: a 16px glyph in a 32px target, a thumb's 44 on a touch screen. */
78
78
  const HEAD = { width: 32, height: 32, rounded: '$3', $touchable: { width: 44, height: 44 } };
79
- function dispatchTabsAction(detail) {
79
+ export function dispatchTabsAction(detail) {
80
80
  if (typeof window === 'undefined')
81
81
  return;
82
82
  window.dispatchEvent(new CustomEvent('hanzo:tabs-action', { detail }));
@@ -139,7 +139,7 @@ function useTabsGroups(t, active) {
139
139
  {
140
140
  id: 'new-terminal',
141
141
  label: t('New terminal'),
142
- icon: _jsx(SquareTerminal, { size: 16, "aria-hidden": true }),
142
+ icon: _jsx(MARKS.tabs.make, { size: 16, "aria-hidden": true }),
143
143
  onPress: () => dispatchTabsAction({ kind: 'shell' }),
144
144
  },
145
145
  {
@@ -207,7 +207,7 @@ function useTabsGroups(t, active) {
207
207
  return {
208
208
  id: `tab-${id}`,
209
209
  label: machine ? `${machine}${name ? ` (${name})` : ''}` : t('Terminal'),
210
- icon: _jsx(SquareTerminal, { size: 16, "aria-hidden": true }),
210
+ icon: _jsx(MARKS.tabs.icon, { size: 16, "aria-hidden": true }),
211
211
  onPress: () => dispatchTabsAction({ kind: 'focus', id }),
212
212
  };
213
213
  });
@@ -275,6 +275,8 @@ export function Sidebar({ host, mode, thread, go, onShut, onSeek, onBack, drawer
275
275
  const span = useSpan(SPAN, WIDTH, FLOOR, CEIL);
276
276
  const dev = (p) => host.go(p);
277
277
  const at = mode === 'dev' ? raised(host.path) : null;
278
+ // A New row that brings no icon of its own wears its mode's `make` mark.
279
+ const Make = mode === 'chat' || mode === 'dev' || mode === 'tabs' || mode === 'studio' ? MARKS[mode].make : MARKS.chat.make;
278
280
  // Each place the rail holds lists its own rows: Library its kinds and Upload, Scheduled tasks its tasks and New task.
279
281
  const scheduled = useScheduled(host, dev, at === 'scheduled');
280
282
  const tabsGroups = useTabsGroups(t, mode === 'tabs');
@@ -325,7 +327,7 @@ export function Sidebar({ host, mode, thread, go, onShut, onSeek, onBack, drawer
325
327
  borderColor: 'var(--border-strong)',
326
328
  bg: 'var(--pane-fill)',
327
329
  }
328
- : HEAD), children: _jsx(Search, { size: drawer ? 18 : 16, "aria-hidden": true }) }))] })), mode === 'chat' ? (_jsxs(YStack, { role: "list", gap: 2, shrink: 0, pt: drawer ? 0 : 4, children: [_jsx(YStack, { role: "listitem", self: "flex-start", children: _jsx(SidebarItem, { "data-slot": "app-new", ...COMPACT_ROW, active: !thread && !anonSettingsOpen && !anonThreadTitle, bg: "transparent", hoverStyle: { bg: '$hover' }, icon: _jsx(XStack, { width: 20, height: 20, items: "center", justify: "center", shrink: 0, children: _jsx(SquarePen, { size: 16, "aria-hidden": true }) }), onPress: create, ...keys(create), children: _jsx(Text, { fontSize: "$3", color: "$ink", children: t('New chat') }) }) }), anon ? (_jsxs(_Fragment, { children: [_jsx(YStack, { role: "listitem", self: "flex-start", children: _jsx(SidebarItem, { "data-slot": "app-images", ...COMPACT_ROW, bg: "transparent", hoverStyle: { bg: '$hover' }, icon: _jsx(XStack, { width: 20, height: 20, items: "center", justify: "center", shrink: 0, children: _jsx(ImageMark, { size: 16, "aria-hidden": true }) }), onPress: () => {
330
+ : HEAD), children: _jsx(Search, { size: drawer ? 18 : 16, "aria-hidden": true }) }))] })), mode === 'chat' ? (_jsxs(YStack, { role: "list", gap: 2, shrink: 0, pt: drawer ? 0 : 4, children: [_jsx(YStack, { role: "listitem", self: "flex-start", children: _jsx(SidebarItem, { "data-slot": "app-new", ...COMPACT_ROW, active: !thread && !anonSettingsOpen && !anonThreadTitle, bg: "transparent", hoverStyle: { bg: '$hover' }, icon: _jsx(XStack, { width: 20, height: 20, items: "center", justify: "center", shrink: 0, children: _jsx(MARKS.chat.make, { size: 16, "aria-hidden": true }) }), onPress: create, ...keys(create), children: _jsx(Text, { fontSize: "$3", color: "$ink", children: t('New chat') }) }) }), anon ? (_jsxs(_Fragment, { children: [_jsx(YStack, { role: "listitem", self: "flex-start", children: _jsx(SidebarItem, { "data-slot": "app-images", ...COMPACT_ROW, bg: "transparent", hoverStyle: { bg: '$hover' }, icon: _jsx(XStack, { width: 20, height: 20, items: "center", justify: "center", shrink: 0, children: _jsx(ImageMark, { size: 16, "aria-hidden": true }) }), onPress: () => {
329
331
  create();
330
332
  if (typeof window !== 'undefined') {
331
333
  window.dispatchEvent(new CustomEvent('hanzo:anon-prompt', { detail: { text: t('Create an image of ') } }));
@@ -345,7 +347,7 @@ export function Sidebar({ host, mode, thread, go, onShut, onSeek, onBack, drawer
345
347
  if (typeof window !== 'undefined') {
346
348
  window.dispatchEvent(new CustomEvent('hanzo:anon-plugins'));
347
349
  }
348
- }), children: _jsx(Text, { fontSize: "$3", color: "$ink", children: t('Plugins') }) }) })] })) : null] })) : mode === 'beta' && !drawer ? null : (_jsx(YStack, { "data-slot": "app-places", shrink: 0, pt: drawer ? 0 : 4, children: groups.map((g, i) => (_jsxs(YStack, { pt: i ? '$2' : 0, children: [i && g.label ? (_jsx(Text, { id: `${uid}-${g.id}`, paddingInlineStart: "$2", pb: 2, fontSize: "$3", color: "$soft", children: g.label })) : null, _jsx(YStack, { role: "list", "aria-labelledby": i && g.label ? `${uid}-${g.id}` : undefined, "aria-label": i && g.label ? undefined : g.label || (at ? t(TITLE[at]) : g.id), gap: 1, children: g.links.map((link) => (_jsx(YStack, { role: "listitem", self: "flex-start", children: _jsx(SidebarItem, { ...COMPACT_ROW, "data-place-id": link.id, ...(link.id === NEW ? { 'data-slot': 'app-new' } : {}), active: link.active, icon: link.id === NEW ? (_jsx(XStack, { width: 20, height: 20, items: "center", justify: "center", shrink: 0, children: _jsx(SquarePen, { size: 16, "aria-hidden": true }) })) : link.icon ? (_jsx(XStack, { width: 20, height: 20, items: "center", justify: "center", shrink: 0, children: link.icon })) : null, onPress: link.onPress, ...keys(() => link.onPress?.()), children: _jsx(Text, { fontSize: "$3", color: link.active ? '$ink' : '$quiet', children: link.label }) }) }, link.id))) })] }, g.id))) })), rail, mode === 'beta' && !drawer ? (_jsx(YStack, { "data-slot": "beta-sidebar-slot", flex: 1, minH: 0, pt: 4 })) : anon && mode === 'chat' && anonThreadTitle ? (_jsxs(YStack, { "data-slot": "recents", flex: 1, minH: 0, pt: "$3", children: [_jsx(Text, { paddingInlineStart: "$2", pb: "$1", fontSize: "$3", color: "$soft", children: t('Recents') }), _jsx(YStack, { role: "list", gap: 1, children: _jsx(YStack, { role: "listitem", children: _jsx(SidebarItem, { ...ROW, active: !anonSettingsOpen, onPress: () => setAnonSettings(false), children: _jsx(Text, { fontSize: "$3", color: "$ink", numberOfLines: 1, children: anonThreadTitle }) }) }) })] })) : mode === 'hosted' || mode === 'beta' || anon || at ? (_jsx(YStack, { flex: 1, minH: 0 })) : (_jsx(Recents, { host: host, mode: mode === 'dev' ? 'dev' : 'chat', thread: thread, onOpen: open, onNew: create })), anon ? (_jsx(YStack, { "data-slot": "anon-foot", gap: "$2", pt: "$2", shrink: 0, z: 10, children: _jsxs(YStack, { "data-slot": "anon-tailored", gap: "$2", pt: "$1", pb: "$1", px: "$2", children: [_jsxs(XStack, { render: "button", "aria-expanded": tailoredOpen, "aria-label": t('Get responses tailored to you'), items: "center", justify: "space-between", gap: "$1.5", cursor: "pointer", onPress: () => setTailoredOpen((v) => !v), hoverStyle: { opacity: 0.85 }, children: [_jsx(Text, { fontSize: 13, lineHeight: 18, fontWeight: "700", color: "$ink", numberOfLines: 1, flex: 1, children: t('Get responses tailored to you') }), tailoredOpen ? (_jsx(ChevronDown, { size: 14, "aria-hidden": true, color: "var(--soft, var(--muted-foreground))" })) : (_jsx(ChevronUp, { size: 14, "aria-hidden": true, color: "var(--soft, var(--muted-foreground))" }))] }), tailoredOpen ? (_jsx(Text, { fontSize: 12, lineHeight: 17, color: "$soft", children: t('Log in to get answers based on saved chats, plus create images and upload files.') })) : null, _jsxs(XStack, { gap: "$2", pt: "$0.5", children: [_jsx(Button, { size: "sm", variant: "outline", flex: 1, rounded: 9999, "data-slot": "column-login", onPress: () => {
350
+ }), children: _jsx(Text, { fontSize: "$3", color: "$ink", children: t('Plugins') }) }) })] })) : null] })) : mode === 'beta' && !drawer ? null : (_jsx(YStack, { "data-slot": "app-places", shrink: 0, pt: drawer ? 0 : 4, children: groups.map((g, i) => (_jsxs(YStack, { pt: i ? '$2' : 0, children: [i && g.label ? (_jsx(Text, { id: `${uid}-${g.id}`, paddingInlineStart: "$2", pb: 2, fontSize: "$3", color: "$soft", children: g.label })) : null, _jsx(YStack, { role: "list", "aria-labelledby": i && g.label ? `${uid}-${g.id}` : undefined, "aria-label": i && g.label ? undefined : g.label || (at ? t(TITLE[at]) : g.id), gap: 1, children: g.links.map((link) => (_jsx(YStack, { role: "listitem", self: "flex-start", children: _jsx(SidebarItem, { ...COMPACT_ROW, "data-place-id": link.id, ...(link.id === NEW ? { 'data-slot': 'app-new' } : {}), active: link.active, icon: link.icon || link.id === NEW ? (_jsx(XStack, { width: 20, height: 20, items: "center", justify: "center", shrink: 0, children: link.icon ?? _jsx(Make, { size: 16, "aria-hidden": true }) })) : null, onPress: link.onPress, ...keys(() => link.onPress?.()), children: _jsx(Text, { fontSize: "$3", color: link.active ? '$ink' : '$quiet', children: link.label }) }) }, link.id))) })] }, g.id))) })), rail, mode === 'beta' && !drawer ? (_jsx(YStack, { "data-slot": "beta-sidebar-slot", flex: 1, minH: 0, pt: 4 })) : anon && mode === 'chat' && anonThreadTitle ? (_jsxs(YStack, { "data-slot": "recents", flex: 1, minH: 0, pt: "$3", children: [_jsx(Text, { paddingInlineStart: "$2", pb: "$1", fontSize: "$3", color: "$soft", children: t('Recents') }), _jsx(YStack, { role: "list", gap: 1, children: _jsx(YStack, { role: "listitem", children: _jsx(SidebarItem, { ...ROW, active: !anonSettingsOpen, onPress: () => setAnonSettings(false), children: _jsx(Text, { fontSize: "$3", color: "$ink", numberOfLines: 1, children: anonThreadTitle }) }) }) })] })) : mode === 'hosted' || mode === 'beta' || anon || at ? (_jsx(YStack, { flex: 1, minH: 0 })) : (_jsx(Recents, { host: host, mode: mode === 'dev' ? 'dev' : 'chat', thread: thread, onOpen: open, onNew: create })), anon ? (_jsx(YStack, { "data-slot": "anon-foot", gap: "$2", pt: "$2", shrink: 0, z: 10, children: _jsxs(YStack, { "data-slot": "anon-tailored", gap: "$2", pt: "$1", pb: "$1", px: "$2", children: [_jsxs(XStack, { render: "button", "aria-expanded": tailoredOpen, "aria-label": t('Get responses tailored to you'), items: "center", justify: "space-between", gap: "$1.5", cursor: "pointer", onPress: () => setTailoredOpen((v) => !v), hoverStyle: { opacity: 0.85 }, children: [_jsx(Text, { fontSize: 13, lineHeight: 18, fontWeight: "700", color: "$ink", numberOfLines: 1, flex: 1, children: t('Get responses tailored to you') }), tailoredOpen ? (_jsx(ChevronDown, { size: 14, "aria-hidden": true, color: "var(--soft, var(--muted-foreground))" })) : (_jsx(ChevronUp, { size: 14, "aria-hidden": true, color: "var(--soft, var(--muted-foreground))" }))] }), tailoredOpen ? (_jsx(Text, { fontSize: 12, lineHeight: 17, color: "$soft", children: t('Log in to get answers based on saved chats, plus create images and upload files.') })) : null, _jsxs(XStack, { gap: "$2", pt: "$0.5", children: [_jsx(Button, { size: "sm", variant: "outline", flex: 1, rounded: 9999, "data-slot": "column-login", onPress: () => {
349
351
  if (typeof window !== 'undefined')
350
352
  window.location.assign('/login?next=%2Fchat');
351
353
  }, children: t('Log in') }), _jsx(Button, { size: "sm", flex: 1, rounded: 9999, "data-slot": "column-signup", onPress: () => {
package/dist/dev.js CHANGED
@@ -41,7 +41,7 @@ import { api } from './lib/api.js';
41
41
  import { CAST, personas } from './agents.js';
42
42
  import { app, place, settings, visit } from './lib/host.js';
43
43
  import { link } from './lib/tags.js';
44
- import { payUrl } from './lib/pay.js';
44
+ import { payUrl, topUp } from './lib/pay.js';
45
45
  /** Where the builder links out: every one of them an address of this site. */
46
46
  const LINKS = {
47
47
  github: app('-/sync'),
@@ -117,6 +117,7 @@ export function useDevHost() {
117
117
  admin: administers(bearer(), scoped),
118
118
  path: here,
119
119
  go: (to, how) => (isPlans(to) ? leave('here') : visit(router, app(to), how?.replace)),
120
+ topUp: signedIn ? topUp : undefined,
120
121
  links: LINKS,
121
122
  // The sidebar lists Settings' sections and Customize's tabs (Sidebar.tsx), and Customize › Agents offers the cast.
122
123
  sections: true,
@@ -4,6 +4,8 @@ export type ApprovalMode = 'auto' | 'manual';
4
4
  export declare const DEFAULT_EFFORT: Effort;
5
5
  export interface ChatPreferences {
6
6
  allowThirdPartyModels: boolean;
7
+ /** The person turned third-party models on or off themselves; until then they are on. */
8
+ thirdPartyChosen?: boolean;
7
9
  effort: Effort;
8
10
  approvalMode: ApprovalMode;
9
11
  showLanguage?: boolean;
@@ -2,7 +2,7 @@
2
2
  * What Chat does, kept in this browser. What the composer DRAWS (the key that
3
3
  * sends, the chips, the model selector, the mode) is not here: it is one setting
4
4
  * for every composer (@hanzo/appearance `composing`, Settings → Appearance).
5
- * - allowThirdPartyModels: whether 3rd-party models (OpenAI, Anthropic, etc.) are enabled via pre-paid credit (default: false)
5
+ * - allowThirdPartyModels: whether 3rd-party models (OpenAI, Anthropic, etc.) are listed. They are paid from the pre-paid balance on any plan, so they are on until the person turns them off (`thirdPartyChosen` says they did)
6
6
  * - approvalMode: whether tools/actions run automatically ('auto') or ask for confirmation first ('manual') (default: 'auto')
7
7
  * - effort: the reasoning effort a message asks for (default: auto, the router decides)
8
8
  * - showLanguage: dictation listens in the person's own language rather than Auto
@@ -16,7 +16,7 @@ const AUTONOMY_KEY = 'hanzo.agent.autonomy';
16
16
  const EVENT_NAME = 'hanzo:chat:preferences';
17
17
  const EFFORT_SCHEMA_VERSION = 4;
18
18
  const DEFAULT_PREFERENCES = {
19
- allowThirdPartyModels: false,
19
+ allowThirdPartyModels: true,
20
20
  effort: DEFAULT_EFFORT,
21
21
  approvalMode: 'auto',
22
22
  showLanguage: false,
@@ -51,7 +51,8 @@ export function getChatPreferences() {
51
51
  const parsed = JSON.parse(raw);
52
52
  const migratedEffort = parsed.effortVersion === EFFORT_SCHEMA_VERSION ? validEffort(parsed.effort) : DEFAULT_EFFORT;
53
53
  return {
54
- allowThirdPartyModels: Boolean(parsed.allowThirdPartyModels),
54
+ allowThirdPartyModels: parsed.thirdPartyChosen ? Boolean(parsed.allowThirdPartyModels) : true,
55
+ ...(parsed.thirdPartyChosen ? { thirdPartyChosen: true } : {}),
55
56
  effort: migratedEffort,
56
57
  approvalMode: validApprovalMode(parsed.approvalMode, autonomy),
57
58
  showLanguage: Boolean(parsed.showLanguage),
package/dist/lib/pay.d.ts CHANGED
@@ -48,6 +48,14 @@ export declare function checkoutUrl(id?: string, back?: string): string;
48
48
  export declare function payPage(path?: string): string;
49
49
  /** The pay address with its query, written in one place for both callers above. */
50
50
  export declare function payUrl(path: string, query: Record<string, string | null | undefined>): string;
51
+ /**
52
+ * The plain top-up (no plan): pay's amount page for the card, for the organization in
53
+ * use, coming back to this page with the model it was for (`?model=`) so the chat
54
+ * resumes on it. Another maker's models are paid from this balance on any plan.
55
+ */
56
+ export declare function topUpUrl(model?: string): string;
57
+ /** Leaves for the top-up. */
58
+ export declare function topUp(model?: string): void;
51
59
  export declare const dollars: (n: number) => string;
52
60
  /**
53
61
  * Money as a sentence says it. English stays `$20` or `$16.67`. Any other
package/dist/lib/pay.js CHANGED
@@ -66,6 +66,21 @@ export function payUrl(path, query) {
66
66
  return at;
67
67
  return `${at}${path}${s ? `?${s}` : ""}`;
68
68
  }
69
+ /**
70
+ * The plain top-up (no plan): pay's amount page for the card, for the organization in
71
+ * use, coming back to this page with the model it was for (`?model=`) so the chat
72
+ * resumes on it. Another maker's models are paid from this balance on any plan.
73
+ */
74
+ export function topUpUrl(model) {
75
+ const back = new URL(window.location.href);
76
+ if (model)
77
+ back.searchParams.set("model", model);
78
+ return payUrl("/amount/card", { org: org(), returnUrl: back.toString() });
79
+ }
80
+ /** Leaves for the top-up. */
81
+ export function topUp(model) {
82
+ window.location.assign(topUpUrl(model));
83
+ }
69
84
  export const dollars = (n) => `$${n.toFixed(2)}`;
70
85
  /**
71
86
  * Money as a sentence says it. English stays `$20` or `$16.67`. Any other
@@ -1,5 +1,9 @@
1
1
  import { IAM } from '@hanzo/iam';
2
- /** Whether the page in front of us is on an origin that answers IAM itself (`answers` in host.ts). */
2
+ /**
3
+ * Whether the page in front of us is on an origin that answers IAM itself: one of
4
+ * the Hanzo hosts (`answers` in host.ts) or one the host states with
5
+ * `configure({ answers })` (where.ts).
6
+ */
3
7
  export declare const here: () => boolean;
4
8
  /** The IAM client for this page; the token exchange at the callback shares its PKCE store. */
5
9
  export declare function useClient(): IAM;
@@ -13,8 +13,13 @@ import { useIam } from '@hanzo/iam/react';
13
13
  import { useSignOut as useUiSignOut } from '@hanzo/ui/auth';
14
14
  import { track } from './tags.js';
15
15
  import { answers } from './host.js';
16
- /** Whether the page in front of us is on an origin that answers IAM itself (`answers` in host.ts). */
17
- export const here = () => typeof window !== 'undefined' && answers(window.location.hostname);
16
+ import { where } from '../where.js';
17
+ /**
18
+ * Whether the page in front of us is on an origin that answers IAM itself: one of
19
+ * the Hanzo hosts (`answers` in host.ts) or one the host states with
20
+ * `configure({ answers })` (where.ts).
21
+ */
22
+ export const here = () => typeof window !== 'undefined' && (answers(window.location.hostname) || where().answers?.(window.location.hostname) === true);
18
23
  /** The IAM client for this page; the token exchange at the callback shares its PKCE store. */
19
24
  export function useClient() {
20
25
  const { config } = useIam();
package/dist/where.d.ts CHANGED
@@ -33,6 +33,14 @@ export interface Addresses {
33
33
  brand?: string;
34
34
  /** The publishable key anonymous calls carry. */
35
35
  key?: string;
36
+ /**
37
+ * Whether a host answers IAM's credential, account-list and sign-out calls on
38
+ * its own origin (lib/signout `here`), in addition to the Hanzo hosts the apps
39
+ * already know (lib/host `answers`). A site that signs people in on its own page
40
+ * and keeps IAM's session cookie there, as hanzo.market does, states it here and
41
+ * gets the account chooser and the account menu with no other change.
42
+ */
43
+ answers?: (hostname: string) => boolean;
36
44
  /**
37
45
  * Where the IAM session is kept when it is not this page's `localStorage`:
38
46
  * the `storage` the host hands its IamProvider (Hanzo Desktop's keychain).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hanzo/app",
3
- "version": "0.3.51",
3
+ "version": "0.3.53",
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",
@@ -51,7 +51,7 @@
51
51
  "peerDependencies": {
52
52
  "@hanzo/ai": ">=0.7.0",
53
53
  "@hanzo/appearance": ">=0.2.13",
54
- "@hanzo/build": ">=0.2.90",
54
+ "@hanzo/build": ">=0.2.120",
55
55
  "@hanzo/composer": ">=0.2.0",
56
56
  "@hanzo/design": ">=0.5.39",
57
57
  "@hanzo/event": ">=0.3.56",
@@ -61,7 +61,7 @@
61
61
  "@hanzo/logo": ">=1.0.26",
62
62
  "@hanzo/studio": ">=0.1.0",
63
63
  "@hanzo/tabs": ">=0.1.8",
64
- "@hanzo/ui": ">=8.29.40",
64
+ "@hanzo/ui": ">=8.30.4",
65
65
  "@hanzo/usage": ">=0.1.18",
66
66
  "@hanzo/voice": ">=0.1.16",
67
67
  "@hanzogui/shell": "^8.3.20",
@@ -72,7 +72,7 @@
72
72
  "devDependencies": {
73
73
  "@hanzo/ai": "0.7.0",
74
74
  "@hanzo/appearance": "0.2.14",
75
- "@hanzo/build": "https://github.com/hanzoai/build/releases/download/v0.2.117/hanzo-build-0.2.117.tgz",
75
+ "@hanzo/build": "0.2.120",
76
76
  "@hanzo/composer": "0.2.0",
77
77
  "@hanzo/design": "0.5.39",
78
78
  "@hanzo/event": "0.3.56",
@@ -82,7 +82,7 @@
82
82
  "@hanzo/logo": "1.0.26",
83
83
  "@hanzo/studio": "0.1.0",
84
84
  "@hanzo/tabs": "github:hanzo-inc/tabs",
85
- "@hanzo/ui": "https://github.com/hanzoai/ui/releases/download/v8.30.2/hanzo-ui-8.30.2.tgz",
85
+ "@hanzo/ui": "8.30.4",
86
86
  "@hanzo/usage": "0.1.18",
87
87
  "@hanzo/voice": "0.1.19",
88
88
  "@hanzogui/config": "8.3.5",