@hanzo/app 0.3.94 → 0.3.96

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.
Files changed (110) hide show
  1. package/dist/Account.d.ts +9 -3
  2. package/dist/Account.js +142 -141
  3. package/dist/App.js +71 -37
  4. package/dist/Bar.js +1 -1
  5. package/dist/Betas.d.ts +1 -1
  6. package/dist/Betas.js +16 -22
  7. package/dist/Board.js +114 -48
  8. package/dist/CalScheduler.d.ts +1 -0
  9. package/dist/CalScheduler.js +223 -57
  10. package/dist/Chat.js +432 -153
  11. package/dist/Contacts.js +35 -31
  12. package/dist/ContextMenu.js +126 -42
  13. package/dist/Directory.js +1 -1
  14. package/dist/Drawer.js +1 -1
  15. package/dist/Drive.js +351 -119
  16. package/dist/Gate.js +156 -13
  17. package/dist/Home.js +31 -53
  18. package/dist/Inbox.js +29 -15
  19. package/dist/InlineRename.d.ts +6 -0
  20. package/dist/InlineRename.js +41 -0
  21. package/dist/Learning.js +132 -13
  22. package/dist/Market.js +13 -9
  23. package/dist/Meet.d.ts +5 -0
  24. package/dist/Meet.js +75 -51
  25. package/dist/MoreMenu.d.ts +19 -0
  26. package/dist/MoreMenu.js +33 -0
  27. package/dist/NeedMoreUsage.js +2 -2
  28. package/dist/OrgSwitcher.js +6 -2
  29. package/dist/PreferencesDialog.js +5 -2
  30. package/dist/Rail.d.ts +73 -7
  31. package/dist/Rail.js +372 -111
  32. package/dist/Recents.js +77 -24
  33. package/dist/RightPane.js +2 -2
  34. package/dist/Search.d.ts +13 -1
  35. package/dist/Search.js +366 -50
  36. package/dist/Setup.js +34 -5
  37. package/dist/Shared.js +12 -12
  38. package/dist/Shell.d.ts +10 -0
  39. package/dist/Shell.js +258 -158
  40. package/dist/Sidebar.d.ts +14 -3
  41. package/dist/Sidebar.js +411 -129
  42. package/dist/SkipLink.d.ts +8 -0
  43. package/dist/SkipLink.js +11 -0
  44. package/dist/Start.js +51 -52
  45. package/dist/Terminals.js +159 -11
  46. package/dist/ToBottom.js +1 -1
  47. package/dist/Upgrade.d.ts +8 -3
  48. package/dist/Upgrade.js +194 -103
  49. package/dist/Usage.d.ts +1 -1
  50. package/dist/Usage.js +186 -82
  51. package/dist/WalletPill.js +8 -2
  52. package/dist/Work.js +162 -53
  53. package/dist/archive.d.ts +8 -0
  54. package/dist/archive.js +16 -0
  55. package/dist/bots/Bots.js +16 -1
  56. package/dist/bots/ComputerDialog.js +53 -26
  57. package/dist/bots/ConnectorsDialog.js +34 -15
  58. package/dist/bots/Make.js +5 -1
  59. package/dist/bots/Panel.js +37 -31
  60. package/dist/bots/Roster.d.ts +4 -1
  61. package/dist/bots/Roster.js +71 -25
  62. package/dist/bots/Thread.js +54 -27
  63. package/dist/bots/face.js +9 -3
  64. package/dist/bots/grid.d.ts +36 -0
  65. package/dist/bots/grid.js +91 -0
  66. package/dist/bots/ink.d.ts +1 -1
  67. package/dist/bots/ink.js +1 -1
  68. package/dist/bots/kit.d.ts +9 -4
  69. package/dist/bots/kit.js +3 -2
  70. package/dist/chord.d.ts +13 -0
  71. package/dist/chord.js +30 -1
  72. package/dist/crew.js +47 -4
  73. package/dist/ground.d.ts +2 -2
  74. package/dist/ground.js +3 -3
  75. package/dist/help.d.ts +7 -3
  76. package/dist/help.js +19 -14
  77. package/dist/keys.d.ts +28 -0
  78. package/dist/keys.js +58 -0
  79. package/dist/lib/arrival.d.ts +5 -0
  80. package/dist/lib/arrival.js +10 -0
  81. package/dist/lib/betas.d.ts +2 -0
  82. package/dist/lib/betas.js +10 -0
  83. package/dist/lib/branch.d.ts +11 -0
  84. package/dist/lib/branch.js +11 -0
  85. package/dist/lib/chatPreferences.d.ts +1 -1
  86. package/dist/lib/chatPreferences.js +1 -1
  87. package/dist/lib/dev-mode.d.ts +18 -0
  88. package/dist/lib/dev-mode.js +102 -0
  89. package/dist/lib/durable.d.ts +1 -1
  90. package/dist/lib/durable.js +1 -1
  91. package/dist/lib/info-hint.d.ts +7 -0
  92. package/dist/lib/info-hint.js +8 -0
  93. package/dist/lib/model-picker.d.ts +2 -0
  94. package/dist/lib/model-picker.js +12 -0
  95. package/dist/lib/owners.d.ts +5 -0
  96. package/dist/lib/owners.js +15 -0
  97. package/dist/lib/pay.d.ts +2 -0
  98. package/dist/lib/pay.js +4 -0
  99. package/dist/lib/todo.d.ts +7 -1
  100. package/dist/lib/todo.js +41 -29
  101. package/dist/look.js +39 -8
  102. package/dist/rail-open.d.ts +9 -0
  103. package/dist/rail-open.js +34 -0
  104. package/dist/renaming.d.ts +10 -0
  105. package/dist/renaming.js +25 -0
  106. package/dist/seek.d.ts +6 -1
  107. package/dist/seek.js +13 -0
  108. package/dist/thread.d.ts +2 -1
  109. package/dist/thread.js +85 -44
  110. package/package.json +11 -11
package/dist/ground.js CHANGED
@@ -12,12 +12,12 @@
12
12
  * `!important`: a Dev run's pane steps aside for the two panes inside it by
13
13
  * slot (@hanzo/build's `run-split`), and an important shadow would stay behind.
14
14
  */
15
- export const pane = (fill = 'var(--pane-fill)') => ({
15
+ export const pane = (fill = 'var(--pane-fill, var(--card))') => ({
16
16
  backgroundColor: fill,
17
17
  borderRadius: 'var(--pane-round)',
18
18
  borderWidth: 1,
19
19
  borderStyle: 'solid',
20
- borderColor: 'var(--pane-edge, var(--border))',
20
+ borderColor: 'var(--pane-edge, var(--white-08))',
21
21
  backdropFilter: 'var(--pane-blur)',
22
22
  });
23
23
  /**
@@ -48,7 +48,7 @@ export const RAIL = 2 * INSET;
48
48
  /** The top bar's height, px, on every shell. */
49
49
  export const BAR = 38;
50
50
  /** The sidebar's width before the reader pulls its edge, px. */
51
- export const SIDE = 248;
51
+ export const SIDE = 256;
52
52
  /**
53
53
  * A row INSIDE a pane shares the height of the row it lines up with.
54
54
  */
package/dist/help.d.ts CHANGED
@@ -12,17 +12,21 @@ export interface Page {
12
12
  export declare const pages: () => Page[];
13
13
  /** The agreements under the Help menu's rule. */
14
14
  export declare const legal: () => Page[];
15
+ /** Logical grouping for the keyboard shortcuts sheet. */
16
+ export type KeyGroup = 'Navigation' | 'Workspace' | 'Chat' | 'Window';
15
17
  /** One of the app's keys: what it does (authored English, drawn through `t`), and how a Mac and every other platform spell it. */
16
18
  export interface Key {
17
19
  does: string;
18
20
  mac: string;
19
21
  pc: string;
22
+ group?: KeyGroup;
20
23
  }
21
24
  /**
22
25
  * Every key the app answers, in the order a reader looks for them. Each is
23
- * handled where it acts: App.tsx (⌘K, ⌘, and, in a window, Back and Forward),
24
- * Account.tsx (⌘/), @hanzo/build's panel (⌘.), the composer (Enter, ⌘U), chord.ts
25
- * (the conversation's chords, spelled by `said` so the two cannot drift).
26
+ * handled where it acts: keys.ts, mounted by App.tsx and Shell.tsx (⌘K, ⌘⇧O, ⌘B, ⌘⇧L, ⌘⇧D, ⌘,), App.tsx (
27
+ * in a window, Back and Forward), Account.tsx (⌘/), @hanzo/build's panel (⌘.),
28
+ * the composer (Enter, ⌘U), chord.ts (the conversation's chords, spelled by
29
+ * `said` so the two cannot drift).
26
30
  */
27
31
  export declare const KEYS: Key[];
28
32
  /** The part of a keydown `asked` reads. */
package/dist/help.js CHANGED
@@ -26,22 +26,27 @@ export const legal = () => [
26
26
  ];
27
27
  /**
28
28
  * Every key the app answers, in the order a reader looks for them. Each is
29
- * handled where it acts: App.tsx (⌘K, ⌘, and, in a window, Back and Forward),
30
- * Account.tsx (⌘/), @hanzo/build's panel (⌘.), the composer (Enter, ⌘U), chord.ts
31
- * (the conversation's chords, spelled by `said` so the two cannot drift).
29
+ * handled where it acts: keys.ts, mounted by App.tsx and Shell.tsx (⌘K, ⌘⇧O, ⌘B, ⌘⇧L, ⌘⇧D, ⌘,), App.tsx (
30
+ * in a window, Back and Forward), Account.tsx (⌘/), @hanzo/build's panel (⌘.),
31
+ * the composer (Enter, ⌘U), chord.ts (the conversation's chords, spelled by
32
+ * `said` so the two cannot drift).
32
33
  */
33
34
  export const KEYS = [
34
- { does: phrase('Search chats'), mac: '⌘K', pc: 'Ctrl+K' },
35
- { does: phrase('Settings'), mac: '⌘,', pc: 'Ctrl+,' },
36
- { does: phrase('Keyboard shortcuts'), mac: '⌘/', pc: 'Ctrl+/' },
37
- { does: phrase('Side panel'), mac: '⌘.', pc: 'Ctrl+.' },
38
- { does: phrase('Attach files'), mac: '⌘U', pc: 'Ctrl+U' },
39
- { does: phrase('Send'), mac: 'Enter', pc: 'Enter' },
40
- { does: phrase('New line'), mac: '⇧Enter', pc: 'Shift+Enter' },
41
- { does: phrase('Rename chat'), mac: said('rename', true), pc: said('rename', false) },
42
- { does: phrase('Pin or unpin chat'), mac: said('pin', true), pc: said('pin', false) },
43
- { does: phrase('Back'), mac: '⌘[', pc: 'Alt+←' },
44
- { does: phrase('Forward'), mac: '⌘]', pc: 'Alt+→' },
35
+ { does: phrase('Search chats'), mac: '⌘K', pc: 'Ctrl+K', group: 'Navigation' },
36
+ { does: phrase('New chat'), mac: '⌘⇧O', pc: 'Ctrl+Shift+O', group: 'Navigation' },
37
+ { does: phrase('Settings'), mac: '⌘,', pc: 'Ctrl+,', group: 'Navigation' },
38
+ { does: phrase('Keyboard shortcuts'), mac: '⌘/', pc: 'Ctrl+/', group: 'Navigation' },
39
+ { does: phrase('Toggle sidebar'), mac: '⌘B', pc: 'Ctrl+B', group: 'Workspace' },
40
+ { does: phrase('Side panel'), mac: '⌘.', pc: 'Ctrl+.', group: 'Workspace' },
41
+ { does: phrase('Toggle theme'), mac: '⌘⇧L', pc: 'Ctrl+Shift+L', group: 'Workspace' },
42
+ { does: phrase('Toggle Developer mode'), mac: '⌘⇧D', pc: 'Ctrl+Shift+D', group: 'Workspace' },
43
+ { does: phrase('Attach files'), mac: '⌘U', pc: 'Ctrl+U', group: 'Chat' },
44
+ { does: phrase('Send'), mac: 'Enter', pc: 'Enter', group: 'Chat' },
45
+ { does: phrase('New line'), mac: '⇧Enter', pc: 'Shift+Enter', group: 'Chat' },
46
+ { does: phrase('Rename chat'), mac: said('rename', true), pc: said('rename', false), group: 'Chat' },
47
+ { does: phrase('Pin or unpin chat'), mac: said('pin', true), pc: said('pin', false), group: 'Chat' },
48
+ { does: phrase('Back'), mac: '⌘[', pc: 'Alt+←', group: 'Window' },
49
+ { does: phrase('Forward'), mac: '⌘]', pc: 'Alt+→', group: 'Window' },
45
50
  ];
46
51
  /** Whether a keydown asks for the keyboard shortcuts: ⌘/ or Ctrl+/, once a press. */
47
52
  export const asked = (e) => (e.metaKey || e.ctrlKey) && !e.altKey && !e.repeat && e.key === '/';
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
+ }
@@ -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, Low and Medium, which only Chat offers. */
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, Low and Medium, which only Chat offers. */
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
+ }
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Hanzo Tasks — the durable execution engine — as the board reaches it.
3
3
  *
4
- * TWO SUBSYSTEMS, ONE SEAM, and the seam is the point. `/v1/todo` holds what
4
+ * TWO SUBSYSTEMS, ONE SEAM, and the seam is the point. `/v1/task` holds what
5
5
  * should be done and who holds it; `/v1/tasks` runs work that survives a crash,
6
6
  * event-sourced and replayable. They are not two spellings of one thing: a card
7
7
  * is dragged between columns and a run is replayed, and neither verb makes sense
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Hanzo Tasks — the durable execution engine — as the board reaches it.
3
3
  *
4
- * TWO SUBSYSTEMS, ONE SEAM, and the seam is the point. `/v1/todo` holds what
4
+ * TWO SUBSYSTEMS, ONE SEAM, and the seam is the point. `/v1/task` holds what
5
5
  * should be done and who holds it; `/v1/tasks` runs work that survives a crash,
6
6
  * event-sourced and replayable. They are not two spellings of one thing: a card
7
7
  * is dragged between columns and a run is replayed, and neither verb makes sense
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ export interface InfoHintProps {
3
+ text: string;
4
+ size?: number;
5
+ side?: 'top' | 'right' | 'bottom' | 'left';
6
+ }
7
+ export declare function InfoHint({ text, size, side }: InfoHintProps): React.JSX.Element;
@@ -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,2 @@
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 declare function openModelPicker(): boolean;
@@ -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,5 @@
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 declare function owners(): {
3
+ claim(id: string): () => void;
4
+ owns: (id: string) => boolean;
5
+ };
@@ -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));
@@ -1,5 +1,5 @@
1
1
  /**
2
- * The board's store: `/v1/todo` with resilient local cache fallback.
2
+ * The board's store: `/v1/task` with resilient local cache fallback.
3
3
  *
4
4
  * A card IS a forge issue — the platform's own words: "the column is a LABEL on
5
5
  * the forge, so the board and the forge web UI are the same object seen twice:
@@ -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
@@ -145,7 +145,7 @@ export async function board(client, params = {}, signal) {
145
145
  if (params.scheduled !== undefined)
146
146
  query.scheduled = String(params.scheduled);
147
147
  const out = await client.http.json({
148
- path: '/v1/todo/board',
148
+ path: '/v1/task/board',
149
149
  query,
150
150
  signal,
151
151
  });
@@ -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/task/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
- const todoList = rows(todoPs);
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,12 +242,13 @@ 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 {
237
249
  const created = await client.http.json({
238
250
  method: 'POST',
239
- path: `/v1/todo/projects/${encodeURIComponent(key)}/issues`,
251
+ path: `/v1/task/projects/${encodeURIComponent(key)}/issues`,
240
252
  body: card,
241
253
  signal,
242
254
  });
@@ -276,7 +288,7 @@ export async function edit(client, key, num, patch, signal) {
276
288
  try {
277
289
  const serverUpdated = await client.http.json({
278
290
  method: 'PATCH',
279
- path: `/v1/todo/projects/${encodeURIComponent(key)}/issues/${num}`,
291
+ path: `/v1/task/projects/${encodeURIComponent(key)}/issues/${num}`,
280
292
  body: patch,
281
293
  signal,
282
294
  });
@@ -294,7 +306,7 @@ export async function claim(client, key, num, signal) {
294
306
  try {
295
307
  return await client.http.json({
296
308
  method: 'POST',
297
- path: `/v1/todo/projects/${encodeURIComponent(key)}/issues/${num}/claim`,
309
+ path: `/v1/task/projects/${encodeURIComponent(key)}/issues/${num}/claim`,
298
310
  body: {},
299
311
  signal,
300
312
  });