@hanzo/app 0.3.93 → 0.3.95
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Account.d.ts +9 -3
- package/dist/Account.js +142 -141
- package/dist/App.js +71 -37
- package/dist/Bar.js +1 -1
- package/dist/Betas.d.ts +1 -1
- package/dist/Betas.js +16 -22
- package/dist/Board.js +113 -47
- package/dist/CalScheduler.d.ts +1 -0
- package/dist/CalScheduler.js +223 -57
- package/dist/Chat.js +432 -153
- package/dist/Contacts.js +35 -31
- package/dist/ContextMenu.js +126 -42
- package/dist/Directory.js +1 -1
- package/dist/Drawer.js +1 -1
- package/dist/Drive.js +351 -119
- package/dist/Gate.js +156 -13
- package/dist/Home.js +31 -53
- package/dist/Inbox.js +29 -15
- package/dist/InlineRename.d.ts +6 -0
- package/dist/InlineRename.js +41 -0
- package/dist/Learning.js +132 -13
- package/dist/Market.js +13 -9
- package/dist/Meet.d.ts +5 -0
- package/dist/Meet.js +75 -51
- package/dist/MoreMenu.d.ts +19 -0
- package/dist/MoreMenu.js +33 -0
- package/dist/NeedMoreUsage.js +2 -2
- package/dist/OrgSwitcher.js +6 -2
- package/dist/Rail.d.ts +73 -7
- package/dist/Rail.js +372 -111
- package/dist/Recents.js +77 -24
- package/dist/RightPane.js +2 -2
- package/dist/Search.d.ts +13 -1
- package/dist/Search.js +366 -50
- package/dist/Setup.js +34 -5
- package/dist/Shared.js +12 -12
- package/dist/Shell.js +210 -151
- package/dist/Sidebar.d.ts +14 -3
- package/dist/Sidebar.js +411 -129
- package/dist/SkipLink.d.ts +8 -0
- package/dist/SkipLink.js +11 -0
- package/dist/Start.js +51 -52
- package/dist/Terminals.js +159 -11
- package/dist/ToBottom.js +1 -1
- package/dist/Upgrade.d.ts +8 -3
- package/dist/Upgrade.js +194 -103
- package/dist/Usage.d.ts +1 -1
- package/dist/Usage.js +186 -82
- package/dist/WalletPill.js +8 -2
- package/dist/Work.js +162 -53
- package/dist/archive.d.ts +8 -0
- package/dist/archive.js +16 -0
- package/dist/bots/Bots.js +1 -1
- package/dist/bots/ComputerDialog.js +53 -26
- package/dist/bots/ConnectorsDialog.js +34 -15
- package/dist/bots/Make.js +5 -1
- package/dist/bots/Panel.js +37 -31
- package/dist/bots/Roster.js +18 -13
- package/dist/bots/Thread.js +54 -27
- package/dist/bots/face.js +6 -2
- package/dist/bots/kit.d.ts +1 -0
- package/dist/bots/kit.js +1 -1
- package/dist/bots/refusal.d.ts +13 -4
- package/dist/bots/refusal.js +62 -8
- package/dist/chord.d.ts +13 -0
- package/dist/chord.js +30 -1
- package/dist/crew.js +47 -4
- package/dist/ground.d.ts +1 -1
- package/dist/ground.js +1 -1
- package/dist/help.d.ts +7 -3
- package/dist/help.js +19 -14
- package/dist/keys.d.ts +28 -0
- package/dist/keys.js +58 -0
- package/dist/lib/arrival.d.ts +5 -0
- package/dist/lib/arrival.js +10 -0
- package/dist/lib/betas.d.ts +2 -0
- package/dist/lib/betas.js +10 -0
- package/dist/lib/branch.d.ts +11 -0
- package/dist/lib/branch.js +11 -0
- package/dist/lib/chatPreferences.d.ts +1 -1
- package/dist/lib/chatPreferences.js +1 -1
- package/dist/lib/dev-mode.d.ts +18 -0
- package/dist/lib/dev-mode.js +102 -0
- package/dist/lib/info-hint.d.ts +7 -0
- package/dist/lib/info-hint.js +8 -0
- package/dist/lib/model-picker.d.ts +2 -0
- package/dist/lib/model-picker.js +12 -0
- package/dist/lib/owners.d.ts +5 -0
- package/dist/lib/owners.js +15 -0
- package/dist/lib/pay.d.ts +2 -0
- package/dist/lib/pay.js +4 -0
- package/dist/lib/todo.d.ts +6 -0
- package/dist/lib/todo.js +37 -25
- package/dist/look.js +39 -8
- package/dist/rail-open.d.ts +9 -0
- package/dist/rail-open.js +34 -0
- package/dist/renaming.d.ts +10 -0
- package/dist/renaming.js +25 -0
- package/dist/thread.d.ts +2 -1
- package/dist/thread.js +85 -44
- package/package.json +11 -11
package/dist/keys.d.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { type Press } from './chord.js';
|
|
2
|
+
/** What the workspace's global keys do, said by the surface that draws the workspace. */
|
|
3
|
+
export interface Keys {
|
|
4
|
+
/** ⌘K: the palette, open or shut. */
|
|
5
|
+
find(): void;
|
|
6
|
+
/** ⌘⇧O: a new chat. */
|
|
7
|
+
newChat(): void;
|
|
8
|
+
/** ⌘B: the sidebar, open or shut. */
|
|
9
|
+
sidebar(): void;
|
|
10
|
+
/** ⌘,: Settings (or the sign-in prompt for a stranger). */
|
|
11
|
+
settings(): void;
|
|
12
|
+
/** ⌘⇧L: the theme, kept on the account (`Host.chooseTheme`). */
|
|
13
|
+
chooseTheme?(next: 'light' | 'dark'): void;
|
|
14
|
+
/** One line of confirmation after a theme or Developer mode switch. */
|
|
15
|
+
say?(message: string): void;
|
|
16
|
+
}
|
|
17
|
+
/** The part of a keydown the global keys read. */
|
|
18
|
+
export type Stroke = Press & {
|
|
19
|
+
preventDefault(): void;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* THE ONE KEY HANDLER. App and Shell both mount this and nothing else listens
|
|
23
|
+
* for these keys, so a key means the same on every surface and a theme chosen
|
|
24
|
+
* with ⌘⇧L is saved to the account the way the menu's choice is.
|
|
25
|
+
*/
|
|
26
|
+
export declare function handle(e: Stroke, on: Keys, t: (s: string) => string): boolean;
|
|
27
|
+
/** Listen for the global keys while mounted. */
|
|
28
|
+
export declare function useGlobalKeys(on: Keys): void;
|
package/dist/keys.js
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { useEffect, useRef } from 'react';
|
|
3
|
+
import { useI18n } from '@hanzo/i18n/react';
|
|
4
|
+
import { globalAction, inDialog, typing } from './chord.js';
|
|
5
|
+
import { getDevMode, setDevMode } from './lib/dev-mode.js';
|
|
6
|
+
import { summons } from './seek.js';
|
|
7
|
+
/**
|
|
8
|
+
* THE ONE KEY HANDLER. App and Shell both mount this and nothing else listens
|
|
9
|
+
* for these keys, so a key means the same on every surface and a theme chosen
|
|
10
|
+
* with ⌘⇧L is saved to the account the way the menu's choice is.
|
|
11
|
+
*/
|
|
12
|
+
export function handle(e, on, t) {
|
|
13
|
+
// A press something already answered, or one that is still composing a character, is not a command.
|
|
14
|
+
if (e.defaultPrevented || e.isComposing)
|
|
15
|
+
return false;
|
|
16
|
+
if (summons(e)) {
|
|
17
|
+
e.preventDefault();
|
|
18
|
+
on.find();
|
|
19
|
+
return true;
|
|
20
|
+
}
|
|
21
|
+
const act = globalAction(e);
|
|
22
|
+
if (act) {
|
|
23
|
+
e.preventDefault();
|
|
24
|
+
if (act === 'new-chat')
|
|
25
|
+
on.newChat();
|
|
26
|
+
else if (act === 'toggle-sidebar')
|
|
27
|
+
on.sidebar();
|
|
28
|
+
else if (act === 'toggle-theme') {
|
|
29
|
+
const cls = typeof document !== 'undefined' ? document.documentElement.classList : null;
|
|
30
|
+
const next = cls && (cls.contains('light') || cls.contains('t_light')) ? 'dark' : 'light';
|
|
31
|
+
on.chooseTheme?.(next);
|
|
32
|
+
on.say?.(next === 'light' ? t('Switched to light theme') : t('Switched to dark theme'));
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
const next = !getDevMode();
|
|
36
|
+
setDevMode(next);
|
|
37
|
+
on.say?.(next ? t('Developer mode enabled') : t('Developer mode disabled'));
|
|
38
|
+
}
|
|
39
|
+
return true;
|
|
40
|
+
}
|
|
41
|
+
if ((e.metaKey || e.ctrlKey) && !e.shiftKey && !e.altKey && e.key === ',' && !typing(e.target) && !inDialog(e.target)) {
|
|
42
|
+
e.preventDefault();
|
|
43
|
+
on.settings();
|
|
44
|
+
return true;
|
|
45
|
+
}
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
48
|
+
/** Listen for the global keys while mounted. */
|
|
49
|
+
export function useGlobalKeys(on) {
|
|
50
|
+
const { t } = useI18n();
|
|
51
|
+
const latest = useRef(on);
|
|
52
|
+
latest.current = on;
|
|
53
|
+
useEffect(() => {
|
|
54
|
+
const key = (e) => void handle(e, latest.current, t);
|
|
55
|
+
window.addEventListener('keydown', key);
|
|
56
|
+
return () => window.removeEventListener('keydown', key);
|
|
57
|
+
}, [t]);
|
|
58
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** Landing in the Drive happens once: the first bucket opens on arrival, and never again after the reader has gone back to the root list. */
|
|
2
|
+
export declare function arrival(done: boolean, bucket: string | null, first: string | null): {
|
|
3
|
+
done: boolean;
|
|
4
|
+
open: string | null;
|
|
5
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** Landing in the Drive happens once: the first bucket opens on arrival, and never again after the reader has gone back to the root list. */
|
|
2
|
+
export function arrival(done, bucket, first) {
|
|
3
|
+
if (done)
|
|
4
|
+
return { done, open: null };
|
|
5
|
+
if (bucket)
|
|
6
|
+
return { done: true, open: null };
|
|
7
|
+
if (first)
|
|
8
|
+
return { done: true, open: first };
|
|
9
|
+
return { done: false, open: null };
|
|
10
|
+
}
|
package/dist/lib/betas.d.ts
CHANGED
|
@@ -21,6 +21,8 @@
|
|
|
21
21
|
*/
|
|
22
22
|
export declare const GROUPS: readonly ['Business', 'Data', 'Agents', 'Build & run', 'Security', 'Creative', 'Models'];
|
|
23
23
|
export type Group = (typeof GROUPS)[number];
|
|
24
|
+
/** A group's heading as the list draws it: authored English, drawn through `t`. */
|
|
25
|
+
export declare const HEADING: Record<Group, string>;
|
|
24
26
|
/**
|
|
25
27
|
* How an app draws inside the Hanzo app, at /apps/<id>: its own live host in a
|
|
26
28
|
* frame (`href`, with `?embed=1`), so a deploy of the standalone app reaches
|
package/dist/lib/betas.js
CHANGED
|
@@ -23,6 +23,16 @@ import { phrase } from '@hanzo/i18n';
|
|
|
23
23
|
import { CHANGED } from './optin.js';
|
|
24
24
|
import { home, named, orgs, superAdmin } from './session.js';
|
|
25
25
|
export const GROUPS = ['Business', 'Data', 'Agents', 'Build & run', 'Security', 'Creative', 'Models'];
|
|
26
|
+
/** A group's heading as the list draws it: authored English, drawn through `t`. */
|
|
27
|
+
export const HEADING = {
|
|
28
|
+
Business: phrase('Business'),
|
|
29
|
+
Data: phrase('Data'),
|
|
30
|
+
Agents: phrase('Agents'),
|
|
31
|
+
'Build & run': phrase('Build & run'),
|
|
32
|
+
Security: phrase('Security'),
|
|
33
|
+
Creative: phrase('Creative'),
|
|
34
|
+
Models: phrase('Models'),
|
|
35
|
+
};
|
|
26
36
|
/** The developer platform, where a module in beta opens at its own address for anyone who has it. */
|
|
27
37
|
const PLATFORM = 'https://platform.hanzo.ai';
|
|
28
38
|
export const BETAS = [
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** What a branch saves: the chat up to this answer, as plain turns. Nothing at all for a chat that keeps nothing (anonymous or private), or an empty one. */
|
|
2
|
+
export declare function branched<T extends {
|
|
3
|
+
id?: string;
|
|
4
|
+
role: string;
|
|
5
|
+
}>(list: readonly T[], turnId: string, text: (turn: T) => string, chat: {
|
|
6
|
+
anonymous?: boolean;
|
|
7
|
+
forgetful?: boolean;
|
|
8
|
+
}): {
|
|
9
|
+
role: string;
|
|
10
|
+
content: string;
|
|
11
|
+
}[] | null;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** What a branch saves: the chat up to this answer, as plain turns. Nothing at all for a chat that keeps nothing (anonymous or private), or an empty one. */
|
|
2
|
+
export function branched(list, turnId, text, chat) {
|
|
3
|
+
if (chat.anonymous || chat.forgetful)
|
|
4
|
+
return null;
|
|
5
|
+
const at = list.findIndex((m) => m.id === turnId);
|
|
6
|
+
const turns = (at >= 0 ? list.slice(0, at + 1) : list)
|
|
7
|
+
.filter((m) => m.role === 'user' || m.role === 'assistant')
|
|
8
|
+
.map((m) => ({ role: m.role, content: text(m) }))
|
|
9
|
+
.filter((m) => m.content.trim());
|
|
10
|
+
return turns.length ? turns : null;
|
|
11
|
+
}
|
|
@@ -11,7 +11,7 @@ export interface ChatPreferences {
|
|
|
11
11
|
showLanguage?: boolean;
|
|
12
12
|
effortVersion?: number;
|
|
13
13
|
}
|
|
14
|
-
/** The effort Dev takes for one chosen here (@hanzo/build `EFFORTS`: Auto, High, Max), or null for Instant
|
|
14
|
+
/** The effort Dev takes for one chosen here (@hanzo/build `EFFORTS`: Auto, Low (shown as Fast), High, Max), or null for Instant and Medium, which only Chat offers. */
|
|
15
15
|
export declare function shared(effort: Effort): Level | null;
|
|
16
16
|
export declare function getChatPreferences(): ChatPreferences;
|
|
17
17
|
export declare function setChatPreferences(patch: Partial<ChatPreferences>): ChatPreferences;
|
|
@@ -22,7 +22,7 @@ const DEFAULT_PREFERENCES = {
|
|
|
22
22
|
showLanguage: false,
|
|
23
23
|
effortVersion: EFFORT_SCHEMA_VERSION,
|
|
24
24
|
};
|
|
25
|
-
/** The effort Dev takes for one chosen here (@hanzo/build `EFFORTS`: Auto, High, Max), or null for Instant
|
|
25
|
+
/** The effort Dev takes for one chosen here (@hanzo/build `EFFORTS`: Auto, Low (shown as Fast), High, Max), or null for Instant and Medium, which only Chat offers. */
|
|
26
26
|
export function shared(effort) {
|
|
27
27
|
return DEV.some((e) => e.id === effort) ? effort : null;
|
|
28
28
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export declare const DEV_MODE_KEY = "hanzo.dev_mode";
|
|
2
|
+
export declare const DEV_MODE_EVENT = "hanzo:dev-mode";
|
|
3
|
+
export declare const SETTINGS_RETURN_KEY = "hanzo.settings.return";
|
|
4
|
+
export declare function getDevMode(): boolean;
|
|
5
|
+
export declare function setDevMode(next: boolean): void;
|
|
6
|
+
export declare function useDevMode(): [boolean, (next: boolean) => void];
|
|
7
|
+
export interface DeviceLabelOptions {
|
|
8
|
+
firstName?: string | null;
|
|
9
|
+
kind?: string | null;
|
|
10
|
+
os?: string | null;
|
|
11
|
+
devMode?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export declare function formatDeviceLabel(raw: string | null | undefined, opts?: DeviceLabelOptions): {
|
|
14
|
+
title: string;
|
|
15
|
+
detail?: string;
|
|
16
|
+
};
|
|
17
|
+
export declare function rememberSettingsReturn(path?: string): void;
|
|
18
|
+
export declare function readSettingsReturn(fallback?: string): string;
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { useCallback, useSyncExternalStore } from 'react';
|
|
2
|
+
export const DEV_MODE_KEY = 'hanzo.dev_mode';
|
|
3
|
+
export const DEV_MODE_EVENT = 'hanzo:dev-mode';
|
|
4
|
+
export const SETTINGS_RETURN_KEY = 'hanzo.settings.return';
|
|
5
|
+
export function getDevMode() {
|
|
6
|
+
if (typeof window === 'undefined')
|
|
7
|
+
return false;
|
|
8
|
+
try {
|
|
9
|
+
return window.localStorage.getItem(DEV_MODE_KEY) === 'true';
|
|
10
|
+
}
|
|
11
|
+
catch {
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
export function setDevMode(next) {
|
|
16
|
+
if (typeof window === 'undefined')
|
|
17
|
+
return;
|
|
18
|
+
try {
|
|
19
|
+
window.localStorage.setItem(DEV_MODE_KEY, next ? 'true' : 'false');
|
|
20
|
+
}
|
|
21
|
+
catch { }
|
|
22
|
+
window.dispatchEvent(new CustomEvent(DEV_MODE_EVENT, { detail: { enabled: next } }));
|
|
23
|
+
}
|
|
24
|
+
function subscribeDevMode(onChange) {
|
|
25
|
+
if (typeof window === 'undefined')
|
|
26
|
+
return () => { };
|
|
27
|
+
const handler = () => onChange();
|
|
28
|
+
const onStorage = (e) => {
|
|
29
|
+
if (e.key === DEV_MODE_KEY)
|
|
30
|
+
onChange();
|
|
31
|
+
};
|
|
32
|
+
window.addEventListener(DEV_MODE_EVENT, handler);
|
|
33
|
+
window.addEventListener('storage', onStorage);
|
|
34
|
+
return () => {
|
|
35
|
+
window.removeEventListener(DEV_MODE_EVENT, handler);
|
|
36
|
+
window.removeEventListener('storage', onStorage);
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
export function useDevMode() {
|
|
40
|
+
const enabled = useSyncExternalStore(subscribeDevMode, getDevMode, () => false);
|
|
41
|
+
const update = useCallback((next) => setDevMode(next), []);
|
|
42
|
+
return [enabled, update];
|
|
43
|
+
}
|
|
44
|
+
export function formatDeviceLabel(raw, opts = {}) {
|
|
45
|
+
const cleanRaw = (raw ?? '').trim();
|
|
46
|
+
if (!cleanRaw)
|
|
47
|
+
return { title: 'Cloud' };
|
|
48
|
+
if (opts.devMode)
|
|
49
|
+
return { title: cleanRaw };
|
|
50
|
+
const lower = cleanRaw.toLowerCase();
|
|
51
|
+
if (lower === 'hanzo sandbox' ||
|
|
52
|
+
lower === 'sandbox' ||
|
|
53
|
+
lower === 'cloud' ||
|
|
54
|
+
/^cloud(-\d+)?(\b|\s|·)/.test(lower)) {
|
|
55
|
+
return {
|
|
56
|
+
title: 'Auto (Cloud)',
|
|
57
|
+
detail: cleanRaw === 'Cloud' ? 'Managed Hanzo cloud workspace' : cleanRaw,
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
// Strip shell/tmux/hardware suffixes for the human-facing title while keeping full detail for tooltip
|
|
61
|
+
const basePart = cleanRaw
|
|
62
|
+
.split(/\s*·\s*/)[0]
|
|
63
|
+
.replace(/\s*\((?:shell|desk|tmux|tty)[^)]*\)\s*$/i, '')
|
|
64
|
+
.replace(/\.(local|lan|home|internal)$/i, '')
|
|
65
|
+
.replace(/-\d+$/, '')
|
|
66
|
+
.trim();
|
|
67
|
+
if (/macbook|\b(imac|mac-studio|mac-mini|mac|laptop|desktop|workstation|localhost|local)\b/i.test(cleanRaw) ||
|
|
68
|
+
opts.os === 'darwin' ||
|
|
69
|
+
opts.kind === 'laptop' ||
|
|
70
|
+
opts.kind === 'desktop' ||
|
|
71
|
+
/^tgt_[a-z0-9]+$/i.test(basePart)) {
|
|
72
|
+
const title = 'Local - Device';
|
|
73
|
+
return { title, detail: cleanRaw !== title ? cleanRaw : undefined };
|
|
74
|
+
}
|
|
75
|
+
const humanized = basePart
|
|
76
|
+
.replace(/[-_]+/g, ' ')
|
|
77
|
+
.trim();
|
|
78
|
+
const title = humanized ? `Local - ${humanized}` : 'Local - Device';
|
|
79
|
+
return { title, detail: cleanRaw !== title ? cleanRaw : undefined };
|
|
80
|
+
}
|
|
81
|
+
export function rememberSettingsReturn(path) {
|
|
82
|
+
if (typeof window === 'undefined')
|
|
83
|
+
return;
|
|
84
|
+
try {
|
|
85
|
+
const target = path ?? `${window.location.pathname}${window.location.search}`;
|
|
86
|
+
if (target && !target.startsWith('/settings')) {
|
|
87
|
+
window.sessionStorage.setItem(SETTINGS_RETURN_KEY, target);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
catch { }
|
|
91
|
+
}
|
|
92
|
+
export function readSettingsReturn(fallback = '/chat') {
|
|
93
|
+
if (typeof window === 'undefined')
|
|
94
|
+
return fallback;
|
|
95
|
+
try {
|
|
96
|
+
const saved = window.sessionStorage.getItem(SETTINGS_RETURN_KEY);
|
|
97
|
+
return saved && !saved.startsWith('/settings') ? saved : fallback;
|
|
98
|
+
}
|
|
99
|
+
catch {
|
|
100
|
+
return fallback;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Info } from 'lucide-react';
|
|
3
|
+
import { Text, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, Box } from '@hanzo/ui';
|
|
4
|
+
export function InfoHint({ text, size = 13, side = 'top' }) {
|
|
5
|
+
if (!text)
|
|
6
|
+
return null;
|
|
7
|
+
return (_jsx(TooltipProvider, { delay: 150, children: _jsxs(Tooltip, { placement: side, offset: 6, children: [_jsx(TooltipTrigger, { asChild: true, children: _jsx(Box, { render: _jsx("button", { type: "button", "aria-label": text }), items: "center", justify: "center", p: "$0.5", m: 0, borderWidth: 0, bg: "transparent", rounded: "$10", cursor: "help", focusVisibleStyle: { outlineWidth: 1, outlineStyle: 'solid', outlineColor: '$outlineColor' }, onClick: (e) => e.stopPropagation(), children: _jsx(Text, { color: "$hint", hoverStyle: { color: '$ink' }, display: "flex", children: _jsx(Info, { size: size, color: "currentColor", "aria-hidden": true }) }) }) }), _jsx(TooltipContent, { maxW: 260, px: "$3", py: "$2", rounded: "$3", bg: "var(--popover)", borderWidth: 1, borderColor: "$edge", z: "var(--z-tooltip)", children: _jsx(Text, { fontFamily: "$body", fontSize: "$1", lineHeight: 16, color: "$aside", children: text }) })] }) }));
|
|
8
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** Opens the composer's model menu the way a press would. False when the page has no composer to open it on. */
|
|
2
|
+
export function openModelPicker() {
|
|
3
|
+
if (typeof document === 'undefined')
|
|
4
|
+
return false;
|
|
5
|
+
const chip = document.querySelector('[data-slot="mind"] [data-slot="model-picker"]');
|
|
6
|
+
if (!chip)
|
|
7
|
+
return false;
|
|
8
|
+
chip.focus();
|
|
9
|
+
// The picker opens on a key or a real press, not a synthetic click().
|
|
10
|
+
chip.dispatchEvent(new KeyboardEvent('keydown', { key: 'Enter', bubbles: true, cancelable: true }));
|
|
11
|
+
return true;
|
|
12
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** Who is mounted, in order: the first is the one that answers a window-wide trigger, so two mounted dialogs never both open. */
|
|
2
|
+
export function owners() {
|
|
3
|
+
const mounted = [];
|
|
4
|
+
return {
|
|
5
|
+
claim(id) {
|
|
6
|
+
mounted.push(id);
|
|
7
|
+
return () => {
|
|
8
|
+
const at = mounted.indexOf(id);
|
|
9
|
+
if (at >= 0)
|
|
10
|
+
mounted.splice(at, 1);
|
|
11
|
+
};
|
|
12
|
+
},
|
|
13
|
+
owns: (id) => mounted[0] === id,
|
|
14
|
+
};
|
|
15
|
+
}
|
package/dist/lib/pay.d.ts
CHANGED
|
@@ -54,6 +54,8 @@ export declare function payUrl(path: string, query: Record<string, string | null
|
|
|
54
54
|
* resumes on it. Another maker's models are paid from this balance on any plan.
|
|
55
55
|
*/
|
|
56
56
|
export declare function topUpUrl(model?: string): string;
|
|
57
|
+
/** A fixed top-up, in whole dollars: pay's confirm page for the card with the amount filled, as Settings' Billing opens it. */
|
|
58
|
+
export declare function topUpAmountUrl(dollars: number, returnUrl: string): string;
|
|
57
59
|
/** Leaves for the top-up. */
|
|
58
60
|
export declare function topUp(model?: string): void;
|
|
59
61
|
export declare const dollars: (n: number) => string;
|
package/dist/lib/pay.js
CHANGED
|
@@ -77,6 +77,10 @@ export function topUpUrl(model) {
|
|
|
77
77
|
back.searchParams.set("model", model);
|
|
78
78
|
return payUrl("/amount/card", { org: org(), returnUrl: back.toString() });
|
|
79
79
|
}
|
|
80
|
+
/** A fixed top-up, in whole dollars: pay's confirm page for the card with the amount filled, as Settings' Billing opens it. */
|
|
81
|
+
export function topUpAmountUrl(dollars, returnUrl) {
|
|
82
|
+
return payUrl("/confirm/card", { amount: dollars.toFixed(2), org: org(), returnUrl });
|
|
83
|
+
}
|
|
80
84
|
/** Leaves for the top-up. */
|
|
81
85
|
export function topUp(model) {
|
|
82
86
|
window.location.assign(topUpUrl(model));
|
package/dist/lib/todo.d.ts
CHANGED
|
@@ -36,6 +36,8 @@ export interface Card {
|
|
|
36
36
|
dueAt?: number;
|
|
37
37
|
createdAt: number;
|
|
38
38
|
updatedAt: number;
|
|
39
|
+
/** Kept on this device only: the server did not take it. */
|
|
40
|
+
local?: boolean;
|
|
39
41
|
}
|
|
40
42
|
/**
|
|
41
43
|
* THE COLUMNS, and they are the platform's own closed set rather than a list a
|
|
@@ -69,6 +71,10 @@ export declare function board(client?: AiClient | null, params?: {
|
|
|
69
71
|
label?: string;
|
|
70
72
|
scheduled?: boolean;
|
|
71
73
|
}, signal?: AbortSignal): Promise<Card[]>;
|
|
74
|
+
/** The board a card goes to: its own, else the one on screen ("all" is not a board), else the first the store named. */
|
|
75
|
+
export declare function targetOf(own: string | undefined, shown: string, keys: string[]): string;
|
|
76
|
+
/** The first board the server names, or null when there is none: a card is only filed on a board that exists. */
|
|
77
|
+
export declare function home(client: AiClient, signal?: AbortSignal): Promise<string | null>;
|
|
72
78
|
/** The boards themselves — a project is a repository on the forge. */
|
|
73
79
|
export declare function projects(client?: AiClient | null, signal?: AbortSignal): Promise<{
|
|
74
80
|
key: string;
|
package/dist/lib/todo.js
CHANGED
|
@@ -169,6 +169,41 @@ export async function board(client, params = {}, signal) {
|
|
|
169
169
|
return getLocalCards(params.key);
|
|
170
170
|
}
|
|
171
171
|
}
|
|
172
|
+
/** The board a card goes to: its own, else the one on screen ("all" is not a board), else the first the store named. */
|
|
173
|
+
export function targetOf(own, shown, keys) {
|
|
174
|
+
return own || (shown && shown !== 'all' ? shown : '') || keys[0] || '';
|
|
175
|
+
}
|
|
176
|
+
/** The boards the server names (todo's own, then the forge's projects), added to `map` when one is given; with a fresh map, no stand-ins. */
|
|
177
|
+
async function served(client, signal, map = new Map()) {
|
|
178
|
+
const [todoPs, devPs] = await Promise.all([
|
|
179
|
+
client.http
|
|
180
|
+
.json({
|
|
181
|
+
path: '/v1/todo/projects',
|
|
182
|
+
signal,
|
|
183
|
+
})
|
|
184
|
+
.catch(() => null),
|
|
185
|
+
client.http
|
|
186
|
+
.json({
|
|
187
|
+
path: '/v1/project',
|
|
188
|
+
signal,
|
|
189
|
+
})
|
|
190
|
+
.catch(() => null),
|
|
191
|
+
]);
|
|
192
|
+
for (const p of rows(todoPs)) {
|
|
193
|
+
if (p?.key)
|
|
194
|
+
map.set(p.key, { key: p.key, name: p.name || p.key });
|
|
195
|
+
}
|
|
196
|
+
for (const p of Array.isArray(devPs) ? devPs : []) {
|
|
197
|
+
const k = (p.name || p.id).toLowerCase().replace(/[^a-z0-9]+/g, '-');
|
|
198
|
+
if (k && !map.has(k))
|
|
199
|
+
map.set(k, { key: k, name: p.name || k });
|
|
200
|
+
}
|
|
201
|
+
return Array.from(map.values());
|
|
202
|
+
}
|
|
203
|
+
/** The first board the server names, or null when there is none: a card is only filed on a board that exists. */
|
|
204
|
+
export async function home(client, signal) {
|
|
205
|
+
return (await served(client, signal))[0]?.key ?? null;
|
|
206
|
+
}
|
|
172
207
|
/** The boards themselves — a project is a repository on the forge. */
|
|
173
208
|
export async function projects(client, signal) {
|
|
174
209
|
const fallback = [
|
|
@@ -180,34 +215,10 @@ export async function projects(client, signal) {
|
|
|
180
215
|
if (!client)
|
|
181
216
|
return fallback;
|
|
182
217
|
try {
|
|
183
|
-
const [todoPs, devPs] = await Promise.all([
|
|
184
|
-
client.http
|
|
185
|
-
.json({
|
|
186
|
-
path: '/v1/todo/projects',
|
|
187
|
-
signal,
|
|
188
|
-
})
|
|
189
|
-
.catch(() => null),
|
|
190
|
-
client.http
|
|
191
|
-
.json({
|
|
192
|
-
path: '/v1/project',
|
|
193
|
-
signal,
|
|
194
|
-
})
|
|
195
|
-
.catch(() => null),
|
|
196
|
-
]);
|
|
197
218
|
const map = new Map();
|
|
198
219
|
for (const f of fallback)
|
|
199
220
|
map.set(f.key, f);
|
|
200
|
-
|
|
201
|
-
for (const p of todoList ?? []) {
|
|
202
|
-
if (p?.key)
|
|
203
|
-
map.set(p.key, { key: p.key, name: p.name || p.key });
|
|
204
|
-
}
|
|
205
|
-
for (const p of devPs ?? []) {
|
|
206
|
-
const k = (p.name || p.id).toLowerCase().replace(/[^a-z0-9]+/g, '-');
|
|
207
|
-
if (k && !map.has(k))
|
|
208
|
-
map.set(k, { key: k, name: p.name || k });
|
|
209
|
-
}
|
|
210
|
-
return Array.from(map.values());
|
|
221
|
+
return await served(client, signal, map);
|
|
211
222
|
}
|
|
212
223
|
catch {
|
|
213
224
|
return fallback;
|
|
@@ -231,6 +242,7 @@ export async function open(client, key, card, signal) {
|
|
|
231
242
|
labels: card.labels ?? ['task'],
|
|
232
243
|
createdAt: Date.now(),
|
|
233
244
|
updatedAt: Date.now(),
|
|
245
|
+
local: true,
|
|
234
246
|
};
|
|
235
247
|
if (client) {
|
|
236
248
|
try {
|
package/dist/look.js
CHANGED
|
@@ -6,14 +6,13 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
6
6
|
* Theme, type, spacing, corners, native platform profiles, custom fonts,
|
|
7
7
|
* and organization theme mods — stored and resolved for the organization in scope.
|
|
8
8
|
*/
|
|
9
|
-
import { useState, useEffect } from 'react';
|
|
10
|
-
import { phrase } from '@hanzo/i18n';
|
|
11
|
-
import { LanguagePicker } from '@hanzo/i18n/react';
|
|
9
|
+
import { useState, useEffect, useMemo } from 'react';
|
|
10
|
+
import { locales, phrase } from '@hanzo/i18n';
|
|
12
11
|
import { useI18n } from '@hanzo/i18n/react';
|
|
13
|
-
import { Box, Button, Input, Text, XStack, YStack } from '@hanzo/ui';
|
|
12
|
+
import { Box, Button, Input, Popover, PopoverContent, PopoverTrigger, ScrollView, Text, XStack, YStack, toast } from '@hanzo/ui';
|
|
14
13
|
import { Appearance, apply } from '@hanzo/appearance';
|
|
15
14
|
import { useIam } from '@hanzo/iam/react';
|
|
16
|
-
import { Check, Download, Palette, Smartphone, Type, Upload } from 'lucide-react';
|
|
15
|
+
import { Check, ChevronDown, Download, Palette, Search, Smartphone, Type, Upload } from 'lucide-react';
|
|
17
16
|
import { setActivePlatform, BUILTIN_MODS, applyMod, clearActiveMod, exportMod, importMod, injectCustomFont, applyFontFamily, } from '@hanzo/mod';
|
|
18
17
|
import { api } from './lib/api.js';
|
|
19
18
|
import { useChatPreferences } from './lib/chatPreferences.js';
|
|
@@ -22,6 +21,37 @@ import { EFFORTS } from '@hanzo/ui/chat/pure';
|
|
|
22
21
|
import { brand } from './where.js';
|
|
23
22
|
import { tap } from './lib/tap.js';
|
|
24
23
|
const CHOICE = { rounded: 8, borderWidth: 1, borderStyle: 'solid', cursor: 'pointer' };
|
|
24
|
+
/** Monochrome searchable Popover language selector — replaces native `<LanguagePicker />`. */
|
|
25
|
+
function CustomLanguageSelect() {
|
|
26
|
+
const { locale, setLocale, t } = useI18n();
|
|
27
|
+
const [open, setOpen] = useState(false);
|
|
28
|
+
const [query, setQuery] = useState('');
|
|
29
|
+
const options = useMemo(() => locales
|
|
30
|
+
.filter((l) => !l.review || l.code === locale)
|
|
31
|
+
.map((entry) => ({
|
|
32
|
+
code: entry.code,
|
|
33
|
+
label: entry.englishName && entry.englishName !== entry.name ? `${entry.name} (${entry.englishName})` : entry.name || entry.code,
|
|
34
|
+
})), [locale]);
|
|
35
|
+
const current = options.find((o) => o.code === locale) ?? options[0];
|
|
36
|
+
const filtered = useMemo(() => {
|
|
37
|
+
const q = query.trim().toLowerCase();
|
|
38
|
+
if (!q)
|
|
39
|
+
return options;
|
|
40
|
+
return options.filter((o) => o.label.toLowerCase().includes(q) || o.code.toLowerCase().includes(q));
|
|
41
|
+
}, [options, query]);
|
|
42
|
+
return (_jsxs(Popover, { open: open, onOpenChange: (next) => {
|
|
43
|
+
setOpen(next);
|
|
44
|
+
if (!next)
|
|
45
|
+
setQuery('');
|
|
46
|
+
}, placement: "bottom-start", allowFlip: true, stayInFrame: true, children: [_jsx(PopoverTrigger, { asChild: true, disablePressTrigger: true, children: _jsxs(XStack, { render: _jsx("button", { type: "button" }), onClick: () => setOpen((prev) => !prev), "data-slot": "look-language-trigger", "aria-label": t('Language'), "aria-expanded": open, items: "center", justify: "space-between", gap: "$2", minW: 220, maxW: "100%", minH: 36, "$max-sm": { minH: 44, width: '100%' }, px: "$3", rounded: "$3", bg: "$panel", borderWidth: 1, borderColor: "var(--border-strong)", hoverStyle: { bg: '$hover' }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: 'solid', outlineColor: 'var(--ring)' }, cursor: "pointer", children: [_jsx(Text, { fontSize: "$2", color: "$ink", numberOfLines: 1, flex: 1, text: "left", children: current?.label ?? locale }), _jsx(ChevronDown, { size: 14, color: "$soft", "aria-hidden": true })] }) }), _jsx(PopoverContent, { solid: true, bg: "var(--popover)", borderWidth: 1, borderColor: "var(--border-strong)", boxShadow: "var(--shadow-floating)", rounded: "$4", p: "$2", width: 260, maxW: "calc(100vw - 24px)", z: "var(--z-popover)", children: _jsxs(YStack, { gap: "$1.5", children: [_jsxs(XStack, { items: "center", gap: "$1.5", px: "$2", height: 32, rounded: "$2", borderWidth: 1, borderColor: "$rim", bg: "$background", children: [_jsx(Search, { size: 13, color: "$soft", "aria-hidden": true }), _jsx(Input, { unstyled: true, flex: 1, minW: 0, height: 30, p: 0, borderWidth: 0, bg: "transparent", fontSize: "$2", color: "$ink", placeholder: t('Search language'), value: query, onChangeText: setQuery })] }), _jsx(ScrollView, { maxH: 220, children: _jsx(YStack, { gap: 2, children: filtered.map((opt) => {
|
|
47
|
+
const active = opt.code === locale;
|
|
48
|
+
return (_jsxs(XStack, { render: _jsx("button", { type: "button" }), onClick: () => {
|
|
49
|
+
setLocale(opt.code);
|
|
50
|
+
setOpen(false);
|
|
51
|
+
setQuery('');
|
|
52
|
+
}, items: "center", justify: "space-between", gap: "$2", width: "100%", minH: 32, "$max-sm": { minH: 44 }, px: "$2", rounded: "$2", borderWidth: 0, bg: active ? '$panel' : 'transparent', hoverStyle: { bg: '$hover' }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: 'solid', outlineColor: 'var(--ring)' }, cursor: "pointer", children: [_jsx(Text, { fontSize: "$2", color: "$ink", fontWeight: active ? '600' : '400', numberOfLines: 1, flex: 1, text: "left", children: opt.label }), active ? _jsx(Check, { size: 14, color: "$ink", "aria-hidden": true }) : null] }, opt.code));
|
|
53
|
+
}) }) })] }) })] }));
|
|
54
|
+
}
|
|
25
55
|
const PLATFORM_OPTIONS = [
|
|
26
56
|
{ id: 'auto', label: phrase('Auto (System OS)'), note: phrase('Automatically detects your device operating system') },
|
|
27
57
|
{ id: 'ios', label: phrase('Apple iOS (Liquid Glass)'), note: phrase('Continuous squircles, specular liquid glass, SF Pro typography') },
|
|
@@ -127,11 +157,12 @@ export function Look() {
|
|
|
127
157
|
try {
|
|
128
158
|
const mod = importMod(modJson.trim());
|
|
129
159
|
handleSelectMod(mod);
|
|
130
|
-
|
|
160
|
+
toast.success(t('Mod "{name}" successfully applied!', { name: mod.name }));
|
|
131
161
|
setModJson('');
|
|
132
162
|
}
|
|
133
163
|
catch (e) {
|
|
134
|
-
|
|
164
|
+
const message = e instanceof Error ? e.message : String(e);
|
|
165
|
+
toast.error(t('Failed to import mod: {message}', { message }));
|
|
135
166
|
}
|
|
136
167
|
};
|
|
137
168
|
return (_jsxs(YStack, { gap: "$5", maxW: 540, children: [_jsx(Text, { fontSize: "$3", color: "$soft", children: t('Customized per organization and kept with your account across all Hanzo surfaces.') }), _jsx(Appearance, { org: org.id, orgName: org.name || brand(), account: { base: api(), token: accessToken ?? undefined } }), _jsxs(YStack, { gap: "$2.5", children: [_jsxs(XStack, { items: "center", gap: "$2", children: [_jsx(Smartphone, { size: 16, color: "var(--primary)", "aria-hidden": true }), _jsx(Text, { fontSize: "$4", fontWeight: "600", color: "$ink", children: t('Native Platform Look & Feel') })] }), _jsx(Text, { fontSize: "$2", color: "$soft", children: t('Adaptive styling tailored to your OS: iOS Liquid Glass, Material 3, macOS Vibrant, or Windows Mica.') }), _jsx(YStack, { gap: "$1.5", pt: "$1", children: PLATFORM_OPTIONS.map((opt) => {
|
|
@@ -140,7 +171,7 @@ export function Look() {
|
|
|
140
171
|
}) })] }), _jsxs(YStack, { gap: "$3", children: [_jsxs(XStack, { items: "center", gap: "$2", children: [_jsx(Palette, { size: 16, color: "var(--primary)", "aria-hidden": true }), _jsx(Text, { fontSize: "$4", fontWeight: "600", color: "$ink", children: t('Organization Theme Mods (@hanzo/mod)') })] }), _jsx(Text, { fontSize: "$2", color: "$soft", children: t('Select or fork designer themes for custom organization branding.') }), _jsx(XStack, { gap: "$2", flexWrap: "wrap", children: BUILTIN_MODS.map((mod) => {
|
|
141
172
|
const active = activeModId === mod.id;
|
|
142
173
|
return (_jsx(Box, { render: _jsx("button", { type: "button" }), ...tap, onClick: () => handleSelectMod(mod), ...CHOICE, py: 6, px: 12, bg: active ? 'var(--edge, var(--white-14))' : 'transparent', borderColor: active ? 'var(--borderColor, var(--white-22))' : 'var(--white-10)', hoverStyle: { bg: '$hover' }, children: _jsxs(XStack, { items: "center", gap: "$1.5", children: [_jsx(Text, { fontSize: "$2", fontWeight: active ? '600' : '400', color: "$ink", children: mod.name }), active ? _jsx(Check, { size: 12, color: "var(--primary)", "aria-hidden": true }) : null] }) }, mod.id));
|
|
143
|
-
}) }), _jsxs(YStack, { gap: "$2", p: "$3", rounded: "$3", borderWidth: 1, borderColor: "$borderColor", children: [_jsxs(XStack, { items: "center", gap: "$2", children: [_jsx(Type, { size: 15, color: "var(--primary)", "aria-hidden": true }), _jsx(Text, { fontSize: "$3", fontWeight: "600", color: "$ink", children: t('Custom Typography') })] }), _jsx(Text, { fontSize: "$2", color: "$soft", children: t('Enter a font family name (e.g. "Zen", "Inter", "Cabinet Grotesk") or a webfont stylesheet URL.') }), _jsxs(XStack, { gap: "$2", items: "center", children: [_jsx(Input, { flex: 1, size: "sm", value: customFont, onChange: (e) => setCustomFont(e.target.value), placeholder: "e.g. Cabinet Grotesk or https://fonts.googleapis.com/..." }), _jsx(Button, { size: "sm", onClick: handleApplyFont, children: fontApplied ? t('Applied!') : t('Apply Font') })] })] }), _jsxs(YStack, { gap: "$2", p: "$3", rounded: "$3", borderWidth: 1, borderColor: "$borderColor", children: [_jsx(Text, { fontSize: "$3", fontWeight: "600", color: "$ink", children: t('Fork & Share Theme Mods') }), _jsx(Text, { fontSize: "$2", color: "$soft", children: t('Export current mod configuration or paste a mod JSON to import.') }), _jsxs(XStack, { gap: "$2", items: "center", children: [_jsx(Input, { flex: 1, size: "sm", value: modJson, onChange: (e) => setModJson(e.target.value), placeholder: t('Paste mod JSON here to import') }), _jsxs(Button, { size: "sm", variant: "outline", onClick: handleImportMod, children: [_jsx(Upload, { size: 13, "aria-hidden": true }), t('Import')] }), _jsxs(Button, { size: "sm", variant: "outline", onClick: () => handleExportMod(BUILTIN_MODS[0]), children: [_jsx(Download, { size: 13, "aria-hidden": true }), copiedMod ? t('Copied!') : t('Export JSON')] })] })] })] }), _jsxs(YStack, { gap: "$2", children: [_jsx(Text, { fontSize: "$4", fontWeight: "600", color: "$ink", children: t('Language') }), _jsx(Text, { fontSize: "$2", color: "$soft", children: t('The language Hanzo is shown in, on every Hanzo surface you sign in to.') }), _jsx(XStack, { pt: "$1", children: _jsx(
|
|
174
|
+
}) }), _jsxs(YStack, { gap: "$2", p: "$3", rounded: "$3", borderWidth: 1, borderColor: "$borderColor", children: [_jsxs(XStack, { items: "center", gap: "$2", children: [_jsx(Type, { size: 15, color: "var(--primary)", "aria-hidden": true }), _jsx(Text, { fontSize: "$3", fontWeight: "600", color: "$ink", children: t('Custom Typography') })] }), _jsx(Text, { fontSize: "$2", color: "$soft", children: t('Enter a font family name (e.g. "Zen", "Inter", "Cabinet Grotesk") or a webfont stylesheet URL.') }), _jsxs(XStack, { gap: "$2", items: "center", children: [_jsx(Input, { flex: 1, size: "sm", value: customFont, onChange: (e) => setCustomFont(e.target.value), placeholder: "e.g. Cabinet Grotesk or https://fonts.googleapis.com/..." }), _jsx(Button, { size: "sm", onClick: handleApplyFont, children: fontApplied ? t('Applied!') : t('Apply Font') })] })] }), _jsxs(YStack, { gap: "$2", p: "$3", rounded: "$3", borderWidth: 1, borderColor: "$borderColor", children: [_jsx(Text, { fontSize: "$3", fontWeight: "600", color: "$ink", children: t('Fork & Share Theme Mods') }), _jsx(Text, { fontSize: "$2", color: "$soft", children: t('Export current mod configuration or paste a mod JSON to import.') }), _jsxs(XStack, { gap: "$2", items: "center", children: [_jsx(Input, { flex: 1, size: "sm", value: modJson, onChange: (e) => setModJson(e.target.value), placeholder: t('Paste mod JSON here to import') }), _jsxs(Button, { size: "sm", variant: "outline", onClick: handleImportMod, children: [_jsx(Upload, { size: 13, "aria-hidden": true }), t('Import')] }), _jsxs(Button, { size: "sm", variant: "outline", onClick: () => handleExportMod(BUILTIN_MODS[0]), children: [_jsx(Download, { size: 13, "aria-hidden": true }), copiedMod ? t('Copied!') : t('Export JSON')] })] })] })] }), _jsxs(YStack, { gap: "$2", children: [_jsx(Text, { fontSize: "$4", fontWeight: "600", color: "$ink", children: t('Language') }), _jsx(Text, { fontSize: "$2", color: "$soft", children: t('The language Hanzo is shown in, on every Hanzo surface you sign in to.') }), _jsx(XStack, { pt: "$1", children: _jsx(CustomLanguageSelect, {}) })] }), _jsxs(YStack, { gap: "$2", "data-slot": "settings-approval-mode", children: [_jsx(Text, { fontSize: "$4", fontWeight: "600", color: "$ink", children: t('Tool & Action Approval') }), _jsx(Text, { fontSize: "$2", color: "$soft", children: t('Control whether tools, connectors, and actions execute automatically or require manual approval first.') }), _jsx(XStack, { gap: "$2", pt: "$1", children: [
|
|
144
175
|
{ id: 'auto', label: t('Auto'), note: t('Runs tools on its own; pauses only for anything risky.') },
|
|
145
176
|
{ id: 'manual', label: t('Manual'), note: t('Asks before each tool, connector or site it opens.') },
|
|
146
177
|
].map((opt) => {
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether the Shell's sidebar is open, kept under App.tsx's key (`hanzo.build.rail`, true when shut) so the
|
|
3
|
+
* column does not jump between /chat and /home.
|
|
4
|
+
*
|
|
5
|
+
* The page is prerendered, so the first pass draws the server's tree (open) and what the reader kept arrives
|
|
6
|
+
* after mount; nothing kept falls back to Hanzo's earlier key `hanzo:sidebar:open`, then the window's width.
|
|
7
|
+
* `away` shuts it for now without keeping that: a pick on a phone is not a choice to keep it shut.
|
|
8
|
+
*/
|
|
9
|
+
export declare function useSidebar(): [boolean, (next: boolean | ((open: boolean) => boolean)) => void, () => void];
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { useEffect, useState } from 'react';
|
|
3
|
+
import { useKept } from './kept.js';
|
|
4
|
+
/**
|
|
5
|
+
* Whether the Shell's sidebar is open, kept under App.tsx's key (`hanzo.build.rail`, true when shut) so the
|
|
6
|
+
* column does not jump between /chat and /home.
|
|
7
|
+
*
|
|
8
|
+
* The page is prerendered, so the first pass draws the server's tree (open) and what the reader kept arrives
|
|
9
|
+
* after mount; nothing kept falls back to Hanzo's earlier key `hanzo:sidebar:open`, then the window's width.
|
|
10
|
+
* `away` shuts it for now without keeping that: a pick on a phone is not a choice to keep it shut.
|
|
11
|
+
*/
|
|
12
|
+
export function useSidebar() {
|
|
13
|
+
const [shut, setShut] = useKept('hanzo.build.rail', null);
|
|
14
|
+
const [started, setStarted] = useState(false);
|
|
15
|
+
const [first, setFirst] = useState(true);
|
|
16
|
+
const [away, setAway] = useState(false);
|
|
17
|
+
useEffect(() => {
|
|
18
|
+
let old = null;
|
|
19
|
+
try {
|
|
20
|
+
old = localStorage.getItem('hanzo:sidebar:open');
|
|
21
|
+
}
|
|
22
|
+
catch {
|
|
23
|
+
// No store is the width of the window, which is a state and not a failure.
|
|
24
|
+
}
|
|
25
|
+
setFirst(old !== null ? old === 'true' : window.innerWidth >= 768);
|
|
26
|
+
setStarted(true);
|
|
27
|
+
}, []);
|
|
28
|
+
const open = !away && (started ? (shut === null ? first : !shut) : true);
|
|
29
|
+
const set = (next) => {
|
|
30
|
+
setAway(false);
|
|
31
|
+
setShut(!(typeof next === 'function' ? next(open) : next));
|
|
32
|
+
};
|
|
33
|
+
return [open, set, () => setAway(true)];
|
|
34
|
+
}
|