@hanzo/build 0.2.126 → 0.2.127

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 (57) hide show
  1. package/lib/api/machines.d.ts +8 -0
  2. package/lib/api/machines.js +16 -5
  3. package/lib/api/places.d.ts +12 -4
  4. package/lib/api/places.js +11 -3
  5. package/lib/automations.js +74 -35
  6. package/lib/awake.d.ts +24 -0
  7. package/lib/awake.js +68 -0
  8. package/lib/clipboard.d.ts +2 -0
  9. package/lib/clipboard.js +10 -0
  10. package/lib/customize/agents.js +149 -31
  11. package/lib/customize/connectors.js +91 -34
  12. package/lib/customize/drafted.js +23 -10
  13. package/lib/customize/index.js +40 -10
  14. package/lib/customize/inventory.d.ts +4 -1
  15. package/lib/customize/inventory.js +66 -17
  16. package/lib/customize/plugins.js +43 -15
  17. package/lib/customize/skills.js +87 -23
  18. package/lib/customize/ui.d.ts +29 -3
  19. package/lib/customize/ui.js +89 -12
  20. package/lib/desk.d.ts +1 -1
  21. package/lib/desk.js +67 -40
  22. package/lib/dev-mode.d.ts +22 -0
  23. package/lib/dev-mode.js +80 -0
  24. package/lib/environment.js +4 -4
  25. package/lib/forge.js +97 -24
  26. package/lib/handoff.d.ts +8 -0
  27. package/lib/handoff.js +22 -0
  28. package/lib/index.d.ts +1 -0
  29. package/lib/index.js +1 -0
  30. package/lib/landing.js +100 -25
  31. package/lib/library.js +108 -39
  32. package/lib/make.js +3 -2
  33. package/lib/mind.d.ts +9 -29
  34. package/lib/mind.js +43 -4
  35. package/lib/pane.d.ts +13 -0
  36. package/lib/pane.js +4 -0
  37. package/lib/panel.d.ts +4 -0
  38. package/lib/panel.js +49 -46
  39. package/lib/plans.js +36 -15
  40. package/lib/project.js +72 -63
  41. package/lib/reply.d.ts +6 -1
  42. package/lib/reply.js +19 -9
  43. package/lib/run.js +23 -41
  44. package/lib/scheduled.js +36 -16
  45. package/lib/settings/account.js +2 -1
  46. package/lib/settings/billing.js +9 -4
  47. package/lib/settings/credits.d.ts +2 -1
  48. package/lib/settings/credits.js +2 -2
  49. package/lib/settings/machines.js +41 -18
  50. package/lib/settings/notifications.js +2 -1
  51. package/lib/shelf.d.ts +4 -1
  52. package/lib/shelf.js +79 -14
  53. package/lib/suggestions.js +2 -1
  54. package/lib/summary.js +3 -2
  55. package/lib/sync.js +3 -3
  56. package/lib/transcript.js +13 -6
  57. package/package.json +11 -1
package/lib/scheduled.js CHANGED
@@ -18,13 +18,14 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
18
18
  * are drawn as given.
19
19
  */
20
20
  import { SizableText, XStack, YStack } from '@hanzo/gui';
21
- import { Clock, ExternalLink, MoreHorizontal, Pencil, Play, Plus, ScrollText, Trash2 } from '@hanzogui/lucide-icons-2';
21
+ import { ChevronDown, ChevronRight, Clock, ExternalLink, MoreHorizontal, Pencil, Play, Plus, ScrollText, Trash2 } from '@hanzogui/lucide-icons-2';
22
22
  import { useI18n } from '@hanzo/i18n/react';
23
- import { Button, DropdownMenu, Input, Switch, Textarea } from '@hanzo/ui';
23
+ import { Button, DropdownMenu, Input, Skeleton, Switch, Textarea, toast } from '@hanzo/ui';
24
24
  import { StatusDot } from '@hanzo/ui/chat';
25
25
  import { ModelPicker } from '@hanzo/ui/models';
26
26
  import { useLimits } from '@hanzo/ui/product/useLimits';
27
27
  import { useEffect, useMemo, useRef, useState } from 'react';
28
+ import { RING, RING_INSET } from './pane.js';
28
29
  import { automations, create, cron, events, jobs, remove, save, start, words } from './api/auto.js';
29
30
  import { Refusal, told } from './api/call.js';
30
31
  import { ENSO, limits as readLimits, models } from './api/models.js';
@@ -109,9 +110,11 @@ export function Scheduled() {
109
110
  useEffect(() => setTasks(tasks.value), [tasks.value]);
110
111
  useEffect(() => setRuns(runs.value), [runs.value]);
111
112
  const [problem, setProblem] = useState('');
113
+ const [problemError, setProblemError] = useState(false);
112
114
  const [making, setMaking] = useState(null);
113
115
  const [deleting, setDeleting] = useState(null);
114
116
  const [looking, setLooking] = useState(null);
117
+ const [allActivity, setAllActivity] = useState(false);
115
118
  const [now, setNow] = useState(() => Date.now());
116
119
  // Dev's "Schedule this" arrives with the prompt the sheet starts from.
117
120
  useEffect(() => {
@@ -136,31 +139,45 @@ export function Scheduled() {
136
139
  }, [signed, live]);
137
140
  const act = async (what, work) => {
138
141
  setProblem('');
142
+ setProblemError(false);
139
143
  try {
140
144
  await work();
141
145
  }
142
146
  catch (e) {
143
147
  setProblem(unplanned(e) ? t(PLAN) : t('{name}: {error}', { name: what, error: told(e, t) }));
148
+ setProblemError(true);
144
149
  }
145
150
  };
146
151
  const flip = (a, on) => act(a.name, async () => {
147
152
  const next = await save(target, a.id, { enabled: on });
148
153
  setTasks((was) => was.map((x) => (x.id === next.id ? next : x)));
154
+ toast.success(on ? t('{name} turned on', { name: a.name }) : t('{name} paused', { name: a.name }));
149
155
  });
150
156
  const run = (a) => act(a.name, async () => {
151
157
  const r = await start(target, a.id);
152
- if (r.status === 'skipped')
158
+ if (r.status === 'skipped') {
153
159
  setProblem(t('{name}: not started, the previous run is still going.', { name: a.name }));
160
+ setProblemError(true);
161
+ }
162
+ else {
163
+ toast.success(t('Started {name}', { name: a.name }));
164
+ }
154
165
  setTick((n) => n + 1);
155
166
  });
156
167
  const edit = (id) => host.go(path({ kind: 'automation', id }));
157
- return (_jsxs(YStack, { flex: 1, minH: 0, overflow: "scroll", px: "$6", py: "$6", "$max-md": { px: '$4', py: '$4' }, children: [_jsxs(YStack, { width: "100%", maxW: 880, mx: "auto", gap: "$5", children: [_jsxs(XStack, { justify: "space-between", items: "flex-start", gap: "$4", children: [_jsxs(YStack, { gap: "$1", flex: 1, minW: 0, children: [_jsx(SizableText, { render: "h1", size: "$7", fontWeight: "600", color: "$ink", children: t('Scheduled tasks') }), _jsx(SizableText, { size: "$2", color: "$soft", children: t('What runs without you watching: prompts on a schedule, background runs, Studio renders and workflows.') })] }), _jsxs(Button, { size: "sm", shrink: 0, disabled: !signed, onPress: () => setMaking(''), children: [_jsx(Plus, { size: 14 }), t('New task')] })] }), _jsx(Line, { children: problem }), _jsxs(YStack, { gap: "$2", children: [_jsx(SizableText, { render: "h2", size: "$3", color: "$ink", fontWeight: "500", children: t('Tasks') }), !signed ? (_jsx(Said, { says: t('Sign in to see your scheduled tasks.'), children: _jsx(Button, { size: "sm", onPress: () => host.signIn?.(), children: t('Sign in') }) })) : tasks.error && !shownTasks.length ? (_jsx(Said, { says: told(tasks.error, t) })) : tasks.loading && !shownTasks.length ? (_jsx(Said, { says: t('Reading your tasks…') })) : !shownTasks.length ? (_jsx(Said, { says: t('No scheduled tasks yet. Ask Chat or Dev to do something on a schedule, or start one here.'), children: _jsx(Button, { size: "sm", onPress: () => setMaking(''), children: t('New task') }) })) : (_jsx(YStack, { role: "list", "aria-label": t('Your tasks'), borderWidth: 1, borderColor: "$borderColor", rounded: "$4", overflow: "hidden", children: shownTasks.map((a, i) => (_jsx(Task, { a: a, first: i === 0, onOpen: () => edit(a.id), onSwitch: (on) => void flip(a, on), onRun: () => void run(a), onDelete: () => setDeleting(a) }, a.id))) }))] }), signed ? (_jsxs(YStack, { gap: "$2", children: [_jsxs(XStack, { items: "center", gap: "$2", children: [_jsx(SizableText, { render: "h2", size: "$3", color: "$ink", fontWeight: "500", flex: 1, children: t('Activity') }), _jsx(SizableText, { size: "$1", color: "$soft", children: live ? t('Live') : '' })] }), runs.error && !shownRuns.length ? (_jsx(Said, { says: told(runs.error, t) })) : runs.loading && !shownRuns.length ? (_jsx(Said, { says: t('Reading what ran…') })) : !shownRuns.length ? (_jsx(Said, { says: t("Nothing has run yet. A task's runs, Dev's background runs and Studio's renders show here as they go.") })) : (_jsx(YStack, { role: "list", "aria-label": t('Activity'), borderWidth: 1, borderColor: "$borderColor", rounded: "$4", overflow: "hidden", children: shownRuns.map((j, i) => (_jsx(Ran, { j: j, first: i === 0, now: now, onOpen: () => setLooking(j) }, j.id))) }))] })) : null] }), _jsx(Make, { prompt: making, onClose: () => setMaking(null), onMade: (a) => {
168
+ const activityCap = 10;
169
+ const activityOverflow = shownRuns.length > activityCap;
170
+ const visibleRuns = !allActivity && activityOverflow ? shownRuns.slice(0, activityCap) : shownRuns;
171
+ return (_jsxs(YStack, { flex: 1, minH: 0, overflow: "scroll", px: "$6", py: "$6", "$max-md": { px: '$4', py: '$4' }, children: [_jsxs(YStack, { width: "100%", maxW: 880, mx: "auto", gap: "$5", children: [_jsxs(XStack, { justify: "space-between", items: "flex-start", gap: "$4", children: [_jsxs(YStack, { gap: "$1", flex: 1, minW: 0, children: [_jsx(SizableText, { render: "h1", size: "$7", fontWeight: "600", color: "$ink", children: t('Scheduled tasks') }), _jsx(SizableText, { size: "$2", color: "$soft", children: t('What runs without you watching: prompts on a schedule, background runs, Studio renders and workflows.') })] }), _jsxs(Button, { size: "sm", shrink: 0, disabled: !signed, onPress: () => setMaking(''), children: [_jsx(Plus, { size: 14 }), t('New task')] })] }), problem ? (_jsx(SizableText, { size: "$2", color: problemError ? 'var(--state-error)' : '$soft', role: "status", children: problem })) : null, _jsxs(YStack, { gap: "$2", children: [_jsx(SizableText, { render: "h2", size: "$3", color: "$ink", fontWeight: "500", children: t('Tasks') }), !signed ? (_jsx(Said, { says: t('Sign in to see your scheduled tasks.'), children: _jsx(Button, { size: "sm", onPress: () => host.signIn?.(), children: t('Sign in') }) })) : tasks.error && !shownTasks.length ? (_jsx(Said, { says: told(tasks.error, t), error: true, children: _jsx(Button, { size: "sm", variant: "outline", borderColor: "var(--border-strong)", onPress: () => setTick((n) => n + 1), children: t('Try again') }) })) : tasks.loading && !shownTasks.length ? (_jsxs(YStack, { gap: "$2.5", "aria-busy": true, children: [_jsx(SizableText, { size: "$2", color: "$soft", children: t('Reading your tasks…') }), _jsx(YStack, { borderWidth: 1, borderColor: "$borderColor", rounded: "$4", bg: "$panel", overflow: "hidden", children: [0, 1, 2].map((i) => (_jsxs(XStack, { items: "center", gap: "$3", px: "$3", py: "$3", borderTopWidth: i ? 1 : 0, borderColor: "$borderColor", children: [_jsx(Skeleton, { layout: "block", width: 32, height: 32, rounded: "$3", shrink: 0 }), _jsxs(YStack, { flex: 1, gap: "$1.5", children: [_jsx(Skeleton, { layout: "block", width: "42%", height: 14, rounded: "$2" }), _jsx(Skeleton, { layout: "block", width: "58%", height: 12, rounded: "$2" })] }), _jsx(Skeleton, { layout: "block", width: 36, height: 20, rounded: 999, shrink: 0 })] }, i))) })] })) : !shownTasks.length ? (_jsx(Said, { says: t('No scheduled tasks yet. Ask Chat or Dev to do something on a schedule, or start one here.'), children: _jsxs(Button, { size: "sm", variant: "primary", onPress: () => setMaking(''), children: [_jsx(Plus, { size: 14 }), t('New task')] }) })) : (_jsx(YStack, { role: "list", "aria-label": t('Your tasks'), borderWidth: 1, borderColor: "$borderColor", rounded: "$4", overflow: "hidden", children: shownTasks.map((a, i) => (_jsx(Task, { a: a, first: i === 0, onOpen: () => edit(a.id), onSwitch: (on) => void flip(a, on), onRun: () => void run(a), onDelete: () => setDeleting(a) }, a.id))) }))] }), signed ? (_jsxs(YStack, { gap: "$2", children: [_jsxs(XStack, { items: "center", gap: "$2", children: [_jsx(SizableText, { render: "h2", size: "$3", color: "$ink", fontWeight: "500", flex: 1, children: t('Activity') }), live ? (_jsxs(XStack, { items: "center", gap: "$1.5", children: [_jsx(YStack, { width: 6, height: 6, rounded: 99, bg: "var(--state-online)" }), _jsx(SizableText, { size: "$1", color: "$soft", children: t('Live') })] })) : null] }), runs.error && !shownRuns.length ? (_jsx(Said, { says: told(runs.error, t), error: true, children: _jsx(Button, { size: "sm", variant: "outline", borderColor: "var(--border-strong)", onPress: () => setTick((n) => n + 1), children: t('Try again') }) })) : runs.loading && !shownRuns.length ? (_jsxs(YStack, { gap: "$2.5", "aria-busy": true, children: [_jsx(SizableText, { size: "$2", color: "$soft", children: t('Reading what ran…') }), _jsx(YStack, { borderWidth: 1, borderColor: "$borderColor", rounded: "$4", bg: "$panel", overflow: "hidden", children: [0, 1, 2, 3].map((i) => (_jsxs(XStack, { items: "center", gap: "$3", px: "$3", py: "$2.5", borderTopWidth: i ? 1 : 0, borderColor: "$borderColor", children: [_jsx(Skeleton, { layout: "block", width: 10, height: 10, rounded: 999, shrink: 0 }), _jsxs(YStack, { flex: 1, gap: "$1.5", children: [_jsx(Skeleton, { layout: "block", width: "46%", height: 14, rounded: "$2" }), _jsx(Skeleton, { layout: "block", width: "34%", height: 12, rounded: "$2" })] }), _jsx(Skeleton, { layout: "block", width: 54, height: 12, rounded: "$2", shrink: 0 })] }, i))) })] })) : !shownRuns.length ? (_jsx(Said, { says: t("Nothing has run yet. A task's runs, Dev's background runs and Studio's renders show here as they go.") })) : (_jsxs(YStack, { gap: "$2", children: [_jsx(YStack, { role: "list", "aria-label": t('Activity'), borderWidth: 1, borderColor: "$borderColor", rounded: "$4", bg: "$panel", overflow: "hidden", children: visibleRuns.map((j, i) => (_jsx(Ran, { j: j, first: i === 0, now: now, onOpen: () => setLooking(j) }, j.id))) }), activityOverflow ? (_jsx(XStack, { children: _jsx(XStack, { render: "button", "aria-expanded": allActivity, onPress: () => setAllActivity((v) => !v), px: "$2.5", py: "$1.5", minH: 32, items: "center", focusVisibleStyle: RING, children: _jsx(SizableText, { size: "$1", fontWeight: "500", color: "$soft", children: allActivity ? t('Show fewer runs') : t('Show all {n} runs', { n: shownRuns.length }) }) }) })) : null] }))] })) : null] }), _jsx(Make, { prompt: making, onClose: () => setMaking(null), onMade: (a) => {
158
172
  setTasks((was) => [a, ...was.filter((x) => x.id !== a.id)]);
173
+ setProblemError(false);
159
174
  setProblem(t('Scheduled: {name}.', { name: a.name }));
160
175
  } }), _jsx(Detail, { j: looking, onClose: () => setLooking(null), now: now }), deleting ? (_jsx(Confirm, { what: deleting.name, says: t('It stops running, and its schedule and its runs go with it. A run going now is stopped.'), open: true, onOpenChange: (o) => !o && setDeleting(null), onYes: async () => {
161
- await remove(target, deleting.id);
162
- setTasks((was) => was.filter((x) => x.id !== deleting.id));
176
+ const dead = deleting;
177
+ await remove(target, dead.id);
178
+ setTasks((was) => was.filter((x) => x.id !== dead.id));
163
179
  setDeleting(null);
180
+ toast.success(t('{name} deleted', { name: dead.name }));
164
181
  } })) : null] }));
165
182
  }
166
183
  /** One task: what it is and when it runs next, its switch, and its menu. */
@@ -169,16 +186,17 @@ function Task({ a, first, onOpen, onSwitch, onRun, onDelete }) {
169
186
  const when = a.draft
170
187
  ? t('Needs instructions')
171
188
  : [words(a.schedule, t), a.enabled && a.next ? t('next {when}', { when: local(a.next) }) : a.schedule.kind !== 'manual' && !a.enabled ? t('paused') : ''].filter(Boolean).join(' · ');
172
- return (_jsxs(XStack, { role: "listitem", items: "center", gap: "$3", px: "$3", py: "$3", borderTopWidth: first ? 0 : 1, borderColor: "$borderColor", hoverStyle: { bg: '$hover' }, children: [_jsxs(XStack, { render: "button", "aria-label": t('Open {name}', { name: a.name }), onPress: onOpen, flex: 1, minW: 0, items: "center", gap: "$3", cursor: "pointer", "$platform-web": { textAlign: 'start' }, children: [_jsx(YStack, { width: 32, height: 32, rounded: "$3", bg: "$raised", items: "center", justify: "center", shrink: 0, "aria-hidden": true, children: _jsx(Clock, { size: 16 }) }), _jsxs(YStack, { flex: 1, minW: 0, gap: "$0.5", children: [_jsxs(XStack, { items: "center", gap: "$2", minW: 0, children: [_jsx(SizableText, { size: "$2", color: "$ink", numberOfLines: 1, shrink: 1, children: a.name }), _jsx(Badge, { children: t(SOURCE[a.source]) }), a.draft ? _jsx(Badge, { children: t('Draft') }) : null] }), _jsx(SizableText, { size: "$1", color: "$soft", numberOfLines: 1, children: when })] })] }), _jsx(Switch, { checked: a.enabled, disabled: a.draft, onCheckedChange: onSwitch, "aria-label": t('{name} on', { name: a.name }) }), _jsx(DropdownMenu, { trigger: _jsx(XStack, { render: "button", "aria-label": t('Actions for {name}', { name: a.name }), width: 30, height: 30, items: "center", justify: "center", rounded: "$2", hoverStyle: { bg: '$hover' }, cursor: "pointer", children: _jsx(MoreHorizontal, { size: 16 }) }), items: [
173
- ...(a.draft ? [] : [{ key: 'run', label: t('Run now'), icon: _jsx(Play, { size: 16 }), onSelect: onRun }]),
174
- { key: 'edit', label: t('Edit'), icon: _jsx(Pencil, { size: 16 }), onSelect: onOpen },
175
- { key: 'delete', label: t('Delete'), icon: _jsx(Trash2, { size: 16 }), onSelect: onDelete },
176
- ] })] }));
189
+ return (_jsxs(XStack, { role: "listitem", items: "center", gap: "$2.5", pr: "$2.5", borderTopWidth: first ? 0 : 1, borderColor: "$borderColor", hoverStyle: { bg: '$hover' }, children: [_jsxs(XStack, { render: "button", "aria-label": t('Open {name}', { name: a.name }), onPress: onOpen, flex: 1, minW: 0, minH: 44, px: "$3", py: "$3", items: "center", gap: "$3", "$platform-web": { textAlign: 'start' }, focusVisibleStyle: RING_INSET, children: [_jsx(YStack, { width: 32, height: 32, rounded: "$3", bg: "$raised", items: "center", justify: "center", shrink: 0, "aria-hidden": true, children: _jsx(Clock, { size: 16 }) }), _jsxs(YStack, { flex: 1, minW: 0, gap: "$0.5", children: [_jsxs(XStack, { items: "center", gap: "$2", minW: 0, children: [_jsx(SizableText, { size: "$2", color: "$ink", numberOfLines: 1, shrink: 1, children: a.name }), _jsx(Badge, { children: t(SOURCE[a.source]) }), a.draft ? _jsx(Badge, { children: t('Draft') }) : null] }), _jsx(SizableText, { size: "$1", color: "$soft", numberOfLines: 1, children: when })] })] }), _jsxs(XStack, { shrink: 0, items: "center", gap: "$1.5", children: [_jsx(Switch, { checked: a.enabled, disabled: a.draft, onCheckedChange: onSwitch, "aria-label": t('{name} on', { name: a.name }) }), _jsx(DropdownMenu, { trigger: _jsx(XStack, { render: "button", "aria-label": t('Actions for {name}', { name: a.name }), width: 32, height: 32, items: "center", justify: "center", focusVisibleStyle: RING, children: _jsx(MoreHorizontal, { size: 16, color: "$soft" }) }), items: [
190
+ ...(a.draft ? [] : [{ key: 'run', label: t('Run now'), icon: _jsx(Play, { size: 14 }), onSelect: onRun }]),
191
+ { key: 'edit', label: t('Edit'), icon: _jsx(Pencil, { size: 14 }), onSelect: onOpen },
192
+ { type: 'separator' },
193
+ { key: 'delete', label: t('Delete'), icon: _jsx(Trash2, { size: 14 }), destructive: true, onSelect: onDelete },
194
+ ] })] })] }));
177
195
  }
178
196
  /** One run in Activity. */
179
197
  function Ran({ j, first, now, onOpen }) {
180
198
  const { t } = useI18n();
181
- return (_jsx(XStack, { role: "listitem", borderTopWidth: first ? 0 : 1, borderColor: "$borderColor", hoverStyle: { bg: '$hover' }, children: _jsxs(XStack, { render: "button", "aria-label": t('{title}: {state}', { title: j.title, state: t(SAID[j.state]) }), onPress: onOpen, flex: 1, minW: 0, items: "center", gap: "$3", px: "$3", py: "$2.5", cursor: "pointer", "$platform-web": { textAlign: 'start' }, children: [_jsx(StatusDot, { status: DOTS[j.state] }), _jsxs(YStack, { flex: 1, minW: 0, gap: "$0.5", children: [_jsx(SizableText, { size: "$2", color: "$ink", numberOfLines: 1, children: j.title }), _jsx(SizableText, { size: "$1", color: "$soft", numberOfLines: 1, children: about(j, now, t) })] }), _jsx(SizableText, { size: "$1", color: "$soft", shrink: 0, children: j.state === 'running' && j.progress !== null ? `${Math.round(j.progress * 100)}%` : t(SAID[j.state]) })] }) }));
199
+ return (_jsx(XStack, { role: "listitem", borderTopWidth: first ? 0 : 1, borderColor: "$borderColor", hoverStyle: { bg: '$hover' }, children: _jsxs(XStack, { render: "button", "aria-label": t('{title}: {state}', { title: j.title, state: t(SAID[j.state]) }), onPress: onOpen, flex: 1, minW: 0, items: "center", gap: "$3", px: "$3", py: "$2.5", cursor: "pointer", "$platform-web": { textAlign: 'start' }, children: [_jsx(StatusDot, { status: DOTS[j.state] }), _jsxs(YStack, { flex: 1, minW: 0, gap: "$0.5", children: [_jsx(SizableText, { size: "$2", color: "$ink", numberOfLines: 1, children: j.title }), _jsx(SizableText, { size: "$1", color: "$soft", numberOfLines: 1, children: about(j, now, t) })] }), _jsx(SizableText, { size: "$1", color: "$soft", shrink: 0, fontVariant: ['tabular-nums'], children: j.state === 'running' && j.progress !== null ? `${Math.round(j.progress * 100)}%` : t(SAID[j.state]) })] }) }));
182
200
  }
183
201
  /** One run, opened: how it went, its log, what it made and what it cost. */
184
202
  function Detail({ j, onClose, now }) {
@@ -189,7 +207,7 @@ function Detail({ j, onClose, now }) {
189
207
  [t('Started'), j.started ? local(j.started) : '—'],
190
208
  [t('Took'), lasted(j.started, j.finished, now) || '—'],
191
209
  [t('Cost'), j.cost !== null ? dollars(j.cost) : t('Not known yet')],
192
- ] }), j.error ? (_jsx(SizableText, { size: "$2", color: "$soft", style: { whiteSpace: 'pre-wrap' }, children: j.error })) : null, j.summary ? (_jsx(SizableText, { size: "$2", color: "$ink", style: { whiteSpace: 'pre-wrap' }, children: j.summary })) : null, j.outputs.length ? (_jsxs(YStack, { gap: "$1", children: [_jsx(SizableText, { size: "$2", color: "$soft", children: t('What it made') }), _jsx(Outputs, { ids: j.outputs })] })) : null, _jsxs(XStack, { gap: "$2", flexWrap: "wrap", rowGap: "$2", children: [j.session ? (_jsxs(Button, { size: "sm", variant: "outline", onPress: () => host.go(j.session), children: [_jsx(ScrollText, { size: 14 }), t('Open its log')] })) : null, j.origin ? (_jsxs(Button, { size: "sm", variant: "outline", onPress: () => host.open(j.origin), children: [_jsx(ExternalLink, { size: 14 }), t('Open where it runs')] })) : null, j.automation ? (_jsxs(Button, { size: "sm", variant: "ghost", onPress: () => host.go(path({ kind: 'automation', id: j.automation })), children: [_jsx(Pencil, { size: 14 }), t('Edit the task')] })) : null] })] })) : null }));
210
+ ] }), j.error ? (_jsx(SizableText, { size: "$2", color: "var(--state-error)", "$platform-web": { whiteSpace: 'pre-wrap' }, children: j.error })) : null, j.summary ? (_jsx(SizableText, { size: "$2", color: "$ink", "$platform-web": { whiteSpace: 'pre-wrap' }, children: j.summary })) : null, j.outputs.length ? (_jsxs(YStack, { gap: "$1", children: [_jsx(SizableText, { size: "$2", color: "$soft", children: t('What it made') }), _jsx(Outputs, { ids: j.outputs })] })) : null, _jsxs(XStack, { gap: "$2", flexWrap: "wrap", rowGap: "$2", children: [j.session ? (_jsxs(Button, { size: "sm", variant: "outline", onPress: () => host.go(j.session), children: [_jsx(ScrollText, { size: 14 }), t('Open its log')] })) : null, j.origin ? (_jsxs(Button, { size: "sm", variant: "outline", onPress: () => host.open(j.origin), children: [_jsx(ExternalLink, { size: 14 }), t('Open where it runs')] })) : null, j.automation ? (_jsxs(Button, { size: "sm", variant: "ghost", onPress: () => host.go(path({ kind: 'automation', id: j.automation })), children: [_jsx(Pencil, { size: 14 }), t('Edit the task')] })) : null] })] })) : null }));
193
211
  }
194
212
  /** A new task: what it does, when in plain words, and the model it thinks with. */
195
213
  function Make({ prompt, onClose, onMade }) {
@@ -208,6 +226,7 @@ function Make({ prompt, onClose, onMade }) {
208
226
  const [picking, setPicking] = useState(false);
209
227
  const [picked, setPicked] = useState(() => shaped('daily', { kind: 'manual' }));
210
228
  const [model, setModel] = useState(null);
229
+ const [advanced, setAdvanced] = useState(false);
211
230
  const [busy, setBusy] = useState(false);
212
231
  const [note, setNote] = useState('');
213
232
  const catalog = useRead(signed && open ? () => models(target) : null, [], [target, signed, open]);
@@ -222,6 +241,7 @@ function Make({ prompt, onClose, onMade }) {
222
241
  setRead(null);
223
242
  setUnread(null);
224
243
  setPicking(false);
244
+ setAdvanced(false);
225
245
  setNote('');
226
246
  }, [prompt]);
227
247
  // The words are read once the typing settles; the answer is said back before anything is made.
@@ -279,7 +299,7 @@ function Make({ prompt, onClose, onMade }) {
279
299
  }
280
300
  };
281
301
  const heard = useMemo(() => (read ? [read.says || words(read.schedule, t), read.next ? t('next {when}', { when: local(read.next) }) : ''].filter(Boolean).join(' · ') : ''), [read, t]);
282
- return (_jsx(Sheet, { title: t('New task'), open: open, onOpenChange: (o) => !o && !busy && onClose(), width: 560, children: _jsxs(YStack, { gap: "$4", children: [_jsx(Field, { label: t('Name'), children: _jsx(Input, { value: name, onChangeText: setName, placeholder: t('Monday summary'), "aria-label": t('Task name') }) }), _jsx(Field, { label: t('What it does'), hint: t('Each run is one Dev run in this organization, as you. It reads and proposes; it changes nothing on its own.'), children: _jsx(Textarea, { value: asks, onChangeText: setAsks, placeholder: t('Summarize what changed in my repositories this week, and what needs me.'), "aria-label": t('What it does'), rows: 5 }) }), _jsx(Field, { label: t('When'), hint: picking ? undefined : t('In your own words: every weekday at 8am, every 5 minutes, first of the month.'), children: picking ? (_jsxs(YStack, { gap: "$2", children: [_jsx(When, { s: picked, onChange: setPicked }), _jsx(XStack, { children: _jsx(Button, { size: "sm", variant: "ghost", onPress: () => setPicking(false), children: t('Say it instead') }) })] })) : (_jsxs(YStack, { gap: "$2", children: [_jsx(Input, { value: said, onChangeText: setSaid, placeholder: t('Every Monday at 9am'), "aria-label": t('When it runs') }), _jsx(SizableText, { size: "$1", color: unread ? '$soft' : '$ink', role: "status", minH: 18, children: reading ? t('Reading…') : unread ? `${told(unread, t)} ${t('Choose instead, or say it another way.')}` : heard }), _jsx(XStack, { children: _jsx(Button, { size: "sm", variant: "ghost", onPress: () => setPicking(true), children: t('Choose instead') }) })] })) }), _jsx(Field, { label: t('Model'), children: _jsx(XStack, { children: _jsx(ModelPicker, { size: "sm", name: t('Model'), models: catalog.value, scope: "chat", limits: limits, value: model ?? ENSO, onChange: (id) => setModel(id === ENSO ? null : id), loading: catalog.loading, error: catalog.error ? told(catalog.error, t) : null }) }) }), _jsx(Line, { children: note }), _jsxs(XStack, { gap: "$2", justify: "flex-end", children: [_jsx(Button, { size: "sm", variant: "ghost", disabled: busy, onPress: onClose, children: t('Cancel') }), _jsx(Button, { size: "sm", disabled: busy || !signed, onPress: () => void make(), children: busy ? t('Creating…') : t('Create') })] })] }) }));
302
+ return (_jsx(Sheet, { title: t('New task'), open: open, onOpenChange: (o) => !o && !busy && onClose(), width: 560, children: _jsxs(YStack, { gap: "$4", children: [_jsx(Field, { label: t('Name'), children: _jsx(Input, { value: name, onChangeText: setName, placeholder: t('Monday summary'), "aria-label": t('Task name') }) }), _jsx(Field, { label: t('What it does'), hint: t('Each run is one Dev run in this organization, as you. It reads and proposes; it changes nothing on its own.'), children: _jsx(Textarea, { value: asks, onChangeText: setAsks, placeholder: t('Summarize what changed in my repositories this week, and what needs me.'), "aria-label": t('What it does'), rows: 5 }) }), _jsx(Field, { label: t('When'), hint: picking ? undefined : t('In your own words: every weekday at 8am, every 5 minutes, first of the month.'), children: picking ? (_jsxs(YStack, { gap: "$2", children: [_jsx(When, { s: picked, onChange: setPicked }), _jsx(XStack, { children: _jsx(Button, { size: "sm", variant: "ghost", onPress: () => setPicking(false), children: t('Say it instead') }) })] })) : (_jsxs(YStack, { gap: "$2", children: [_jsx(Input, { value: said, onChangeText: setSaid, placeholder: t('Every Monday at 9am'), "aria-label": t('When it runs') }), _jsx(SizableText, { size: "$1", color: unread ? '$soft' : '$ink', role: "status", minH: 18, children: reading ? t('Reading…') : unread ? `${told(unread, t)} ${t('Choose instead, or say it another way.')}` : heard }), _jsx(XStack, { children: _jsx(Button, { size: "sm", variant: "ghost", onPress: () => setPicking(true), children: t('Choose instead') }) })] })) }), _jsxs(YStack, { gap: "$2", children: [_jsxs(XStack, { render: "button", "aria-expanded": advanced, onPress: () => setAdvanced((v) => !v), items: "center", gap: "$1.5", self: "flex-start", px: "$2", ml: "$-2", minH: 32, focusVisibleStyle: RING, children: [advanced ? _jsx(ChevronDown, { size: 14, color: "$soft" }) : _jsx(ChevronRight, { size: 14, color: "$soft" }), _jsx(SizableText, { size: "$2", color: "$soft", children: model ? t('Model · {name}', { name: catalog.value.find((m) => m.id === model)?.name ?? model }) : t('Advanced options') })] }), advanced ? (_jsx(YStack, { p: "$3", rounded: "$3", borderWidth: 1, borderColor: "$borderColor", bg: "$panel", children: _jsx(Field, { label: t('Model'), children: _jsx(XStack, { children: _jsx(ModelPicker, { size: "sm", name: t('Model'), models: catalog.value, scope: "chat", limits: limits, value: model ?? ENSO, onChange: (id) => setModel(id === ENSO ? null : id), loading: catalog.loading, error: catalog.error ? told(catalog.error, t) : null }) }) }) })) : null] }), _jsx(Line, { children: note }), _jsxs(XStack, { gap: "$2", justify: "flex-end", children: [_jsx(Button, { size: "sm", variant: "ghost", disabled: busy, onPress: onClose, children: t('Cancel') }), _jsx(Button, { size: "sm", disabled: busy || !signed, onPress: () => void make(), children: busy ? t('Creating…') : t('Create') })] })] }) }));
283
303
  }
284
304
  function Badge({ children }) {
285
305
  return (_jsx(SizableText, { size: "$1", color: "$soft", px: "$1.5", rounded: "$2", borderWidth: 1, borderColor: "$borderColor", shrink: 0, children: children }));
@@ -287,6 +307,6 @@ function Badge({ children }) {
287
307
  function Facts({ rows }) {
288
308
  return (_jsx(YStack, { gap: "$1", children: rows.map(([k, v]) => (_jsxs(XStack, { gap: "$3", children: [_jsx(SizableText, { size: "$1", color: "$soft", width: 72, children: k }), _jsx(SizableText, { size: "$1", color: "$ink", flex: 1, children: v })] }, k))) }));
289
309
  }
290
- function Said({ says, children }) {
291
- return (_jsxs(YStack, { borderWidth: 1, borderColor: "$borderColor", rounded: "$4", px: "$4", py: "$8", gap: "$3", items: "center", children: [_jsx(SizableText, { size: "$2", color: "$soft", style: { textAlign: 'center' }, children: says }), children] }));
310
+ function Said({ says, error = false, children }) {
311
+ return (_jsxs(YStack, { borderWidth: 1, borderColor: "var(--border-strong)", bg: "$panel", rounded: "$4", px: "$5", py: "$8", gap: "$3", items: "center", children: [_jsx(SizableText, { size: "$2", color: error ? 'var(--state-error)' : '$soft', text: "center", children: says }), children] }));
292
312
  }
@@ -19,6 +19,7 @@ import { ChipSelect } from '@hanzo/ui/product';
19
19
  import { useEffect, useRef, useState } from 'react';
20
20
  import { told } from '../api/call.js';
21
21
  import { PHOTO, photo, rename } from '../api/profile.js';
22
+ import { copy } from '../clipboard.js';
22
23
  import { useHost, useTarget } from '../host.js';
23
24
  import { usePrefs } from '../prefs.js';
24
25
  import { Card, Field, Group, Heading, Note, Row, Soft } from './ui.js';
@@ -119,5 +120,5 @@ export function Account() {
119
120
  input.value = '';
120
121
  if (file)
121
122
  void upload(file);
122
- } })] }), _jsx(Field, { label: t('Full name'), children: _jsx(Input, { value: name, onChangeText: setName, "aria-label": t('Full name'), placeholder: t('Your name') }) }), _jsx(Field, { label: t('Email'), hint: t('You sign in with this address, so it is not changed here.'), children: _jsx(SizableText, { size: "$2", color: "$soft", numberOfLines: 1, children: who.email || t('No email on this account') }) }), _jsx(Field, { label: t('What should Hanzo call you?'), children: _jsx(Input, { value: callName, onChangeText: setCallName, "aria-label": t('What should Hanzo call you?'), placeholder: shownName.split(' ')[0] || t('A first name') }) }), _jsx(Field, { label: t('What best describes your work?'), children: _jsx(XStack, { children: _jsx(ChipSelect, { name: t('Work'), label: chosenWork?.label ?? t('Choose one'), chosen: chosenWork, items: works, onChange: (w) => setWork(w.id), placement: "bottom-start", width: 260 }) }) }), _jsx(Field, { label: t('Instructions for Hanzo'), hint: t('Every coding run reads these before it starts. {used}/{most}', { used: instructions.length, most: INSTRUCTIONS }), children: _jsx(Textarea, { value: instructions, onChangeText: (v) => setInstructions(v.slice(0, INSTRUCTIONS)), "aria-label": t('Instructions for Hanzo'), placeholder: t('How you like to work: the languages and tools you prefer, the style to follow, what to avoid.'), rows: 5 }) }), _jsxs(XStack, { items: "center", gap: "$3", children: [_jsx(Button, { size: "sm", disabled: busy || !changed, onPress: () => void submit(), children: t('Save') }), _jsx(Note, { children: note })] })] }) }), org ? (_jsx(Group, { title: t('Organization'), detail: t('The organization this page acts in. Runs, codebases and settings belong to it.'), children: _jsx(Card, { children: _jsx(Row, { first: true, mono: true, title: org, detail: host.admin ? t('Organization ID · you are an admin') : t('Organization ID'), trailing: _jsx(Button, { size: "icon-sm", variant: "ghost", "aria-label": copied ? t('Organization ID copied') : t('Copy organization ID'), onPress: () => void navigator.clipboard?.writeText(org).then(() => setCopied(true)), children: copied ? _jsx(Check, { size: 14 }) : _jsx(Copy, { size: 14 }) }) }) }) })) : null, _jsx(Group, { title: t('Organizations'), detail: t('Every organization you belong to. Switch to act in another.'), children: orgs.length ? (_jsx(Card, { children: orgs.map((o, i) => (_jsx(Row, { first: i === 0, title: o, detail: o === host.org ? (host.admin ? t('Acting in {org} as an admin', { org: o }) : t('Acting in {org}', { org: o })) : undefined, trailing: o === host.org ? (_jsx(Check, { size: 16 })) : host.chooseOrg ? (_jsx(Button, { size: "sm", variant: "ghost", onPress: () => host.chooseOrg?.(o), children: t('Switch') })) : null }, o))) })) : (_jsx(Soft, { children: t('You belong to no organization yet.') })) })] }));
123
+ } })] }), _jsx(Field, { label: t('Full name'), children: _jsx(Input, { value: name, onChangeText: setName, "aria-label": t('Full name'), placeholder: t('Your name') }) }), _jsx(Field, { label: t('Email'), hint: t('You sign in with this address, so it is not changed here.'), children: _jsx(SizableText, { size: "$2", color: "$soft", numberOfLines: 1, children: who.email || t('No email on this account') }) }), _jsx(Field, { label: t('What should Hanzo call you?'), children: _jsx(Input, { value: callName, onChangeText: setCallName, "aria-label": t('What should Hanzo call you?'), placeholder: shownName.split(' ')[0] || t('A first name') }) }), _jsx(Field, { label: t('What best describes your work?'), children: _jsx(XStack, { children: _jsx(ChipSelect, { name: t('Work'), label: chosenWork?.label ?? t('Choose one'), chosen: chosenWork, items: works, onChange: (w) => setWork(w.id), placement: "bottom-start", width: 260 }) }) }), _jsx(Field, { label: t('Instructions for Hanzo'), hint: t('Every coding run reads these before it starts. {used}/{most}', { used: instructions.length, most: INSTRUCTIONS }), children: _jsx(Textarea, { value: instructions, onChangeText: (v) => setInstructions(v.slice(0, INSTRUCTIONS)), "aria-label": t('Instructions for Hanzo'), placeholder: t('How you like to work: the languages and tools you prefer, the style to follow, what to avoid.'), rows: 5 }) }), _jsxs(XStack, { items: "center", gap: "$3", children: [_jsx(Button, { size: "sm", disabled: busy || !changed, onPress: () => void submit(), children: t('Save') }), _jsx(Note, { children: note })] })] }) }), org ? (_jsx(Group, { title: t('Organization'), detail: t('The organization this page acts in. Runs, codebases and settings belong to it.'), children: _jsx(Card, { children: _jsx(Row, { first: true, mono: true, title: org, detail: host.admin ? t('Organization ID · you are an admin') : t('Organization ID'), trailing: _jsx(Button, { size: "icon-sm", variant: "ghost", "aria-label": copied ? t('Organization ID copied') : t('Copy organization ID'), onPress: () => void copy(org).then((ok) => ok && setCopied(true)), children: copied ? _jsx(Check, { size: 14 }) : _jsx(Copy, { size: 14 }) }) }) }) })) : null, _jsx(Group, { title: t('Organizations'), detail: t('Every organization you belong to. Switch to act in another.'), children: orgs.length ? (_jsx(Card, { children: orgs.map((o, i) => (_jsx(Row, { first: i === 0, title: o, detail: o === host.org ? (host.admin ? t('Acting in {org} as an admin', { org: o }) : t('Acting in {org}', { org: o })) : undefined, trailing: o === host.org ? (_jsx(Check, { size: 16 })) : host.chooseOrg ? (_jsx(Button, { size: "sm", variant: "ghost", onPress: () => host.chooseOrg?.(o), children: t('Switch') })) : null }, o))) })) : (_jsx(Soft, { children: t('You belong to no organization yet.') })) })] }));
123
124
  }
@@ -34,6 +34,7 @@ export function Billing() {
34
34
  const bills = useRead(signed ? () => invoices(target) : null, [], [target, signed]);
35
35
  const billed = useRead(signed ? () => tier(target) : null, null, [target, signed]);
36
36
  const [adding, setAdding] = useState(false);
37
+ const [cardsVersion, setCardsVersion] = useState(0);
37
38
  const [ending, setEnding] = useState(false);
38
39
  const [editingBilling, setEditingBilling] = useState(null);
39
40
  const [open, setOpen] = useState(null);
@@ -51,6 +52,10 @@ export function Billing() {
51
52
  const reading = (subs.loading && !subs.value.length) || (billed.value === null && !billed.error && !subs.error);
52
53
  const empty = !cards.error && !cards.loading && cards.value.length === 0;
53
54
  const defaultCard = chosen(cards.value);
55
+ const reloadCards = () => {
56
+ cards.reload();
57
+ setCardsVersion((v) => v + 1);
58
+ };
54
59
  // A done act is a toast; a refused one stays on the page, beside what was tried.
55
60
  const act = async (what, done, after) => {
56
61
  setWorking(true);
@@ -67,19 +72,19 @@ export function Billing() {
67
72
  setWorking(false);
68
73
  }
69
74
  };
70
- return (_jsxs(YStack, { gap: "$6", children: [_jsx(Heading, { title: t('Billing'), detail: host.org ? t('The plan {org} is on, the cards it pays with, and its invoices.', { org: host.org }) : t('The plan this organization is on, the cards it pays with, and its invoices.') }), _jsxs(XStack, { items: "center", gap: "$3", px: "$4", py: "$4", borderWidth: 1, borderColor: "$borderColor", rounded: "$3", flexWrap: "wrap", children: [_jsxs(YStack, { flex: 1, minW: 200, gap: "$1", "data-slot": "billing-plan", children: [reading ? (_jsx(SizableText, { size: "$5", color: "$ink", children: t('Reading your plan…') })) : (_jsx(Title, { label: title ?? { name: phrase('Free'), tag: '' }, size: "$5" })), _jsx(SizableText, { size: "$2", color: "$soft", children: subs.error ? told(subs.error, t) : plan ? terms(plan, t) : title ? t('Your plan.') : t('No paid plan. Usage is paid from credits.') })] }), _jsx(Button, { size: "sm", variant: "outline", onPress: () => host.go(path({ kind: 'screen', screen: 'plans' })), children: t('Adjust plan') })] }), _jsx(Credits, { target: target, admin: host.admin, onCard: () => setAdding(true) }), _jsxs(Group, { title: t('Payment'), detail: t('The card a plan renews on and a top-up charges.'), action: host.admin && (cards.error || cards.value.length > 0) ? (_jsxs(Button, { size: "sm", variant: "outline", onPress: () => setAdding(true), children: [_jsx(Plus, { size: 14 }), " ", t('Add card')] })) : undefined, children: [cards.error ? (_jsx(Soft, { children: told(cards.error, t) })) : cards.loading && !cards.value.length ? (_jsx(Soft, { children: t('Reading cards…') })) : empty ? (_jsxs(XStack, { items: "center", gap: "$3", px: "$4", py: "$4", borderWidth: 1, borderColor: "$borderColor", rounded: "$3", flexWrap: "wrap", children: [_jsx(CreditCard, { size: 20 }), _jsxs(YStack, { flex: 1, minW: 180, gap: "$1", children: [_jsx(SizableText, { size: "$3", color: "$ink", children: t('No card on file.') }), _jsx(SizableText, { size: "$2", color: "$soft", children: host.admin ? t('Add one to pay for a plan or a top-up. Adding it charges nothing.') : t('An org admin adds cards.') })] }), host.admin ? (_jsxs(Button, { variant: "primary", onPress: () => setAdding(true), children: [_jsx(Plus, { size: 16 }), " ", t('Add card')] })) : null] })) : (_jsx(Card, { children: cards.value.map((m, i) => (_jsx(Row, { first: i === 0, leading: _jsx(CreditCard, { size: 16 }), title: method(m, t), detail: [
75
+ return (_jsxs(YStack, { gap: "$6", children: [_jsx(Heading, { title: t('Billing'), detail: host.org ? t('The plan {org} is on, the cards it pays with, and its invoices.', { org: host.org }) : t('The plan this organization is on, the cards it pays with, and its invoices.') }), _jsxs(XStack, { items: "center", gap: "$3", px: "$4", py: "$4", borderWidth: 1, borderColor: "$borderColor", rounded: "$3", flexWrap: "wrap", children: [_jsxs(YStack, { flex: 1, minW: 200, gap: "$1", "data-slot": "billing-plan", children: [reading ? (_jsx(SizableText, { size: "$5", color: "$ink", children: t('Reading your plan…') })) : (_jsx(Title, { label: title ?? { name: phrase('Free'), tag: '' }, size: "$5" })), _jsx(SizableText, { size: "$2", color: "$soft", children: subs.error ? told(subs.error, t) : plan ? terms(plan, t) : title ? t('Your plan.') : t('No paid plan. Usage is paid from credits.') })] }), _jsx(Button, { size: "sm", variant: "outline", onPress: () => host.go(path({ kind: 'screen', screen: 'plans' })), children: t('Adjust plan') })] }), _jsx(Credits, { target: target, admin: host.admin, cardsVersion: cardsVersion, onCard: () => setAdding(true) }), _jsxs(Group, { title: t('Payment'), detail: t('The card a plan renews on and a top-up charges.'), action: host.admin && (cards.error || cards.value.length > 0) ? (_jsxs(Button, { size: "sm", variant: "outline", onPress: () => setAdding(true), children: [_jsx(Plus, { size: 14 }), " ", t('Add card')] })) : undefined, children: [cards.error ? (_jsx(Soft, { children: told(cards.error, t) })) : cards.loading && !cards.value.length ? (_jsx(Soft, { children: t('Reading cards…') })) : empty ? (_jsxs(XStack, { items: "center", gap: "$3", px: "$4", py: "$4", borderWidth: 1, borderColor: "$borderColor", rounded: "$3", flexWrap: "wrap", children: [_jsx(CreditCard, { size: 20 }), _jsxs(YStack, { flex: 1, minW: 180, gap: "$1", children: [_jsx(SizableText, { size: "$3", color: "$ink", children: t('No card on file.') }), _jsx(SizableText, { size: "$2", color: "$soft", children: host.admin ? t('Add one to pay for a plan or a top-up. Adding it charges nothing.') : t('An org admin adds cards.') })] }), host.admin ? (_jsxs(Button, { variant: "primary", onPress: () => setAdding(true), children: [_jsx(Plus, { size: 16 }), " ", t('Add card')] })) : null] })) : (_jsx(Card, { children: cards.value.map((m, i) => (_jsx(Row, { first: i === 0, leading: _jsx(CreditCard, { size: 16 }), title: method(m, t), detail: [
71
76
  m.expires ? t('Expires {date}', { date: m.expires }) : '',
72
77
  m.default ? t('Default') : '',
73
78
  m.billingAddress ? formatAddress(m.billingAddress) : '',
74
79
  ]
75
80
  .filter(Boolean)
76
- .join(' · ') || undefined, trailing: host.admin ? (_jsxs(XStack, { gap: "$2", items: "center", children: [!m.default ? (_jsx(Button, { size: "sm", variant: "ghost", "aria-label": t('Make {card} default', { card: method(m, t) }), disabled: working, onPress: () => void act(() => makeDefault(target, m.id), t('{card} is now the default', { card: method(m, t) }), cards.reload), children: t('Make default') })) : null, _jsx(Button, { size: "sm", variant: "ghost", "aria-label": t('Edit billing info for {card}', { card: method(m, t) }), disabled: working, onPress: () => setEditingBilling(m), children: t('Edit info') }), _jsx(Button, { size: "sm", variant: "ghost", "aria-label": t('Remove {card}', { card: method(m, t) }), disabled: working, onPress: () => void act(() => detach(target, m.id), t('{card} is removed', { card: method(m, t) }), cards.reload), children: t('Remove') })] })) : undefined }, m.id))) })), !host.admin && cards.value.length ? (_jsx(SizableText, { size: "$1", color: "$soft", children: t('An org admin adds and removes cards.') })) : null] }), _jsx(Group, { title: t('Billing details'), detail: t('Information printed on invoices and payment receipts.'), action: host.admin && defaultCard ? (_jsx(Button, { size: "sm", variant: "outline", onPress: () => setEditingBilling(defaultCard), children: defaultCard.billingAddress ? t('Edit details') : t('Add billing info') })) : undefined, children: defaultCard?.billingAddress ? (_jsx(Card, { children: _jsxs(YStack, { p: "$3", gap: "$1.5", children: [defaultCard.billingAddress.name ? (_jsx(SizableText, { size: "$3", color: "$ink", style: { fontWeight: 600 }, children: defaultCard.billingAddress.name })) : null, defaultCard.billingAddress.line1 ? (_jsxs(SizableText, { size: "$2", color: "$soft", children: [defaultCard.billingAddress.line1, defaultCard.billingAddress.line2 ? `, ${defaultCard.billingAddress.line2}` : ''] })) : null, defaultCard.billingAddress.city || defaultCard.billingAddress.state || defaultCard.billingAddress.postalCode ? (_jsx(SizableText, { size: "$2", color: "$soft", children: [defaultCard.billingAddress.city, defaultCard.billingAddress.state, defaultCard.billingAddress.postalCode]
81
+ .join(' · ') || undefined, trailing: host.admin ? (_jsxs(XStack, { gap: "$2", items: "center", children: [!m.default ? (_jsx(Button, { size: "sm", variant: "ghost", "aria-label": t('Make {card} default', { card: method(m, t) }), disabled: working, onPress: () => void act(() => makeDefault(target, m.id), t('{card} is now the default', { card: method(m, t) }), reloadCards), children: t('Make default') })) : null, _jsx(Button, { size: "sm", variant: "ghost", "aria-label": t('Edit billing info for {card}', { card: method(m, t) }), disabled: working, onPress: () => setEditingBilling(m), children: t('Edit info') }), _jsx(Button, { size: "sm", variant: "ghost", "aria-label": t('Remove {card}', { card: method(m, t) }), disabled: working, onPress: () => void act(() => detach(target, m.id), t('{card} is removed', { card: method(m, t) }), reloadCards), children: t('Remove') })] })) : undefined }, m.id))) })), !host.admin && cards.value.length ? (_jsx(SizableText, { size: "$1", color: "$soft", children: t('An org admin adds and removes cards.') })) : null] }), _jsx(Group, { title: t('Billing details'), detail: t('Information printed on invoices and payment receipts.'), action: host.admin && defaultCard ? (_jsx(Button, { size: "sm", variant: "outline", onPress: () => setEditingBilling(defaultCard), children: defaultCard.billingAddress ? t('Edit details') : t('Add billing info') })) : undefined, children: defaultCard?.billingAddress ? (_jsx(Card, { children: _jsxs(YStack, { p: "$3", gap: "$1.5", children: [defaultCard.billingAddress.name ? (_jsx(SizableText, { size: "$3", color: "$ink", style: { fontWeight: 600 }, children: defaultCard.billingAddress.name })) : null, defaultCard.billingAddress.line1 ? (_jsxs(SizableText, { size: "$2", color: "$soft", children: [defaultCard.billingAddress.line1, defaultCard.billingAddress.line2 ? `, ${defaultCard.billingAddress.line2}` : ''] })) : null, defaultCard.billingAddress.city || defaultCard.billingAddress.state || defaultCard.billingAddress.postalCode ? (_jsx(SizableText, { size: "$2", color: "$soft", children: [defaultCard.billingAddress.city, defaultCard.billingAddress.state, defaultCard.billingAddress.postalCode]
77
82
  .filter(Boolean)
78
83
  .join(' ') })) : null, defaultCard.billingAddress.country ? (_jsx(SizableText, { size: "$2", color: "$soft", children: defaultCard.billingAddress.country })) : null] }) })) : (_jsxs(XStack, { items: "center", justify: "space-between", gap: "$3", px: "$4", py: "$3", borderWidth: 1, borderColor: "$borderColor", rounded: "$3", flexWrap: "wrap", children: [_jsxs(YStack, { flex: 1, minW: 180, gap: "$1", children: [_jsx(SizableText, { size: "$2", color: "$ink", children: t('No billing address on file.') }), _jsx(SizableText, { size: "$1", color: "$soft", children: t('Add your company name and address so they appear on monthly invoices and receipts.') })] }), host.admin ? (_jsxs(Button, { size: "sm", variant: "outline", onPress: () => (defaultCard ? setEditingBilling(defaultCard) : setAdding(true)), children: [_jsx(Plus, { size: 14 }), " ", defaultCard ? t('Add billing info') : t('Set billing info')] })) : null] })) }), _jsx(Group, { title: t('Invoices'), children: bills.error ? (_jsx(Soft, { children: told(bills.error, t) })) : bills.loading && !bills.value.length ? (_jsx(Soft, { children: t('Reading invoices…') })) : bills.value.length === 0 ? (_jsx(Card, { children: _jsx(Soft, { children: t('No invoices yet.') }) })) : (_jsxs(Card, { children: [_jsxs(XStack, { px: "$3", py: "$2", gap: "$3", children: [_jsx(SizableText, { flex: 1, size: "$1", color: "$soft", children: t('Date') }), _jsx(SizableText, { width: 90, size: "$1", color: "$soft", text: "end", children: t('Total') }), _jsx(SizableText, { width: 70, size: "$1", color: "$soft", "$max-sm": { display: 'none' }, children: t('Status') }), _jsx(YStack, { width: 64 })] }), bills.value.map((b) => (_jsxs(XStack, { items: "center", gap: "$3", px: "$3", py: "$2.5", borderTopWidth: 1, borderColor: "$borderColor", children: [_jsx(SizableText, { flex: 1, size: "$2", color: "$ink", numberOfLines: 1, children: day(b.date) || b.number || b.id }), _jsx(SizableText, { width: 90, size: "$2", color: "$ink", text: "end", children: money(b.total, b.currency) }), _jsx(SizableText, { width: 70, size: "$1", color: "$soft", "$max-sm": { display: 'none' }, children: word(b.status) }), _jsx(XStack, { width: 64, justify: "flex-end", children: _jsx(Button, { size: "sm", variant: "ghost", "aria-label": t('View invoice {invoice}', { invoice: b.number || day(b.date) }), onPress: () => setOpen(b), children: t('View') }) })] }, b.id)))] })) }), plan ? (_jsx(Group, { title: t('Cancellation'), children: _jsx(Card, { children: _jsx(Row, { first: true, title: plan.ending ? t('Your plan ends on {date}', { date: day(plan.ends) }) : t('Cancel plan'), detail: plan.ending ? t('Keep it, and it renews as before.') : t('It runs to the end of the period you paid for, then ends.'), trailing: !host.admin ? undefined : plan.ending ? (_jsx(Button, { size: "sm", variant: "outline", disabled: working, onPress: () => void act(() => reactivate(target, plan.id), t('Your plan renews as before'), subs.reload), children: t('Keep plan') })) : (_jsx(Button, { size: "sm", variant: "destructive", disabled: working, onPress: () => setEnding(true), children: t('Cancel') })) }) }) })) : null, _jsx(Note, { children: note }), _jsx(AddCard, { open: adding, onOpenChange: setAdding, onSaved: (m) => {
79
- cards.reload();
84
+ reloadCards();
80
85
  toast.success(t('{card} is saved', { card: method(m, t) }));
81
86
  } }), _jsx(EditBilling, { open: editingBilling !== null, onOpenChange: (o) => !o && setEditingBilling(null), card: editingBilling, onSaved: () => {
82
- cards.reload();
87
+ reloadCards();
83
88
  } }), plan ? (_jsx(Ending, { plan: plan, open: ending, working: working, onOpenChange: setEnding, onConfirm: () => void act(() => cancel(target, plan.id), t('Your plan ends on {date}', { date: day(plan.ends) }), () => {
84
89
  setEnding(false);
85
90
  subs.reload();
@@ -1,9 +1,10 @@
1
1
  import { type Target } from '../api/call.ts';
2
2
  /** What the credits section says first, on every surface: English, marked (`phrase`), drawn through `t`. */
3
3
  export declare const SEPARATE: string;
4
- export declare function Credits({ target, admin, add, onCard }: {
4
+ export declare function Credits({ target, admin, add, onCard, cardsVersion }: {
5
5
  target: Target;
6
6
  admin: boolean;
7
7
  add?: string;
8
8
  onCard?: () => void;
9
+ cardsVersion?: number;
9
10
  }): import("react").JSX.Element;
@@ -43,7 +43,7 @@ function Meter({ title, used, of, says, first, limit = true }) {
43
43
  }
44
44
  /** `Resets Oct 1, 2026`, or '' for none. */
45
45
  const resets = (iso, t) => (day(iso) ? t('Resets {date}', { date: day(iso) }) : '');
46
- export function Credits({ target, admin, add, onCard }) {
46
+ export function Credits({ target, admin, add, onCard, cardsVersion = 0 }) {
47
47
  const { t } = useI18n();
48
48
  const left = useRead(() => balance(target), 0, [target]);
49
49
  const granted = useRead(() => credit(target), 0, [target]);
@@ -51,7 +51,7 @@ export function Credits({ target, admin, add, onCard }) {
51
51
  const spent = useRead(() => spend(target), null, [target]);
52
52
  const rule = useRead(() => recharge(target), null, [target]);
53
53
  const ceilings = useRead(() => caps(target), [], [target]);
54
- const cards = useRead(add ? null : () => methods(target), [], [target, add]);
54
+ const cards = useRead(add ? null : () => methods(target), [], [target, add, cardsVersion]);
55
55
  const [buying, setBuying] = useState(false);
56
56
  const [amount, setAmount] = useState('25');
57
57
  const [ceiling, setCeiling] = useState('');
@@ -12,17 +12,17 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
12
12
  import { SizableText, XStack, YStack } from '@hanzo/gui';
13
13
  import { phrase } from '@hanzo/i18n';
14
14
  import { useI18n } from '@hanzo/i18n/react';
15
- import { Activity, ChevronDown, ChevronUp, Cloud, Cpu, HardDrive, Laptop, MoreHorizontal, Plus, Server, Terminal, Zap, } from '@hanzogui/lucide-icons-2';
16
- import { Button, Dialog, DialogContent, DialogTitle, DropdownMenu, Input } from '@hanzo/ui';
15
+ import { Activity, ChevronDown, ChevronUp, Cloud, Cpu, HardDrive, Info, Laptop, MoreHorizontal, Plus, Server, Terminal, Zap, } from '@hanzogui/lucide-icons-2';
16
+ import { Button, Dialog, DialogContent, DialogTitle, DropdownMenu, Input, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '@hanzo/ui';
17
17
  import { CopyButton } from '@hanzo/ui/product';
18
18
  import { useEffect, useState } from 'react';
19
19
  import { told } from '../api/call.js';
20
- import { add, change, formatBytes, formatPercent, formatRelative, key, KINDS, machines, remove, state, } from '../api/machines.js';
20
+ import { add, change, displayMachine, formatBytes, formatPercent, formatRelative, key, KINDS, machines, remove, state, } from '../api/machines.js';
21
21
  import { Confirm, Rename } from '../ask.js';
22
22
  import { useRead } from '../data.js';
23
+ import { useDevMode } from '../dev-mode.js';
23
24
  import { useHost, useTarget } from '../host.js';
24
25
  import { Card, Field, Group, Heading, Note, Once, Row, Soft } from './ui.js';
25
- const mono = { fontFamily: 'var(--f-mono, ui-monospace, monospace)' };
26
26
  /** What `hanzo link` needs, in the order it is typed on the machine. */
27
27
  const LINK = ['hanzo login', 'hanzo link'].join('\n');
28
28
  /** How often the list is read again, so a machine that comes up or goes quiet shows it: the agent's beat. */
@@ -88,13 +88,14 @@ function StatusBadge({ m }) {
88
88
  color = '$soft';
89
89
  text = t('Offline');
90
90
  }
91
- return (_jsxs(XStack, { px: "$2", py: "$0.5", rounded: "$10", borderWidth: 1, borderColor: color, items: "center", gap: "$1.5", children: [_jsx(Dot, { m: m }), _jsx(SizableText, { size: "$1", color: color, style: { fontWeight: 500 }, children: text })] }));
91
+ return (_jsxs(XStack, { px: "$2", py: "$0.5", rounded: "$10", borderWidth: 1, borderColor: color, items: "center", gap: "$1.5", children: [_jsx(Dot, { m: m }), _jsx(SizableText, { size: "$1", color: color, fontWeight: "500", children: text })] }));
92
92
  }
93
93
  export function Machines() {
94
94
  const { t } = useI18n();
95
95
  const host = useHost();
96
96
  const target = useTarget();
97
97
  const signed = Boolean(host.person);
98
+ const [devMode] = useDevMode();
98
99
  const list = useRead(signed ? () => machines(target) : null, UNREAD, [target, signed]);
99
100
  const [adding, setAdding] = useState(false);
100
101
  const [renaming, setRenaming] = useState(null);
@@ -102,6 +103,7 @@ export function Machines() {
102
103
  const [keying, setKeying] = useState(null);
103
104
  const [minted, setMinted] = useState(null);
104
105
  const [expandedId, setExpandedId] = useState(null);
106
+ const [collapsedDevIds, setCollapsedDevIds] = useState({});
105
107
  const [showAdvancedLink, setShowAdvancedLink] = useState(false);
106
108
  const [note, setNote] = useState('');
107
109
  // Read again on the agent's beat; "Reading machines…" stays for the first read only.
@@ -113,32 +115,53 @@ export function Machines() {
113
115
  return () => clearInterval(id);
114
116
  }, [again, signed]);
115
117
  if (!signed) {
116
- return (_jsxs(YStack, { gap: "$5", children: [_jsx(Heading, { title: t('Machines') }), _jsx(Soft, { children: t('Sign in to see your organization’s machines.') })] }));
118
+ return (_jsxs(YStack, { gap: "$5", children: [_jsx(Heading, { title: t('Machines') }), _jsx(Soft, { children: t('Sign in to see your linked computers.') })] }));
117
119
  }
118
120
  const drain = async (m, status) => {
119
121
  setNote('');
120
122
  try {
123
+ const display = displayMachine(m, { devMode, say: t });
121
124
  await change(target, m.id, { status });
122
- setNote(status === 'draining' ? t('{name} takes no new runs', { name: m.label }) : t('{name} takes runs again', { name: m.label }));
125
+ setNote(status === 'draining' ? t('{name} takes no new runs', { name: display.title }) : t('{name} takes runs again', { name: display.title }));
123
126
  list.reload();
124
127
  }
125
128
  catch (e) {
126
129
  setNote(told(e, t));
127
130
  }
128
131
  };
129
- return (_jsxs(YStack, { gap: "$6", children: [_jsx(Heading, { title: t('Machines'), detail: t('Your organization’s own computers. A run sent to one runs there instead of in the Hanzo sandbox.') }), _jsxs(Group, { title: t('Link a machine'), detail: t('Run these on it. It registers under its hostname, and stays online while {command} runs.', { command: 'hanzo link' }), children: [_jsxs(XStack, { items: "flex-start", gap: "$2", px: "$3", py: "$2.5", rounded: "$3", borderWidth: 1, borderColor: "$borderColor", bg: "$raised", children: [_jsx(SizableText, { flex: 1, minW: 0, size: "$2", color: "$ink", "aria-label": t('Link commands'), 'data-i18n-ltr': '', fontFamily: "$mono", "$platform-web": { whiteSpace: 'pre-wrap' }, children: LINK }), _jsx(CopyButton, { value: LINK, label: t('Copy the commands') })] }), _jsxs(XStack, { items: "center", justify: "space-between", flexWrap: "wrap", gap: "$2", children: [_jsxs(XStack, { items: "center", gap: "$2", children: [_jsxs(Button, { size: "sm", variant: "ghost", onPress: () => setAdding(true), children: [_jsx(Plus, { size: 14 }), " ", t('Register one by hand')] }), _jsxs(Button, { size: "sm", variant: "ghost", onPress: () => setShowAdvancedLink(!showAdvancedLink), children: [showAdvancedLink ? _jsx(ChevronUp, { size: 14 }) : _jsx(ChevronDown, { size: 14 }), showAdvancedLink ? t('Hide options') : t('More connection options')] })] }), _jsx(SizableText, { size: "$1", color: "$soft", children: t('Supported: macOS, Linux, Windows, NVIDIA CUDA GPUs, Cloud VMs') })] }), showAdvancedLink ? (_jsxs(YStack, { gap: "$2.5", p: "$3", rounded: "$3", borderWidth: 1, borderColor: "$borderColor", bg: "$raised", children: [_jsxs(YStack, { gap: "$1", children: [_jsx(SizableText, { size: "$2", color: "$ink", style: { fontWeight: 600 }, children: t('1. Background daemon (system service)') }), _jsx(SizableText, { size: "$1", color: "$soft", children: t('Run worker continuously in the background without keeping a terminal open:') }), _jsxs(XStack, { items: "center", justify: "space-between", px: "$2.5", py: "$1.5", rounded: "$2", bg: "$raised", borderWidth: 1, borderColor: "$borderColor", children: [_jsx(SizableText, { size: "$1", color: "$ink", 'data-i18n-ltr': '', fontFamily: "$mono", children: "hanzo code --serve" }), _jsx(CopyButton, { value: "hanzo code --serve", label: t('Copy daemon command') })] })] }), _jsxs(YStack, { gap: "$1", pt: "$1", children: [_jsx(SizableText, { size: "$2", color: "$ink", style: { fontWeight: 600 }, children: t('2. Install CLI from shell') }), _jsxs(XStack, { items: "center", justify: "space-between", px: "$2.5", py: "$1.5", rounded: "$2", bg: "$raised", borderWidth: 1, borderColor: "$borderColor", children: [_jsx(SizableText, { size: "$1", color: "$ink", 'data-i18n-ltr': '', fontFamily: "$mono", children: "curl -fsSL https://hanzo.sh | sh" }), _jsx(CopyButton, { value: "curl -fsSL https://hanzo.sh | sh", label: t('Copy install command') })] })] })] })) : null] }), _jsxs(Group, { title: t('Linked'), children: [list.value === UNREAD ? (_jsx(Soft, { children: list.error ? told(list.error, t) : t('Reading machines…') })) : list.value.length === 0 ? (_jsxs(YStack, { gap: "$3", children: [_jsx(Soft, { children: t('No machine is linked yet.') }), _jsx(Card, { children: _jsxs(YStack, { p: "$4", gap: "$3", children: [_jsxs(XStack, { items: "center", gap: "$2.5", children: [_jsx(Server, { size: 20 }), _jsxs(YStack, { gap: "$0.5", children: [_jsx(SizableText, { size: "$3", color: "$ink", style: { fontWeight: 600 }, children: t('Connect your first computer or GPU server') }), _jsx(SizableText, { size: "$2", color: "$soft", children: t('Execute code, runs, and local models directly on your hardware with full privacy and zero cloud fees.') })] })] }), _jsxs(YStack, { gap: "$2", pt: "$1", children: [_jsxs(XStack, { items: "center", gap: "$2", children: [_jsx(SizableText, { size: "$1", color: "$soft", style: { ...mono, width: 20 }, children: "1." }), _jsx(SizableText, { size: "$2", color: "$ink", children: t('Install Hanzo CLI: {command}', { command: _jsx(SizableText, { size: "$2", color: "$ink", fontFamily: "$mono", 'data-i18n-ltr': '', children: "curl -fsSL https://hanzo.sh | sh" }) }) })] }), _jsxs(XStack, { items: "center", gap: "$2", children: [_jsx(SizableText, { size: "$1", color: "$soft", style: { ...mono, width: 20 }, children: "2." }), _jsx(SizableText, { size: "$2", color: "$ink", children: t('Sign in with your account: {command}', { command: _jsx(SizableText, { size: "$2", color: "$ink", fontFamily: "$mono", 'data-i18n-ltr': '', children: "hanzo login" }) }) })] }), _jsxs(XStack, { items: "center", gap: "$2", children: [_jsx(SizableText, { size: "$1", color: "$soft", style: { ...mono, width: 20 }, children: "3." }), _jsx(SizableText, { size: "$2", color: "$ink", children: t('Link the machine: {command}', { command: _jsx(SizableText, { size: "$2", color: "$ink", fontFamily: "$mono", 'data-i18n-ltr': '', children: "hanzo link" }) }) })] })] }), _jsx(XStack, { pt: "$1", children: _jsxs(Button, { size: "sm", variant: "outline", onPress: () => setAdding(true), children: [_jsx(Plus, { size: 14 }), " ", t('Register one by hand')] }) })] }) })] })) : (_jsx(Card, { children: list.value.map((m, i) => {
130
- const isExpanded = expandedId === m.id;
131
- const hasTelemetry = Boolean(m.metrics || m.spec);
132
- return (_jsxs(YStack, { borderTopWidth: i > 0 ? 1 : 0, borderColor: "$borderColor", children: [_jsx(Row, { first: i === 0, leading: _jsxs(XStack, { items: "center", gap: "$2", children: [_jsx(Dot, { m: m }), _jsx(KindIcon, { kind: m.kind, size: 16 })] }), title: m.label, detail: about(m, t), trailing: _jsxs(XStack, { items: "center", gap: "$2", children: [_jsx(StatusBadge, { m: m }), m.serving ? (_jsx(XStack, { px: "$1.5", py: "$0.5", rounded: "$10", borderWidth: 1, borderColor: "$green10", children: _jsx(SizableText, { size: "$1", color: "$green10", children: t('Serving') }) })) : null, m.running > 0 ? (_jsxs(XStack, { px: "$1.5", py: "$0.5", rounded: "$10", bg: "$raised", items: "center", gap: "$1", children: [_jsx(Activity, { size: 12, color: "$green10" }), _jsx(SizableText, { size: "$1", color: "$ink", children: t('{n} active', { n: m.running }) })] })) : null, _jsx(CopyButton, { value: `hanzo link --target ${m.id}`, label: t('Copy link command for {name}', { name: m.label }) }), _jsx(DropdownMenu, { trigger: _jsx(XStack, { render: "button", "aria-label": t('Actions for {name}', { name: m.label }), px: "$1.5", py: "$1", rounded: "$2", hoverStyle: { bg: '$hover' }, children: _jsx(MoreHorizontal, { size: 16 }) }), items: [
133
- { key: 'details', label: isExpanded ? t('Hide details') : t('Show details'), onSelect: () => setExpandedId(isExpanded ? null : m.id) },
132
+ return (_jsxs(YStack, { gap: "$6", children: [_jsx(Heading, { title: t('Machines'), detail: devMode
133
+ ? t('Your organization’s own computers. A run sent to one runs there instead of in the cloud workspace.')
134
+ : t('Connect your computer to run tasks locally in your Hanzo folder.') }), _jsxs(Group, { title: t('Link a machine'), detail: t('Run these on your computer. It stays connected while {command} runs.', { command: 'hanzo link' }), children: [_jsxs(XStack, { items: "flex-start", gap: "$2", px: "$3", py: "$2.5", rounded: "$3", borderWidth: 1, borderColor: "$borderColor", bg: "$raised", children: [_jsx(SizableText, { flex: 1, minW: 0, size: "$2", color: "$ink", "aria-label": t('Link commands'), 'data-i18n-ltr': '', fontFamily: "$mono", "$platform-web": { whiteSpace: 'pre-wrap' }, children: LINK }), _jsx(CopyButton, { value: LINK, label: t('Copy the commands') })] }), _jsxs(XStack, { items: "center", justify: "space-between", flexWrap: "wrap", gap: "$2", children: [_jsxs(XStack, { items: "center", gap: "$2", children: [_jsxs(Button, { size: "sm", variant: "ghost", onPress: () => setAdding(true), children: [_jsx(Plus, { size: 14 }), " ", t('Register one by hand')] }), _jsxs(Button, { size: "sm", variant: "ghost", onPress: () => setShowAdvancedLink(!showAdvancedLink), children: [showAdvancedLink ? _jsx(ChevronUp, { size: 14 }) : _jsx(ChevronDown, { size: 14 }), showAdvancedLink ? t('Hide options') : t('Advanced options')] })] }), _jsx(SizableText, { size: "$1", color: "$soft", children: devMode ? t('Supported: macOS, Linux, Windows, NVIDIA CUDA GPUs, Cloud VMs') : t('Works on macOS, Windows, and Linux') })] }), showAdvancedLink ? (_jsxs(YStack, { gap: "$2.5", p: "$3", rounded: "$3", borderWidth: 1, borderColor: "$borderColor", bg: "$raised", children: [_jsxs(YStack, { gap: "$1", children: [_jsx(SizableText, { size: "$2", color: "$ink", fontWeight: "600", children: t('1. Background daemon (system service)') }), _jsx(SizableText, { size: "$1", color: "$soft", children: t('Run worker continuously in the background without keeping a terminal open:') }), _jsxs(XStack, { items: "center", justify: "space-between", px: "$2.5", py: "$1.5", rounded: "$2", bg: "$raised", borderWidth: 1, borderColor: "$borderColor", children: [_jsx(SizableText, { size: "$1", color: "$ink", 'data-i18n-ltr': '', fontFamily: "$mono", children: "hanzo code --serve" }), _jsx(CopyButton, { value: "hanzo code --serve", label: t('Copy daemon command') })] })] }), _jsxs(YStack, { gap: "$1", pt: "$1", children: [_jsx(SizableText, { size: "$2", color: "$ink", fontWeight: "600", children: t('2. Install CLI from shell') }), _jsxs(XStack, { items: "center", justify: "space-between", px: "$2.5", py: "$1.5", rounded: "$2", bg: "$raised", borderWidth: 1, borderColor: "$borderColor", children: [_jsx(SizableText, { size: "$1", color: "$ink", 'data-i18n-ltr': '', fontFamily: "$mono", children: "curl -fsSL https://hanzo.sh | sh" }), _jsx(CopyButton, { value: "curl -fsSL https://hanzo.sh | sh", label: t('Copy install command') })] })] })] })) : null] }), _jsxs(Group, { title: t('Linked'), children: [list.value === UNREAD ? (_jsx(Soft, { children: list.error ? told(list.error, t) : t('Loading devices…') })) : list.value.length === 0 ? (_jsxs(YStack, { gap: "$3", children: [_jsx(Soft, { children: t('No computer is linked yet.') }), _jsx(Card, { children: _jsxs(YStack, { p: "$4", gap: "$3", children: [_jsxs(XStack, { items: "center", gap: "$2.5", children: [_jsx(Server, { size: 20 }), _jsxs(YStack, { gap: "$0.5", children: [_jsx(SizableText, { size: "$3", color: "$ink", fontWeight: "600", children: t('Connect your computer') }), _jsx(SizableText, { size: "$2", color: "$soft", children: t('Run tasks directly on your own computer in your Hanzo folder.') })] })] }), _jsxs(YStack, { gap: "$2", pt: "$1", children: [_jsxs(XStack, { items: "center", gap: "$2", children: [_jsx(SizableText, { size: "$1", color: "$soft", fontFamily: "$mono", width: 20, children: "1." }), _jsx(SizableText, { size: "$2", color: "$ink", children: t('Install Hanzo CLI: {command}', { command: _jsx(SizableText, { size: "$2", color: "$ink", fontFamily: "$mono", 'data-i18n-ltr': '', children: "curl -fsSL https://hanzo.sh | sh" }) }) })] }), _jsxs(XStack, { items: "center", gap: "$2", children: [_jsx(SizableText, { size: "$1", color: "$soft", fontFamily: "$mono", width: 20, children: "2." }), _jsx(SizableText, { size: "$2", color: "$ink", children: t('Sign in with your account: {command}', { command: _jsx(SizableText, { size: "$2", color: "$ink", fontFamily: "$mono", 'data-i18n-ltr': '', children: "hanzo login" }) }) })] }), _jsxs(XStack, { items: "center", gap: "$2", children: [_jsx(SizableText, { size: "$1", color: "$soft", fontFamily: "$mono", width: 20, children: "3." }), _jsx(SizableText, { size: "$2", color: "$ink", children: t('Link the machine: {command}', { command: _jsx(SizableText, { size: "$2", color: "$ink", fontFamily: "$mono", 'data-i18n-ltr': '', children: "hanzo link" }) }) })] })] }), _jsx(XStack, { pt: "$1", children: _jsxs(Button, { size: "sm", variant: "outline", onPress: () => setAdding(true), children: [_jsx(Plus, { size: 14 }), " ", t('Register one by hand')] }) })] }) })] })) : (_jsx(Card, { children: list.value.map((m, i) => {
135
+ const display = displayMachine(m, { devMode, say: t });
136
+ const showDetails = devMode ? !collapsedDevIds[m.id] : expandedId === m.id;
137
+ const toggleDetails = () => {
138
+ if (devMode) {
139
+ setCollapsedDevIds((prev) => ({ ...prev, [m.id]: !prev[m.id] }));
140
+ }
141
+ else {
142
+ setExpandedId(expandedId === m.id ? null : m.id);
143
+ }
144
+ };
145
+ const calmDetail = [
146
+ said(state(m), t),
147
+ m.running ? t('{n} active', { n: m.running }) : m.sessions ? t('{n} runs', { n: m.sessions }) : '',
148
+ ]
149
+ .filter(Boolean)
150
+ .join(' · ');
151
+ return (_jsxs(YStack, { borderTopWidth: i > 0 ? 1 : 0, borderColor: "$borderColor", children: [_jsx(Row, { first: i === 0, leading: _jsxs(XStack, { items: "center", gap: "$2", children: [_jsx(Dot, { m: m }), _jsx(KindIcon, { kind: m.kind, size: 16 })] }), title: display.title, detail: devMode ? about(m, t) : calmDetail, trailing: _jsxs(XStack, { items: "center", gap: "$2", children: [!devMode && display.detail ? (_jsx(TooltipProvider, { delay: 150, children: _jsxs(Tooltip, { placement: "top", offset: 6, children: [_jsx(TooltipTrigger, { asChild: true, children: _jsx(XStack, { render: "button", "aria-label": display.detail, p: "$1", opacity: 0.75, children: _jsx(Info, { size: 14, color: "$soft" }) }) }), _jsx(TooltipContent, { maxW: 280, px: "$3", py: "$2", z: "var(--z-popover)", children: _jsx(SizableText, { fontFamily: "$body", size: "$1", color: "$ink", children: display.detail }) })] }) })) : null, _jsx(StatusBadge, { m: m }), m.serving ? (_jsx(XStack, { px: "$1.5", py: "$0.5", rounded: "$10", borderWidth: 1, borderColor: "$green10", children: _jsx(SizableText, { size: "$1", color: "$green10", children: t('Serving') }) })) : null, m.running > 0 ? (_jsxs(XStack, { px: "$1.5", py: "$0.5", rounded: "$10", bg: "$raised", items: "center", gap: "$1", children: [_jsx(Activity, { size: 12, color: "$green10" }), _jsx(SizableText, { size: "$1", color: "$ink", children: t('{n} active', { n: m.running }) })] })) : null, !devMode ? (_jsxs(Button, { size: "sm", variant: "ghost", onPress: toggleDetails, children: [showDetails ? _jsx(ChevronUp, { size: 13 }) : _jsx(ChevronDown, { size: 13 }), showDetails ? t('Hide details') : t('Advanced details')] })) : (_jsx(CopyButton, { value: `hanzo link --target ${m.id}`, label: t('Copy link command for {name}', { name: display.title }) })), _jsx(DropdownMenu, { trigger: _jsx(XStack, { render: "button", "aria-label": t('Actions for {name}', { name: display.title }), px: "$1.5", py: "$1", rounded: "$2", hoverStyle: { bg: '$hover' }, children: _jsx(MoreHorizontal, { size: 16 }) }), items: [
152
+ { key: 'details', label: showDetails ? t('Hide advanced details') : t('Advanced details'), onSelect: toggleDetails },
134
153
  { key: 'rename', label: t('Rename'), onSelect: () => setRenaming(m) },
135
- m.status === 'draining'
136
- ? { key: 'online', label: t('Take runs again'), onSelect: () => void drain(m, 'online') }
137
- : { key: 'drain', label: t('Drain'), description: t('Finish what it has, take nothing new'), onSelect: () => void drain(m, 'draining') },
138
- { key: 'key', label: t('Claim key'), onSelect: () => setKeying(m) },
154
+ ...(devMode || showDetails
155
+ ? [
156
+ m.status === 'draining'
157
+ ? { key: 'online', label: t('Take runs again'), onSelect: () => void drain(m, 'online') }
158
+ : { key: 'drain', label: t('Drain'), description: t('Finish what it has, take nothing new'), onSelect: () => void drain(m, 'draining') },
159
+ { key: 'key', label: t('Claim key'), onSelect: () => setKeying(m) },
160
+ ]
161
+ : []),
139
162
  { type: 'separator' },
140
163
  { key: 'remove', label: t('Remove'), destructive: true, onSelect: () => setRemoving(m) },
141
- ] })] }) }), isExpanded || hasTelemetry ? (_jsxs(YStack, { px: "$4", pb: "$3", pt: "$1", gap: "$2.5", children: [m.spec ? (_jsxs(XStack, { flexWrap: "wrap", gap: "$2", items: "center", children: [m.spec.os ? (_jsxs(XStack, { px: "$2", py: "$1", rounded: "$2", bg: "$raised", borderWidth: 1, borderColor: "$borderColor", items: "center", gap: "$1.5", children: [_jsx(Terminal, { size: 12 }), _jsxs(SizableText, { size: "$1", color: "$ink", children: [m.spec.os, m.spec.arch ? ` · ${m.spec.arch}` : ''] })] })) : null, m.spec.cpus ? (_jsxs(XStack, { px: "$2", py: "$1", rounded: "$2", bg: "$raised", borderWidth: 1, borderColor: "$borderColor", items: "center", gap: "$1.5", children: [_jsx(Cpu, { size: 12 }), _jsx(SizableText, { size: "$1", color: "$ink", children: t('{n} cores', { n: m.spec.cpus }) })] })) : null, m.spec.memory ? (_jsxs(XStack, { px: "$2", py: "$1", rounded: "$2", bg: "$raised", borderWidth: 1, borderColor: "$borderColor", items: "center", gap: "$1.5", children: [_jsx(HardDrive, { size: 12 }), _jsx(SizableText, { size: "$1", color: "$ink", children: t('{size} RAM', { size: formatBytes(m.spec.memory) }) })] })) : null, m.spec.gpus && m.spec.gpus.length > 0 ? (_jsxs(XStack, { px: "$2", py: "$1", rounded: "$2", bg: "$raised", borderWidth: 1, borderColor: "$borderColor", items: "center", gap: "$1.5", children: [_jsx(Zap, { size: 12, color: "$yellow10" }), _jsx(SizableText, { size: "$1", color: "$ink", children: m.spec.gpus.map((g) => `${g.model || g.vendor || 'GPU'}${g.memory ? ` (${formatBytes(g.memory)})` : ''}`).join(', ') })] })) : null] })) : null, m.metrics && (m.metrics.cpuUtil || m.metrics.load1 || m.metrics.memUsed || m.metrics.gpuUtil) ? (_jsxs(XStack, { flexWrap: "wrap", gap: "$3", p: "$2.5", rounded: "$2", bg: "$raised", borderWidth: 1, borderColor: "$borderColor", items: "center", children: [m.metrics.cpuUtil ? (_jsxs(YStack, { gap: "$0.5", children: [_jsx(SizableText, { size: "$1", color: "$soft", children: t('CPU Utilization') }), _jsxs(SizableText, { size: "$2", color: "$ink", style: { fontWeight: 600 }, children: [formatPercent(m.metrics.cpuUtil), " ", m.metrics.cpuTemp ? `· ${m.metrics.cpuTemp}°C` : ''] })] })) : m.metrics.load1 ? (_jsxs(YStack, { gap: "$0.5", children: [_jsx(SizableText, { size: "$1", color: "$soft", children: t('Load (1m, 5m, 15m)') }), _jsxs(SizableText, { size: "$2", color: "$ink", style: { fontWeight: 600 }, children: [m.metrics.load1, ", ", m.metrics.load5 ?? 0, ", ", m.metrics.load15 ?? 0] })] })) : null, m.metrics.memUsed ? (_jsxs(YStack, { gap: "$0.5", children: [_jsx(SizableText, { size: "$1", color: "$soft", children: t('Memory') }), _jsx(SizableText, { size: "$2", color: "$ink", style: { fontWeight: 600 }, children: m.spec?.memory ? `${formatBytes(m.metrics.memUsed)} / ${formatBytes(m.spec.memory)}` : t('{size} used', { size: formatBytes(m.metrics.memUsed) }) })] })) : null, m.metrics.gpuUtil !== undefined && m.metrics.gpuUtil > 0 ? (_jsxs(YStack, { gap: "$0.5", children: [_jsx(SizableText, { size: "$1", color: "$soft", children: t('GPU') }), _jsxs(SizableText, { size: "$2", color: "$ink", style: { fontWeight: 600 }, children: [formatPercent(m.metrics.gpuUtil), " ", m.metrics.gpuTemp ? `· ${m.metrics.gpuTemp}°C` : '', " ", m.metrics.gpuPower ? `· ${m.metrics.gpuPower}W` : ''] })] })) : null, m.metrics.model ? (_jsxs(YStack, { gap: "$0.5", children: [_jsx(SizableText, { size: "$1", color: "$soft", children: t('Serving Model') }), _jsxs(SizableText, { size: "$2", color: "$ink", style: { fontWeight: 600 }, children: [m.metrics.model, " ", m.metrics.decode ? `(${m.metrics.decode} tok/s)` : ''] })] })) : null] })) : null, _jsxs(XStack, { justify: "space-between", items: "center", flexWrap: "wrap", gap: "$2", pt: "$0.5", children: [_jsxs(XStack, { items: "center", gap: "$3", children: [_jsx(SizableText, { size: "$1", color: "$soft", style: mono, children: t('ID: {id}', { id: m.id }) }), m.seen ? (_jsx(SizableText, { size: "$1", color: "$soft", children: t('Last heartbeat: {when}', { when: formatRelative(m.seen) }) })) : null] }), _jsxs(XStack, { items: "center", gap: "$2", children: [_jsx(SizableText, { size: "$1", color: "$soft", children: t('Run directly on this machine:') }), _jsxs(XStack, { items: "center", gap: "$1", px: "$2", py: "$0.5", rounded: "$2", bg: "$raised", borderWidth: 1, borderColor: "$borderColor", children: [_jsxs(SizableText, { size: "$1", color: "$ink", 'data-i18n-ltr': '', fontFamily: "$mono", children: ["hanzo run --target ", m.id] }), _jsx(CopyButton, { value: `hanzo run --target ${m.id}`, label: t('Copy run command for {name}', { name: m.label }) })] })] })] })] })) : null] }, m.id));
164
+ ] })] }) }), showDetails ? (_jsxs(YStack, { px: "$4", pb: "$3", pt: "$1", gap: "$2.5", children: [m.spec ? (_jsxs(XStack, { flexWrap: "wrap", gap: "$2", items: "center", children: [m.spec.os ? (_jsxs(XStack, { px: "$2", py: "$1", rounded: "$2", bg: "$raised", borderWidth: 1, borderColor: "$borderColor", items: "center", gap: "$1.5", children: [_jsx(Terminal, { size: 12 }), _jsxs(SizableText, { size: "$1", color: "$ink", children: [m.spec.os, m.spec.arch ? ` · ${m.spec.arch}` : ''] })] })) : null, m.spec.cpus ? (_jsxs(XStack, { px: "$2", py: "$1", rounded: "$2", bg: "$raised", borderWidth: 1, borderColor: "$borderColor", items: "center", gap: "$1.5", children: [_jsx(Cpu, { size: 12 }), _jsx(SizableText, { size: "$1", color: "$ink", children: t('{n} cores', { n: m.spec.cpus }) })] })) : null, m.spec.memory ? (_jsxs(XStack, { px: "$2", py: "$1", rounded: "$2", bg: "$raised", borderWidth: 1, borderColor: "$borderColor", items: "center", gap: "$1.5", children: [_jsx(HardDrive, { size: 12 }), _jsx(SizableText, { size: "$1", color: "$ink", children: t('{size} RAM', { size: formatBytes(m.spec.memory) }) })] })) : null, m.spec.gpus && m.spec.gpus.length > 0 ? (_jsxs(XStack, { px: "$2", py: "$1", rounded: "$2", bg: "$raised", borderWidth: 1, borderColor: "$borderColor", items: "center", gap: "$1.5", children: [_jsx(Zap, { size: 12, color: "$yellow10" }), _jsx(SizableText, { size: "$1", color: "$ink", children: m.spec.gpus.map((g) => `${g.model || g.vendor || 'GPU'}${g.memory ? ` (${formatBytes(g.memory)})` : ''}`).join(', ') })] })) : null] })) : null, m.metrics && (m.metrics.cpuUtil || m.metrics.load1 || m.metrics.memUsed || m.metrics.gpuUtil) ? (_jsxs(XStack, { flexWrap: "wrap", gap: "$3", p: "$2.5", rounded: "$2", bg: "$raised", borderWidth: 1, borderColor: "$borderColor", items: "center", children: [m.metrics.cpuUtil ? (_jsxs(YStack, { gap: "$0.5", children: [_jsx(SizableText, { size: "$1", color: "$soft", children: t('CPU Utilization') }), _jsxs(SizableText, { size: "$2", color: "$ink", fontWeight: "600", children: [formatPercent(m.metrics.cpuUtil), " ", m.metrics.cpuTemp ? `· ${m.metrics.cpuTemp}°C` : ''] })] })) : m.metrics.load1 ? (_jsxs(YStack, { gap: "$0.5", children: [_jsx(SizableText, { size: "$1", color: "$soft", children: t('Load (1m, 5m, 15m)') }), _jsxs(SizableText, { size: "$2", color: "$ink", fontWeight: "600", children: [m.metrics.load1, ", ", m.metrics.load5 ?? 0, ", ", m.metrics.load15 ?? 0] })] })) : null, m.metrics.memUsed ? (_jsxs(YStack, { gap: "$0.5", children: [_jsx(SizableText, { size: "$1", color: "$soft", children: t('Memory') }), _jsx(SizableText, { size: "$2", color: "$ink", fontWeight: "600", children: m.spec?.memory ? `${formatBytes(m.metrics.memUsed)} / ${formatBytes(m.spec.memory)}` : t('{size} used', { size: formatBytes(m.metrics.memUsed) }) })] })) : null, m.metrics.gpuUtil !== undefined && m.metrics.gpuUtil > 0 ? (_jsxs(YStack, { gap: "$0.5", children: [_jsx(SizableText, { size: "$1", color: "$soft", children: t('GPU') }), _jsxs(SizableText, { size: "$2", color: "$ink", fontWeight: "600", children: [formatPercent(m.metrics.gpuUtil), " ", m.metrics.gpuTemp ? `· ${m.metrics.gpuTemp}°C` : '', " ", m.metrics.gpuPower ? `· ${m.metrics.gpuPower}W` : ''] })] })) : null, m.metrics.model ? (_jsxs(YStack, { gap: "$0.5", children: [_jsx(SizableText, { size: "$1", color: "$soft", children: t('Serving Model') }), _jsxs(SizableText, { size: "$2", color: "$ink", fontWeight: "600", children: [m.metrics.model, " ", m.metrics.decode ? `(${m.metrics.decode} tok/s)` : ''] })] })) : null] })) : null, _jsxs(XStack, { justify: "space-between", items: "center", flexWrap: "wrap", gap: "$2", pt: "$0.5", children: [_jsxs(XStack, { items: "center", gap: "$3", flexWrap: "wrap", children: [_jsx(SizableText, { size: "$1", color: "$soft", fontFamily: "$mono", children: t('ID: {id}', { id: m.id }) }), m.host ? (_jsx(SizableText, { size: "$1", color: "$soft", fontFamily: "$mono", children: m.host })) : null, m.seen ? (_jsx(SizableText, { size: "$1", color: "$soft", children: t('Last heartbeat: {when}', { when: formatRelative(m.seen) }) })) : null] }), _jsxs(XStack, { items: "center", gap: "$2", flexWrap: "wrap", children: [_jsx(Button, { size: "sm", variant: "outline", onPress: () => setKeying(m), children: t('Claim key') }), _jsx(Button, { size: "sm", variant: "outline", onPress: () => void drain(m, m.status === 'draining' ? 'online' : 'draining'), children: m.status === 'draining' ? t('Take runs again') : t('Drain') }), _jsxs(XStack, { items: "center", gap: "$1", px: "$2", py: "$0.5", rounded: "$2", bg: "$raised", borderWidth: 1, borderColor: "$borderColor", children: [_jsxs(SizableText, { size: "$1", color: "$ink", 'data-i18n-ltr': '', fontFamily: "$mono", children: ["hanzo run --target ", m.id] }), _jsx(CopyButton, { value: `hanzo run --target ${m.id}`, label: t('Copy run command for {name}', { name: display.title }) })] })] })] })] })) : null] }, m.id));
142
165
  }) })), list.error && list.value !== UNREAD ? _jsx(Soft, { children: told(list.error, t) }) : null] }), _jsx(Note, { children: note }), _jsx(Adding, { open: adding, onOpenChange: setAdding, onAdded: (m) => {
143
166
  setNote(t('{name} is registered', { name: m.label }));
144
167
  list.reload();
@@ -158,7 +181,7 @@ export function Machines() {
158
181
  } }), _jsx(Dialog, { open: minted !== null, onOpenChange: (o) => !o && setMinted(null), children: _jsxs(DialogContent, { maxW: 480, showCloseButton: false, children: [_jsx(DialogTitle, { children: t('Claim key for {name}', { name: minted?.machine.label ?? '' }) }), minted ? (_jsxs(YStack, { gap: "$3", children: [_jsx(Once, { value: minted.key, label: t('Claim key'), copy: t('Copy claim key'), children: _jsx(SizableText, { size: "$1", color: "$soft", children: t('A runner on this machine sends it as {header} when it claims the runs sent here, at {route}.', {
159
182
  header: 'X-Target-Key',
160
183
  route: `POST /v1/agent/targets/${minted.machine.id}/claim`,
161
- }) }) }), _jsxs(YStack, { gap: "$1", p: "$2.5", rounded: "$2", bg: "$raised", borderWidth: 1, borderColor: "$borderColor", children: [_jsx(SizableText, { size: "$1", color: "$ink", style: { fontWeight: 600 }, children: t('Start background worker with this key:') }), _jsxs(XStack, { items: "center", justify: "space-between", px: "$2", py: "$1", rounded: "$2", bg: "$raised", children: [_jsxs(SizableText, { size: "$1", color: "$ink", 'data-i18n-ltr': '', fontFamily: "$mono", children: ["export HANZO_TARGET_KEY=\"", minted.key, "\""] }), _jsx(CopyButton, { value: `export HANZO_TARGET_KEY="${minted.key}"\nhanzo code --serve --target ${minted.machine.id}`, label: t('Copy key command') })] })] })] })) : null, _jsx(XStack, { justify: "flex-end", pt: "$2", children: _jsx(Button, { size: "sm", onPress: () => setMinted(null), children: t('Done') }) })] }) })] }));
184
+ }) }) }), _jsxs(YStack, { gap: "$1", p: "$2.5", rounded: "$2", bg: "$raised", borderWidth: 1, borderColor: "$borderColor", children: [_jsx(SizableText, { size: "$1", color: "$ink", fontWeight: "600", children: t('Start background worker with this key:') }), _jsxs(XStack, { items: "center", justify: "space-between", px: "$2", py: "$1", rounded: "$2", bg: "$raised", children: [_jsxs(SizableText, { size: "$1", color: "$ink", 'data-i18n-ltr': '', fontFamily: "$mono", children: ["export HANZO_TARGET_KEY=\"", minted.key, "\""] }), _jsx(CopyButton, { value: `export HANZO_TARGET_KEY="${minted.key}"\nhanzo code --serve --target ${minted.machine.id}`, label: t('Copy key command') })] })] })] })) : null, _jsx(XStack, { justify: "flex-end", pt: "$2", children: _jsx(Button, { size: "sm", onPress: () => setMinted(null), children: t('Done') }) })] }) })] }));
162
185
  }
163
186
  /** Registering a machine by hand: its name, what it is, and the hostname its runs report. */
164
187
  function Adding({ open, onOpenChange, onAdded }) {
@@ -16,6 +16,7 @@ import { useState } from 'react';
16
16
  import { told } from '../api/call.js';
17
17
  import { add, deliveries, endpoints, patterns, refuse, remove, test } from '../api/webhooks.js';
18
18
  import { useRead } from '../data.js';
19
+ import { copy } from '../clipboard.js';
19
20
  import { useHost, useTarget } from '../host.js';
20
21
  import { Card, day, Field, Group, Heading, Note, Row, Soft } from './ui.js';
21
22
  const mono = { fontFamily: 'var(--f-mono, ui-monospace, monospace)' };
@@ -99,7 +100,7 @@ export function Notifications() {
99
100
  };
100
101
  return (_jsxs(YStack, { gap: "$6", children: [_jsx(Heading, { title: t('Notifications'), detail: host.org
101
102
  ? t('Webhooks: events in {org}, POSTed and signed to an address you run.', { org: host.org })
102
- : t('Webhooks: events in this organization, POSTed and signed to an address you run.'), action: adding || !host.admin ? undefined : (_jsxs(Button, { size: "sm", variant: "outline", onPress: () => setAdding(true), children: [_jsx(Plus, { size: 14 }), " ", t('Add webhook')] })) }), adding ? (_jsxs(YStack, { gap: "$3", p: "$4", borderWidth: 1, borderColor: "$borderColor", rounded: "$3", children: [_jsx(Field, { label: t('Endpoint URL'), hint: t('https only.'), children: _jsx(Input, { value: url, onChangeText: setUrl, placeholder: "https://example.com/hooks/hanzo", "aria-label": t('Endpoint URL'), autoCapitalize: "none", inputMode: "url" }) }), _jsx(Field, { label: t('Events'), hint: t('Subject patterns, comma separated, such as {example} — leave empty for every event.', { example: 'commerce.order.>' }), children: _jsx(Input, { value: events, onChangeText: setEvents, placeholder: "commerce.order.>, event.>", "aria-label": t('Events'), autoCapitalize: "none" }) }), _jsx(Field, { label: t('Description'), children: _jsx(Input, { value: description, onChangeText: setDescription, placeholder: t('What this endpoint is for'), "aria-label": t('Description') }) }), _jsxs(XStack, { gap: "$2", justify: "flex-end", children: [_jsx(Button, { size: "sm", variant: "ghost", onPress: () => setAdding(false), children: t('Cancel') }), _jsx(Button, { size: "sm", disabled: working || !url.trim(), onPress: create, children: t('Add webhook') })] })] })) : null, secret ? (_jsxs(YStack, { gap: "$2", p: "$4", borderWidth: 1, borderColor: "$ink", rounded: "$3", children: [_jsx(SizableText, { size: "$2", color: "$ink", children: t('Signing secret') }), _jsx(SizableText, { size: "$1", color: "$soft", children: t('Shown this once. Keep it where your endpoint checks each delivery’s signature.') }), _jsxs(XStack, { items: "center", gap: "$2", children: [_jsx(SizableText, { flex: 1, size: "$2", color: "$ink", fontFamily: "$mono", "$platform-web": { wordBreak: 'break-all' }, "aria-label": t('Signing secret'), children: secret }), _jsxs(Button, { size: "sm", variant: "outline", onPress: () => void navigator.clipboard?.writeText(secret).then(() => setNote(t('The secret is copied'))), children: [_jsx(Copy, { size: 14 }), " ", t('Copy')] }), _jsx(XStack, { render: "button", "aria-label": t('Hide the secret'), p: "$1", onPress: () => setSecret(''), children: _jsx(X, { size: 14 }) })] })] })) : null, _jsx(Group, { title: t('Webhooks'), children: list.error ? (_jsx(Soft, { children: told(list.error, t) })) : list.loading && !list.value.length ? (_jsx(Soft, { children: t('Reading webhooks…') })) : list.value.length === 0 ? (_jsx(Card, { children: _jsx(Soft, { children: t('No webhooks yet.') }) })) : (_jsx(Card, { children: list.value.map((e, i) => (_jsxs(YStack, { borderTopWidth: i ? 1 : 0, borderColor: "$borderColor", children: [_jsx(Row, { first: true, mono: true, leading: _jsx(Webhook, { size: 16 }), title: e.url, detail: [
103
+ : t('Webhooks: events in this organization, POSTed and signed to an address you run.'), action: adding || !host.admin ? undefined : (_jsxs(Button, { size: "sm", variant: "outline", onPress: () => setAdding(true), children: [_jsx(Plus, { size: 14 }), " ", t('Add webhook')] })) }), adding ? (_jsxs(YStack, { gap: "$3", p: "$4", borderWidth: 1, borderColor: "$borderColor", rounded: "$3", children: [_jsx(Field, { label: t('Endpoint URL'), hint: t('https only.'), children: _jsx(Input, { value: url, onChangeText: setUrl, placeholder: "https://example.com/hooks/hanzo", "aria-label": t('Endpoint URL'), autoCapitalize: "none", inputMode: "url" }) }), _jsx(Field, { label: t('Events'), hint: t('Subject patterns, comma separated, such as {example} — leave empty for every event.', { example: 'commerce.order.>' }), children: _jsx(Input, { value: events, onChangeText: setEvents, placeholder: "commerce.order.>, event.>", "aria-label": t('Events'), autoCapitalize: "none" }) }), _jsx(Field, { label: t('Description'), children: _jsx(Input, { value: description, onChangeText: setDescription, placeholder: t('What this endpoint is for'), "aria-label": t('Description') }) }), _jsxs(XStack, { gap: "$2", justify: "flex-end", children: [_jsx(Button, { size: "sm", variant: "ghost", onPress: () => setAdding(false), children: t('Cancel') }), _jsx(Button, { size: "sm", disabled: working || !url.trim(), onPress: create, children: t('Add webhook') })] })] })) : null, secret ? (_jsxs(YStack, { gap: "$2", p: "$4", borderWidth: 1, borderColor: "$ink", rounded: "$3", children: [_jsx(SizableText, { size: "$2", color: "$ink", children: t('Signing secret') }), _jsx(SizableText, { size: "$1", color: "$soft", children: t('Shown this once. Keep it where your endpoint checks each delivery’s signature.') }), _jsxs(XStack, { items: "center", gap: "$2", children: [_jsx(SizableText, { flex: 1, size: "$2", color: "$ink", fontFamily: "$mono", "$platform-web": { wordBreak: 'break-all' }, "aria-label": t('Signing secret'), children: secret }), _jsxs(Button, { size: "sm", variant: "outline", onPress: () => void copy(secret).then((ok) => ok && setNote(t('The secret is copied'))), children: [_jsx(Copy, { size: 14 }), " ", t('Copy')] }), _jsx(XStack, { render: "button", "aria-label": t('Hide the secret'), p: "$1", onPress: () => setSecret(''), children: _jsx(X, { size: 14 }) })] })] })) : null, _jsx(Group, { title: t('Webhooks'), children: list.error ? (_jsx(Soft, { children: told(list.error, t) })) : list.loading && !list.value.length ? (_jsx(Soft, { children: t('Reading webhooks…') })) : list.value.length === 0 ? (_jsx(Card, { children: _jsx(Soft, { children: t('No webhooks yet.') }) })) : (_jsx(Card, { children: list.value.map((e, i) => (_jsxs(YStack, { borderTopWidth: i ? 1 : 0, borderColor: "$borderColor", children: [_jsx(Row, { first: true, mono: true, leading: _jsx(Webhook, { size: 16 }), title: e.url, detail: [
103
104
  e.description,
104
105
  e.events.length ? e.events.join(', ') : t('every event'),
105
106
  e.status === 'disabled' ? t('disabled') : '',
package/lib/shelf.d.ts CHANGED
@@ -9,5 +9,8 @@
9
9
  * Its repository is the one its builds are cut from, by a GitHub address in any
10
10
  * form GitHub hands out (address.ts), with the branch whose pushes rebuild it.
11
11
  */
12
- export declare function Sites(): import("react").JSX.Element;
12
+ export declare function Sites({ q, onMatch }?: {
13
+ q?: string;
14
+ onMatch?: (n: number) => void;
15
+ }): import("react").JSX.Element | null;
13
16
  export declare function Templates(): import("react").JSX.Element;