@hanzo/app 0.3.52 → 0.3.54

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) => {
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';
@@ -29,6 +30,8 @@ import { useAi } from './lib/ai.js';
29
30
  import { useHydrated } from './lib/hydrated.js';
30
31
  import { useOpen } from './open.js';
31
32
  import { plainly, say } from './failure.js';
33
+ import { failed } from './failed.js';
34
+ import { watch } from './watch.js';
32
35
  import { Directory } from './Directory.js';
33
36
  import { Bar } from './progress.js';
34
37
  import { Card, Go, INK, Quiet, Row, SOFT, CHOSEN } from './card.js';
@@ -236,7 +239,7 @@ function Chats() {
236
239
  const { t } = useI18n();
237
240
  const { threads, loading } = useThreads();
238
241
  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))) })) }));
242
+ 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
243
  }
241
244
  /**
242
245
  * What is going, then what to do next.
@@ -248,7 +251,7 @@ function Chats() {
248
251
  */
249
252
  function Next({ onConnect }) {
250
253
  const { t } = useI18n();
251
- const { sessions } = useSessions({ limit: 100 });
254
+ const { sessions, error: unread, reload } = useSessions({ limit: 100 });
252
255
  const { agents } = useAgents();
253
256
  const { held } = useProjects();
254
257
  const { held: connected } = useApps();
@@ -257,18 +260,25 @@ function Next({ onConnect }) {
257
260
  const running = useMemo(() => safeSessions.filter((s) => s && s.status === 'running'), [safeSessions]);
258
261
  const rows = useMemo(() => {
259
262
  const out = [];
260
- const failed = safeSessions.filter((s) => s && s.status === 'error').length;
261
- if (failed)
262
- out.push({ key: 'failed', say: t('{n} failed', { n: failed }), href: '/work' });
263
+ // The past 7 days' failures, a tree counted once (./failed): counting every
264
+ // error in the last 100 runs kept old failures on the card indefinitely. The
265
+ // row opens the newest of them on the Work board (./watch), not the board
266
+ // alone. A read that failed is not "nothing failed": it says so, and
267
+ // pressing the row reads the runs again.
268
+ const failing = failed(safeSessions);
269
+ if (unread)
270
+ out.push({ key: 'failed', say: say(unread, t('your runs'), 'read', t), press: reload });
271
+ else if (failing.length)
272
+ out.push({ key: 'failed', say: t('{n} failed in the past 7 days', { n: failing.length }), href: watch(failing[0].id) });
263
273
  if (safeAgents.length === 0)
264
274
  out.push({ key: 'agent', say: t('Hire your first agent'), href: '/work' });
265
275
  if (held?.length === 0)
266
276
  out.push({ key: 'ship', say: t('Ship your first project'), href: dev() });
267
277
  if (connected && Array.isArray(connected) && !connected.some((a) => a?.connected))
268
- out.push({ key: 'connect', say: t('Connect an app'), press: true });
278
+ out.push({ key: 'connect', say: t('Connect an app'), press: onConnect });
269
279
  return out;
270
- }, [safeSessions, safeAgents, held, connected, t]);
271
- return (_jsxs(Card, { kind: "next", icon: _jsx(Bot, { size: 14, "aria-hidden": true }), title: t('Next'), children: [running.length ? (_jsx(YStack, { gap: "$2", children: running.slice(0, 2).map((s) => (_jsxs(YStack, { gap: "$1", children: [_jsx(Row, { href: "/work", children: s.title || s.agent || t('Run') }), _jsx(Bar, { run: s, label: false })] }, s.id))) })) : null, rows.length === 0 && running.length === 0 ? (_jsx(Quiet, { children: t('Nothing needs you.') })) : (_jsx(YStack, { gap: "$1", children: rows.slice(0, 3).map((r) => (_jsx(Row, { href: r.href, onPress: r.press ? onConnect : undefined, children: r.say }, r.key))) }))] }));
280
+ }, [safeSessions, unread, reload, safeAgents, held, connected, onConnect, t]);
281
+ return (_jsxs(Card, { kind: "next", icon: _jsx(Bot, { size: 14, "aria-hidden": true }), title: t('Next'), children: [running.length ? (_jsx(YStack, { gap: "$2", children: running.slice(0, 2).map((s) => (_jsxs(YStack, { gap: "$1", children: [_jsx(Row, { href: "/work", children: s.title || s.agent || t('Run') }), _jsx(Bar, { run: s, label: false })] }, s.id))) })) : null, rows.length === 0 && running.length === 0 ? (_jsx(Quiet, { children: t('Nothing needs you.') })) : (_jsx(YStack, { gap: "$1", children: rows.slice(0, 3).map((r) => (_jsx(Row, { href: r.href, onPress: r.press, children: r.say }, r.key))) }))] }));
272
282
  }
273
283
  /**
274
284
  * The apps the org has connected.
@@ -315,5 +325,5 @@ function Mates({ owner }) {
315
325
  }
316
326
  function Build() {
317
327
  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') })] }));
328
+ 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
329
  }
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/Shell.js CHANGED
@@ -74,6 +74,7 @@ const HOME_INDICATOR = "env(safe-area-inset-bottom)";
74
74
  import { invite } from "./lib/home.js";
75
75
  import { reach } from "./lib/reach.js";
76
76
  import { say } from "./failure.js";
77
+ import { half } from "./half.js";
77
78
  import { Face } from "./cast.js";
78
79
  import { useStarred, titleOf } from "./stars.js";
79
80
  import { channelName } from "./network.js";
@@ -814,8 +815,13 @@ function Bots({ show, owner, filter = "", onPick, navigate, }) {
814
815
  folk = [...folk].sort((a, b) => (a.displayName || a.name).localeCompare(b.displayName || b.name));
815
816
  }
816
817
  const empty = folk.length + shown.length === 0;
817
- const waiting = agentsLoading || peopleLoading;
818
- const broke = agentsWrong ?? peopleWrong;
818
+ // Each half answers for its own read. IAM refuses the people read to a member
819
+ // who is not an org admin, so reporting either read's failure put "cannot open
820
+ // this org's roster" over agents that had loaded (half.ts).
821
+ const { loading: waiting, error: broke } = half(show, {
822
+ agents: { loading: agentsLoading, error: agentsWrong },
823
+ people: { loading: peopleLoading, error: peopleWrong },
824
+ });
819
825
  const pick = async (file) => {
820
826
  if (!file)
821
827
  return;
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/Talk.js CHANGED
@@ -51,7 +51,7 @@ const mention = (draft, name) => `${draft && !/\s$/.test(draft) ? `${draft} ` :
51
51
  export function Talk({ channel }) {
52
52
  const { t, dir, locale } = useI18n();
53
53
  const { messages, failed, send } = useMessages(channel.id, channel.space);
54
- const { members, wrong } = useRoster();
54
+ const { members, wrong } = useRoster(channel.space);
55
55
  const me = useMe();
56
56
  const { aside, showAside } = useOpen();
57
57
  const [draft, setDraft] = useState('');
package/dist/Work.js CHANGED
@@ -15,6 +15,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
15
15
  import { useCallback, useEffect, useMemo, useState } from 'react';
16
16
  import { useAi, useSession, useSessions } from '@hanzo/ai/react';
17
17
  import { useOpen } from './open.js';
18
+ import { asked, KEY } from './watch.js';
18
19
  import { AgentBoard, ChannelHeader, Pane, ProgressBlock, Steer, steps, } from '@hanzo/ui/agents';
19
20
  import { Text, XStack, YStack } from '@hanzo/ui';
20
21
  import { useIam } from '@hanzo/iam/react';
@@ -88,6 +89,20 @@ function Watching({ idle }) {
88
89
  // and the list is re-read when the id changes so the new row is there to open.
89
90
  const { session: open, openSession: setOpen } = useOpen();
90
91
  const [trees, setTrees] = useState({});
92
+ // A run the address names opens on arrival: Home's "{n} failed" sends
93
+ // /work?session=<id> (./watch). The param is then dropped, the way Chat drops
94
+ // `?thread=`, so the address is the board's own again and a reload does not
95
+ // reopen a run the reader has moved on from.
96
+ useEffect(() => {
97
+ const url = new URL(window.location.href);
98
+ if (!url.searchParams.has(KEY))
99
+ return;
100
+ const id = asked(url.search);
101
+ url.searchParams.delete(KEY);
102
+ window.history.replaceState(null, '', `${url.pathname}${url.search}${url.hash}`);
103
+ if (id)
104
+ setOpen(id);
105
+ }, [setOpen]);
91
106
  useEffect(() => {
92
107
  if (open)
93
108
  reload();
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,
@@ -0,0 +1,12 @@
1
+ import type { Session } from '@hanzo/ai';
2
+ /** How long a failure stays on the card: the Recents menu's "Past 7 days". */
3
+ export declare const FRESH: number;
4
+ /**
5
+ * The failed runs worth the card, newest first.
6
+ *
7
+ * Only a tree's root counts: a sub-run that failed under a root is the root's
8
+ * business, and a root that failed is one failure however many of its sub-runs
9
+ * failed with it. A run with no time on it is left out, since nothing says it
10
+ * is recent.
11
+ */
12
+ export declare function failed(sessions: readonly (Session | null | undefined)[], now?: number): Session[];
package/dist/failed.js ADDED
@@ -0,0 +1,28 @@
1
+ // The runs Home's Next card says failed: the ones that are still news. No React,
2
+ // so a spec reads it as it is.
3
+ //
4
+ // The card counted every run marked `error` among the org's last 100, with no
5
+ // window and a fan-out's sub-runs each counted on their own, so a failure stayed
6
+ // on the card ("14 failed", hanzo-inc/app issue 202) until a hundred newer runs pushed
7
+ // it off the page, however long ago it happened. A failure is news for the same
8
+ // 7 days the Recents menu calls "Past 7 days", and a tree is one run.
9
+ /** How long a failure stays on the card: the Recents menu's "Past 7 days". */
10
+ export const FRESH = 7 * 86_400_000;
11
+ /** When a run stopped: its end, else its last activity, else its start. */
12
+ const when = (s) => Date.parse(s.endedAt || s.updatedAt || s.createdAt || '');
13
+ /** The top of a tree: no parent, and the root it names, if any, is itself. */
14
+ const top = (s) => !s.parentSessionId && (!s.rootSessionId || s.rootSessionId === s.id);
15
+ /**
16
+ * The failed runs worth the card, newest first.
17
+ *
18
+ * Only a tree's root counts: a sub-run that failed under a root is the root's
19
+ * business, and a root that failed is one failure however many of its sub-runs
20
+ * failed with it. A run with no time on it is left out, since nothing says it
21
+ * is recent.
22
+ */
23
+ export function failed(sessions, now = Date.now()) {
24
+ return sessions
25
+ .filter((s) => !!s && s.status === 'error' && top(s))
26
+ .filter((s) => now - when(s) <= FRESH)
27
+ .sort((a, b) => when(b) - when(a));
28
+ }
package/dist/half.d.ts ADDED
@@ -0,0 +1,8 @@
1
+ export type Half = 'agents' | 'people';
2
+ /** One read's state, as `useAgents` and `usePeople` answer it. */
3
+ export interface Read {
4
+ loading: boolean;
5
+ error: Error | null;
6
+ }
7
+ /** The read the half `show` draws: the only one whose wait and failure it reports. */
8
+ export declare const half: (show: Half, reads: Record<Half, Read>) => Read;
package/dist/half.js ADDED
@@ -0,0 +1,14 @@
1
+ // Which read a half of the sidebar's roster answers for.
2
+ //
3
+ // The sidebar draws the roster as two halves, the org's people and its agents,
4
+ // from two reads that fail apart: the agents from `/v1/agents`, the people from
5
+ // IAM's SCIM directory. IAM lists an org's people to an org admin only (403
6
+ // "listing users requires org-admin"), so for an ordinary member the people read
7
+ // fails every time while the agents read answers.
8
+ //
9
+ // hanzo.bot/bots draws the agents half alone. It used to report whichever read
10
+ // had failed, so every member who is not an org admin read "This account cannot
11
+ // open this org's roster." over agents that had loaded (hanzo-inc/app issue 199).
12
+ // A half reports its own read and no other: its own wait, its own failure.
13
+ /** The read the half `show` draws: the only one whose wait and failure it reports. */
14
+ export const half = (show, reads) => reads[show];
@@ -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
@@ -0,0 +1,35 @@
1
+ /** The space roster's route. */
2
+ export declare const MEMBERS = "/v1/team/members";
3
+ /** One row of a space roster, as cloud answers it. */
4
+ export interface TeamMember {
5
+ /** The account uuid: a message's author, a channel member, a `<@id>` mention. */
6
+ id: string;
7
+ name: string;
8
+ /** One of the org's agents rather than a person. */
9
+ bot: boolean;
10
+ /** A blob id, readable at `/v1/team/files/{space}/avatar` with the reader's
11
+ * credential. Not a picture a `src` can draw, so it is not carried. */
12
+ avatar?: string;
13
+ role?: string;
14
+ /** False for a retired agent, which stays so its past messages keep an author. */
15
+ active?: boolean;
16
+ presence?: string;
17
+ personRef?: string;
18
+ }
19
+ /** One member of the org: a person, or an agent standing in the channels. */
20
+ export interface Member {
21
+ /** The account a message names as its author. */
22
+ id: string;
23
+ name: string;
24
+ /** A saved picture, as a data URI. Absent where the source has none to draw. */
25
+ avatar?: string;
26
+ agent: boolean;
27
+ }
28
+ /**
29
+ * The members a roster answer names, in the order it gives (people, then
30
+ * agents). A row with no account names no author, so it is not a member; a row
31
+ * with no name is called by its account.
32
+ */
33
+ export declare const membersOf: (body: {
34
+ members?: TeamMember[] | null;
35
+ } | null | undefined) => Member[];
@@ -0,0 +1,22 @@
1
+ // Who a channel can name: the space roster, read once.
2
+ //
3
+ // `GET /v1/team/members?space=<space>` (hanzo-inc/cloud apps/team/members.go)
4
+ // answers the space's people and the org's agents in one list, each by the
5
+ // account uuid a message names as its author, and asks only that the reader be
6
+ // a member of the space.
7
+ //
8
+ // It replaced two reads joined with Promise.all, and both failed a signed-in
9
+ // reader (hanzo-inc/app issue 199):
10
+ // - `/v1/team/bots`, which cloud retired for `/v1/bot/members`, answers 404,
11
+ // so the pair failed for everyone.
12
+ // - `/v1/iam/users?owner=<org>` is listed to an org admin only, so a member
13
+ // read 403 even before that.
14
+ // A channel's Roster said "Could not read this org's roster." either way.
15
+ /** The space roster's route. */
16
+ export const MEMBERS = '/v1/team/members';
17
+ /**
18
+ * The members a roster answer names, in the order it gives (people, then
19
+ * agents). A row with no account names no author, so it is not a member; a row
20
+ * with no name is called by its account.
21
+ */
22
+ export const membersOf = (body) => (body?.members ?? []).flatMap((one) => (one?.id ? [{ id: one.id, name: one.name || one.id, agent: Boolean(one.bot) }] : []));
package/dist/roster.d.ts CHANGED
@@ -1,20 +1,13 @@
1
- /** One member of the org: a person, or an agent standing in the channels. */
2
- export interface Member {
3
- /** The account a message names as its author. */
4
- id: string;
5
- name: string;
6
- /** A saved picture, as a data URI. People only; an agent wears initials. */
7
- avatar?: string;
8
- agent: boolean;
9
- }
1
+ import { type Member } from './members.js';
2
+ export type { Member } from './members.js';
10
3
  /**
11
- * The org's members, or null while unknown.
4
+ * The members of the space a channel stands in, or null while unknown.
12
5
  *
13
- * Needs a session and an org: both reads are org-scoped and answer 403 without
14
- * one. A service account carries no id and can author nothing, so it is not a
15
- * member here.
6
+ * Needs a session and the space: the roster is read per space and answers only
7
+ * a member of it. A service account carries no id and can author nothing, so it
8
+ * is not a member here.
16
9
  */
17
- export declare function useRoster(): {
10
+ export declare function useRoster(space: string | undefined): {
18
11
  members: Member[] | null;
19
12
  wrong: unknown;
20
13
  };
package/dist/roster.js CHANGED
@@ -1,49 +1,37 @@
1
1
  'use client';
2
- // Who is in the org, by account — the ONE place an author becomes a name.
2
+ // Who is in a space, by account — the ONE place an author becomes a name.
3
3
  //
4
4
  // A message carries the team account that wrote it and nothing else: for a
5
5
  // person that is their IAM user id (the OIDC `sub`, which team's account id
6
- // equals), for an agent the user id the platform minted for it and publishes on
7
- // `/v1/team/bots`. Two reads, one list, so the transcript, the roster column and
8
- // the mention chips cannot disagree about what to call anybody.
6
+ // equals), for an agent the account team derives from its id. The space roster
7
+ // answers both in one list (members.ts), so the transcript, the roster column
8
+ // and the mention chips cannot disagree about what to call anybody.
9
9
  import { useEffect, useState } from 'react';
10
- import { useIam, useOrganizations } from '@hanzo/iam/react';
10
+ import { useIam } from '@hanzo/iam/react';
11
11
  import { useAi } from './lib/ai.js';
12
+ import { MEMBERS, membersOf } from './members.js';
12
13
  /**
13
- * The org's members, or null while unknown.
14
+ * The members of the space a channel stands in, or null while unknown.
14
15
  *
15
- * Needs a session and an org: both reads are org-scoped and answer 403 without
16
- * one. A service account carries no id and can author nothing, so it is not a
17
- * member here.
16
+ * Needs a session and the space: the roster is read per space and answers only
17
+ * a member of it. A service account carries no id and can author nothing, so it
18
+ * is not a member here.
18
19
  */
19
- export function useRoster() {
20
+ export function useRoster(space) {
20
21
  const { client } = useAi();
21
22
  const { isAuthenticated } = useIam();
22
- const { currentOrgId } = useOrganizations();
23
23
  const [members, setMembers] = useState(null);
24
24
  const [wrong, setWrong] = useState(null);
25
25
  useEffect(() => {
26
- if (!client || !isAuthenticated || !currentOrgId)
26
+ if (!client || !isAuthenticated || !space)
27
27
  return;
28
28
  let live = true;
29
29
  const stop = new AbortController();
30
- const { signal } = stop;
31
- Promise.all([
32
- client.http.json({ path: '/v1/iam/users', query: { owner: currentOrgId }, signal }),
33
- client.http.json({
34
- path: '/v1/team/bots',
35
- signal,
36
- }),
37
- ])
38
- .then(([people, bots]) => {
39
- if (!live)
40
- return;
41
- setMembers([
42
- ...(people.users ?? []).flatMap((one) => one.id
43
- ? [{ id: one.id, name: one.displayName || one.name, avatar: one.avatar || undefined, agent: false }]
44
- : []),
45
- ...(bots.bots ?? []).map((one) => ({ id: one.userId, name: one.name, agent: true })),
46
- ]);
30
+ client.http
31
+ .json({ path: MEMBERS, query: { space }, signal: stop.signal })
32
+ .then((body) => {
33
+ if (live)
34
+ setMembers(membersOf(body));
47
35
  })
48
36
  .catch((e) => {
49
37
  if (live)
@@ -53,7 +41,7 @@ export function useRoster() {
53
41
  live = false;
54
42
  stop.abort();
55
43
  };
56
- }, [client, isAuthenticated, currentOrgId]);
44
+ }, [client, isAuthenticated, space]);
57
45
  return { members, wrong };
58
46
  }
59
47
  /** The member an author id names, or undefined for one the roster lacks. */
@@ -0,0 +1,6 @@
1
+ /** The query key Work reads a run from. */
2
+ export declare const KEY = "session";
3
+ /** The Work board, opened on one run; the board alone for anything that is not an id. */
4
+ export declare const watch: (id: string) => string;
5
+ /** The run an address asks Work to open, or null when it names none. */
6
+ export declare function asked(search: string): string | null;
package/dist/watch.js ADDED
@@ -0,0 +1,20 @@
1
+ // One run on the Work board, as an address: where a line about a run sends the
2
+ // reader. No React, so a spec reads it as it is.
3
+ //
4
+ // Home's Next card says "{n} failed in the past 7 days". Linked to /work alone,
5
+ // it left the reader on a board of up to a hundred runs, old failures among
6
+ // them, to find the ones it meant (hanzo-inc/app issue 202). The address names
7
+ // the newest failure instead, and Work opens it on arrival, where its steps say
8
+ // what went wrong and Steer acts on it. What writes the address and what reads
9
+ // it live here together, so the two cannot drift apart.
10
+ /** The query key Work reads a run from. */
11
+ export const KEY = 'session';
12
+ /** An id-shaped token ("sess_" + 32 hex today), and nothing that could be a path. */
13
+ const ID = /^[A-Za-z0-9_-]{1,128}$/;
14
+ /** The Work board, opened on one run; the board alone for anything that is not an id. */
15
+ export const watch = (id) => (ID.test(id) ? `/work?${new URLSearchParams({ [KEY]: id })}` : '/work');
16
+ /** The run an address asks Work to open, or null when it names none. */
17
+ export function asked(search) {
18
+ const id = new URLSearchParams(search).get(KEY)?.trim();
19
+ return id && ID.test(id) ? id : null;
20
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hanzo/app",
3
- "version": "0.3.52",
3
+ "version": "0.3.54",
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",