@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
@@ -12,12 +12,12 @@ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-run
12
12
  */
13
13
  import { SizableText, useMedia, XStack, YStack } from '@hanzo/gui';
14
14
  import { useI18n } from '@hanzo/i18n/react';
15
- import { Check, Plus, X } from '@hanzogui/lucide-icons-2';
16
- import { Button, Dialog, DialogContent, DialogTitle } from '@hanzo/ui';
17
- import { useEffect, useState } from 'react';
15
+ import { Check, MoreHorizontal, Plus, X } from '@hanzogui/lucide-icons-2';
16
+ import { Button, Dialog, DialogContent, DialogTitle, Skeleton } from '@hanzo/ui';
17
+ import { useEffect, useId, useState } from 'react';
18
+ import { RING } from '../pane.js';
18
19
  import { useHost } from '../host.js';
19
20
  import { say } from './say.js';
20
- export const mono = { fontFamily: 'var(--f-mono, ui-monospace, monospace)' };
21
21
  /** Tells the shell how many are yours, whenever that changes. */
22
22
  export function useCount(n, onCount) {
23
23
  useEffect(() => onCount(n), [n, onCount]);
@@ -26,12 +26,12 @@ export function useCount(n, onCount) {
26
26
  export { matches } from '../merge.js';
27
27
  /** Cards in as many columns as fit, one column on a phone. */
28
28
  export function Grid({ children, label }) {
29
- return (_jsx("div", { role: "list", "aria-label": label, style: { display: 'grid', gridTemplateColumns: 'repeat(auto-fill, minmax(min(100%, 280px), 1fr))', gap: 12 }, children: children }));
29
+ return (_jsx(YStack, { role: "list", "aria-label": label, display: "grid", gridTemplateColumns: "repeat(auto-fill, minmax(min(100%, 290px), 1fr))", gap: "$3.5", width: "100%", children: children }));
30
30
  }
31
31
  /** A square with the thing's picture, or its initial. */
32
32
  export function Mark({ name, logo, icon, size = 32 }) {
33
33
  const [gone, setGone] = useState(false);
34
- return (_jsx(YStack, { width: size, height: size, rounded: "$3", bg: "$raised", items: "center", justify: "center", shrink: 0, overflow: "hidden", "aria-hidden": true, children: logo && !gone ? (_jsx("img", { src: logo, alt: "", width: size, height: size, onError: () => setGone(true), style: { objectFit: 'contain' } })) : ((icon ?? (_jsx(SizableText, { size: "$3", color: "$ink", children: (name.trim().charAt(0) || '?').toUpperCase() })))) }));
34
+ return (_jsx(YStack, { width: size, height: size, rounded: "$3", bg: "$raised", items: "center", justify: "center", shrink: 0, overflow: "hidden", "aria-hidden": true, children: logo && !gone ? (_jsx(YStack, { render: "img", ...{ src: logo, alt: '', onError: () => setGone(true) }, width: size, height: size, "$platform-web": { objectFit: 'contain' } })) : ((icon ?? (_jsx(SizableText, { size: "$3", color: "$ink", children: (name.trim().charAt(0) || '?').toUpperCase() })))) }));
35
35
  }
36
36
  /**
37
37
  * One card: what it is, a few lines about it, a quiet fact under them, and its
@@ -40,12 +40,12 @@ export function Mark({ name, logo, icon, size = 32 }) {
40
40
  */
41
41
  export function Tile({ title, detail, meta, mark, action, onOpen, }) {
42
42
  const body = (_jsxs(_Fragment, { children: [mark, _jsxs(YStack, { flex: 1, minW: 0, gap: "$1", children: [_jsx(SizableText, { size: "$3", color: "$ink", numberOfLines: 1, children: title }), detail ? (_jsx(SizableText, { size: "$1", color: "$soft", numberOfLines: 3, children: detail })) : null, meta ? (_jsx(SizableText, { size: "$1", color: "$soft", numberOfLines: 1, opacity: 0.8, children: meta })) : null] })] }));
43
- return (_jsxs(XStack, { role: "listitem", items: "flex-start", gap: "$2", p: "$3", minW: 0, rounded: "$4", borderWidth: 1, borderColor: "$borderColor", bg: "$panel", hoverStyle: onOpen ? { borderColor: '$edge' } : undefined, children: [onOpen ? (_jsx(XStack, { render: "button", "aria-label": title, onPress: onOpen, flex: 1, minW: 0, gap: "$3", items: "flex-start", cursor: "pointer", "$platform-web": { textAlign: 'start' }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: 'solid', outlineColor: '$outlineColor' }, children: body })) : (_jsx(XStack, { flex: 1, minW: 0, gap: "$3", items: "flex-start", children: body })), action] }));
43
+ return (_jsxs(XStack, { role: "listitem", items: "flex-start", gap: "$2", p: "$3", minW: 0, rounded: "$4", borderWidth: 1, borderColor: "$borderColor", bg: "$panel", hoverStyle: onOpen ? { borderColor: '$edge' } : undefined, children: [onOpen ? (_jsx(XStack, { render: "button", "aria-label": title, onPress: onOpen, flex: 1, minW: 0, gap: "$3", items: "flex-start", cursor: "pointer", "$platform-web": { textAlign: 'start' }, focusVisibleStyle: RING, children: body })) : (_jsx(XStack, { flex: 1, minW: 0, gap: "$3", items: "flex-start", children: body })), action] }));
44
44
  }
45
45
  /** The one card the shelf puts first, drawn larger. */
46
46
  export function Featured({ title, detail, meta, mark, action, onOpen }) {
47
47
  const { t } = useI18n();
48
- return (_jsxs(XStack, { items: "flex-start", gap: "$4", p: "$4", rounded: "$4", borderWidth: 1, borderColor: "$borderColor", bg: "$panel", flexWrap: "wrap", rowGap: "$3", children: [_jsxs(XStack, { render: "button", "aria-label": title, onPress: onOpen, flex: 1, minW: 220, gap: "$4", items: "flex-start", cursor: "pointer", "$platform-web": { textAlign: 'start' }, children: [mark, _jsxs(YStack, { flex: 1, minW: 0, gap: "$1.5", children: [_jsx(SizableText, { size: "$1", color: "$soft", textTransform: "uppercase", letterSpacing: 1, children: t('Featured') }), _jsx(SizableText, { size: "$6", color: "$ink", numberOfLines: 1, children: title }), _jsx(SizableText, { size: "$2", color: "$soft", numberOfLines: 3, children: detail }), _jsx(SizableText, { size: "$1", color: "$soft", numberOfLines: 1, children: meta })] })] }), action] }));
48
+ return (_jsxs(XStack, { items: "flex-start", gap: "$4", p: "$4", rounded: "$4", borderWidth: 1, borderColor: "$borderColor", bg: "$panel", flexWrap: "wrap", rowGap: "$3", children: [_jsxs(XStack, { render: "button", "aria-label": title, onPress: onOpen, flex: 1, minW: 220, gap: "$4", items: "flex-start", cursor: "pointer", "$platform-web": { textAlign: 'start' }, children: [mark, _jsxs(YStack, { flex: 1, minW: 0, gap: "$1.5", children: [_jsx(SizableText, { size: "$1", color: "$soft", fontWeight: "500", children: t('Featured') }), _jsx(SizableText, { size: "$6", color: "$ink", numberOfLines: 1, children: title }), _jsx(SizableText, { size: "$2", color: "$soft", numberOfLines: 3, children: detail }), _jsx(SizableText, { size: "$1", color: "$soft", numberOfLines: 1, children: meta })] })] }), action] }));
49
49
  }
50
50
  /** A card's add control: Add (Use, for a template one is made from) while it is not yours, Added once it is. */
51
51
  export function Add({ name, added, busy, onPress, use = false }) {
@@ -87,7 +87,7 @@ const SCREEN = {
87
87
  export function Sheet({ title, open, onOpenChange, width = 560, full = false, children }) {
88
88
  const { t } = useI18n();
89
89
  const screen = full && !useMedia().sm;
90
- return (_jsx(Dialog, { open: open, onOpenChange: onOpenChange, children: _jsxs(DialogContent, { maxW: width, showCloseButton: false, maxH: "88vh", gap: "$3", tabIndex: -1, focusVisibleStyle: { outlineWidth: 0 }, ...(screen ? SCREEN : null), children: [_jsxs(XStack, { items: "center", justify: "space-between", gap: "$2", children: [_jsx(DialogTitle, { numberOfLines: 1, flex: 1, children: title }), _jsx(XStack, { render: "button", "aria-label": t('Close'), onPress: () => onOpenChange(false), width: 32, height: 32, mr: -6, rounded: 999, items: "center", justify: "center", shrink: 0, cursor: "pointer", hoverStyle: { bg: '$hover' }, "$max-sm": { width: 44, height: 44, mr: -12 }, children: _jsx(X, { size: 16 }) })] }), _jsx(YStack, { gap: "$3", overflow: "scroll", minH: 0, shrink: 1, children: children })] }) }));
90
+ return (_jsx(Dialog, { open: open, onOpenChange: onOpenChange, children: _jsxs(DialogContent, { maxW: width, showCloseButton: false, maxH: "88vh", gap: "$3", tabIndex: -1, focusVisibleStyle: { outlineWidth: 0 }, ...(screen ? SCREEN : null), children: [_jsxs(XStack, { items: "center", justify: "space-between", gap: "$2", children: [_jsx(DialogTitle, { numberOfLines: 1, flex: 1, children: title }), _jsx(XStack, { render: "button", "aria-label": t('Close'), onPress: () => onOpenChange(false), width: 32, height: 32, mr: -6, rounded: 999, items: "center", justify: "center", shrink: 0, cursor: "pointer", hoverStyle: { bg: '$hover' }, focusVisibleStyle: RING, "$max-sm": { width: 44, height: 44, mr: -12 }, children: _jsx(X, { size: 16 }) })] }), _jsx(YStack, { gap: "$3", overflow: "scroll", minH: 0, shrink: 1, children: children })] }) }));
91
91
  }
92
92
  /** Asks before a delete; says what goes with it. `what` is the thing's name, `says` comes already said. */
93
93
  export function Confirm({ what, says, open, onOpenChange, onYes }) {
@@ -121,7 +121,7 @@ export function Failed({ error, onRetry }) {
121
121
  }
122
122
  /** Nothing here yet: what this place holds, and the next step, as buttons. */
123
123
  export function Empty({ title, detail, children }) {
124
- return (_jsxs(YStack, { py: "$8", px: "$4", items: "center", gap: "$3", rounded: "$4", borderWidth: 1, borderStyle: "dashed", borderColor: "$borderColor", children: [_jsxs(YStack, { items: "center", gap: "$1", maxW: 420, children: [_jsx(SizableText, { size: "$4", color: "$ink", text: "center", children: title }), _jsx(SizableText, { size: "$2", color: "$soft", text: "center", children: detail })] }), children ? (_jsx(XStack, { gap: "$2", flexWrap: "wrap", justify: "center", children: children })) : null] }));
124
+ return (_jsxs(YStack, { py: "$8", px: "$5", items: "center", gap: "$3", rounded: "$4", borderWidth: 1, borderColor: "var(--border-strong)", bg: "$panel", children: [_jsxs(YStack, { items: "center", gap: "$1.5", maxW: 420, children: [_jsx(SizableText, { size: "$4", fontWeight: "600", color: "$ink", text: "center", children: title }), detail ? (_jsx(SizableText, { size: "$2", color: "$soft", text: "center", children: detail })) : null] }), children ? (_jsx(XStack, { gap: "$2", flexWrap: "wrap", justify: "center", children: children })) : null] }));
125
125
  }
126
126
  /** What a signed-out visitor is told, with the one control that signs them in. */
127
127
  export function Visitor({ children }) {
@@ -137,7 +137,7 @@ export function Line({ children }) {
137
137
  }
138
138
  /** A small heading over a run of cards. */
139
139
  export function Part({ title, detail, action, children }) {
140
- return (_jsxs(YStack, { gap: "$2.5", render: "section", "aria-label": title, children: [_jsxs(XStack, { items: "center", gap: "$3", children: [_jsxs(YStack, { flex: 1, minW: 0, gap: "$0.5", children: [_jsx(SizableText, { render: "h2", size: "$4", color: "$ink", children: title }), _jsx(SizableText, { size: "$2", color: "$soft", children: detail })] }), action] }), children] }));
140
+ return (_jsxs(YStack, { gap: "$2.5", render: "section", "aria-label": title, children: [_jsxs(XStack, { items: "center", gap: "$3", children: [_jsxs(YStack, { flex: 1, minW: 0, gap: "$0.5", children: [_jsx(SizableText, { render: "h2", size: "$4", color: "$ink", children: title }), detail ? (_jsx(SizableText, { size: "$2", color: "$soft", children: detail })) : null] }), action] }), children] }));
141
141
  }
142
142
  /** A labelled control, with a line under it when there is more to say. */
143
143
  export function Field({ label, hint, children }) {
@@ -146,7 +146,84 @@ export function Field({ label, hint, children }) {
146
146
  /** Two or three choices side by side; the chosen one is filled. A count, when one is given, follows its label. Labels come already said. */
147
147
  export function Choice({ value, options, onChange, label, }) {
148
148
  const { t } = useI18n();
149
- return (_jsx(XStack, { role: "group", "aria-label": label, p: 2, gap: 2, rounded: "$3", borderWidth: 1, borderColor: "$borderColor", self: "flex-start", shrink: 0, children: options.map((o) => (_jsxs(XStack, { render: "button", "aria-pressed": o.id === value, "aria-label": o.count ? t('{label}, {count}', { label: o.label, count: o.count }) : o.label, onPress: () => onChange(o.id), items: "center", gap: "$1.5", px: "$3", py: "$1", rounded: "$2", bg: o.id === value ? '$hover' : 'transparent', hoverStyle: { bg: '$hover' }, children: [_jsx(SizableText, { size: "$2", color: o.id === value ? '$ink' : '$soft', children: o.label }), o.count ? (_jsx(SizableText, { size: "$1", color: "$soft", fontVariant: ['tabular-nums'], children: o.count })) : null] }, o.id))) }));
149
+ const groupId = useId();
150
+ return (_jsx(XStack, { role: "group", "aria-label": label, p: 2, gap: 2, rounded: "$3", borderWidth: 1, borderColor: "var(--border-strong)", bg: "$panel", self: "flex-start", shrink: 0, children: options.map((o, idx) => {
151
+ const active = o.id === value;
152
+ return (_jsxs(XStack, { id: `${groupId}-${idx}`, render: "button", "aria-pressed": active, "aria-label": o.count ? t('{label}, {count}', { label: o.label, count: o.count }) : o.label, onPress: () => onChange(o.id), onKeyDown: (e) => {
153
+ const step = e.key === 'ArrowRight' ? 1 : e.key === 'ArrowLeft' ? -1 : 0;
154
+ if (!step)
155
+ return;
156
+ e.preventDefault?.();
157
+ const nextIdx = (idx + step + options.length) % options.length;
158
+ const next = options[nextIdx];
159
+ if (!next)
160
+ return;
161
+ onChange(next.id);
162
+ queueMicrotask(() => document.getElementById(`${groupId}-${nextIdx}`)?.focus());
163
+ }, items: "center", gap: "$1.5", px: "$3", py: "$1", minH: 30, focusVisibleStyle: RING, children: [_jsx(SizableText, { size: "$2", fontWeight: active ? '500' : '400', color: active ? '$ink' : '$soft', children: o.label }), o.count ? (_jsx(SizableText, { size: "$1", color: "$soft", fontVariant: ['tabular-nums'], children: o.count })) : null] }, o.id));
164
+ }) }));
165
+ }
166
+ /**
167
+ * Compact filter pills for long category lists (e.g., agent categories): shows one clean
168
+ * primary row on desktop (`maxVisibleDesktop`, default 6) and `mobileLimit` (default 4)
169
+ * on narrow screens, collapsing the rest behind a `+{n} more` / `Show less` toggle pill
170
+ * while keeping the active category always visible in the primary row.
171
+ */
172
+ export function FilterPills({ value, options, onChange, label, mobileLimit = 4, maxVisibleDesktop = 6, }) {
173
+ const { t } = useI18n();
174
+ const wide = Boolean(useMedia().sm);
175
+ const groupId = useId();
176
+ const [expanded, setExpanded] = useState(false);
177
+ const limit = Math.max(1, wide ? maxVisibleDesktop : mobileLimit);
178
+ const hasOverflow = options.length > limit;
179
+ const compact = !expanded && hasOverflow;
180
+ const visible = compact
181
+ ? (() => {
182
+ const base = options.slice(0, limit);
183
+ if (base.some((o) => o.id === value))
184
+ return base;
185
+ const chosen = options.find((o) => o.id === value);
186
+ return chosen ? [...base.slice(0, Math.max(1, limit - 1)), chosen] : base;
187
+ })()
188
+ : options;
189
+ const hiddenCount = options.length - visible.length;
190
+ const moveFocus = (nextIdx) => {
191
+ const clamped = (nextIdx + visible.length) % visible.length;
192
+ queueMicrotask(() => document.getElementById(`${groupId}-pill-${clamped}`)?.focus());
193
+ };
194
+ return (_jsxs(XStack, { role: "group", "aria-label": label, flexWrap: "wrap", gap: "$1.5", rowGap: "$1.5", width: "100%", onKeyDown: ((e) => {
195
+ if (e.key === 'Escape' && expanded)
196
+ setExpanded(false);
197
+ }), children: [visible.map((o, idx) => {
198
+ const active = o.id === value;
199
+ return (_jsx(XStack, { id: `${groupId}-pill-${idx}`, render: "button", "aria-pressed": active, "aria-label": o.label, onPress: () => onChange(o.id), onKeyDown: ((e) => {
200
+ if (e.key === 'ArrowRight') {
201
+ e.preventDefault?.();
202
+ moveFocus(idx + 1);
203
+ }
204
+ else if (e.key === 'ArrowLeft') {
205
+ e.preventDefault?.();
206
+ moveFocus(idx - 1);
207
+ }
208
+ else if (e.key === 'Home') {
209
+ e.preventDefault?.();
210
+ moveFocus(0);
211
+ }
212
+ else if (e.key === 'End') {
213
+ e.preventDefault?.();
214
+ moveFocus(visible.length - 1);
215
+ }
216
+ }), items: "center", px: "$3", py: "$1", minH: 30, focusVisibleStyle: RING, children: _jsx(SizableText, { size: "$1", fontWeight: active ? '500' : '400', color: active ? '$background' : '$soft', children: o.label }) }, o.id));
217
+ }), hasOverflow ? (_jsx(XStack, { render: "button", "aria-expanded": expanded, "aria-label": expanded ? t('Show fewer categories') : t('Show {n} more categories', { n: hiddenCount }), onPress: () => setExpanded((e) => !e), items: "center", px: "$3", py: "$1", minH: 30, focusVisibleStyle: RING, children: _jsx(SizableText, { size: "$1", fontWeight: "500", color: "$ink", children: expanded ? t('Show less') : t('+{n} more', { n: hiddenCount }) }) })) : null] }));
150
218
  }
151
219
  /** A date from Unix seconds, or ''. */
152
220
  export const day = (s) => (s ? new Date(s * 1000).toLocaleDateString(undefined, { year: 'numeric', month: 'short', day: 'numeric' }) : '');
221
+ export function TilesSkeleton({ label, count = 6, withHero = false }) {
222
+ return (_jsxs(YStack, { role: "status", "aria-busy": true, "aria-label": label, gap: "$3", width: "100%", children: [withHero ? (_jsxs(XStack, { items: "flex-start", gap: "$4", p: "$4", rounded: "$4", borderWidth: 1, borderColor: "$borderColor", bg: "$panel", children: [_jsx(Skeleton, { layout: "block", width: 48, height: 48, rounded: "$3", shrink: 0 }), _jsxs(YStack, { flex: 1, minW: 0, gap: "$2", children: [_jsx(Skeleton, { layout: "block", width: 64, height: 10, rounded: "$2" }), _jsx(Skeleton, { layout: "block", width: "42%", height: 18, rounded: "$2" }), _jsx(Skeleton, { layout: "block", width: "84%", height: 12, rounded: "$2" }), _jsx(Skeleton, { layout: "block", width: "32%", height: 10, rounded: "$2" })] })] })) : null, _jsx(Grid, { label: label, children: Array.from({ length: count }, (_, i) => (_jsxs(XStack, { items: "flex-start", gap: "$3", p: "$3", rounded: "$4", borderWidth: 1, borderColor: "$borderColor", bg: "$panel", children: [_jsx(Skeleton, { layout: "block", width: 32, height: 32, rounded: "$3", shrink: 0 }), _jsxs(YStack, { flex: 1, minW: 0, gap: "$1.5", children: [_jsx(Skeleton, { layout: "block", width: i % 2 === 0 ? '54%' : '44%', height: 14, rounded: "$2" }), _jsx(Skeleton, { layout: "block", width: "90%", height: 11, rounded: "$2" }), _jsx(Skeleton, { layout: "block", width: i % 2 === 0 ? '64%' : '72%', height: 11, rounded: "$2" })] })] }, i))) })] }));
223
+ }
224
+ export function RowsSkeleton({ label, count = 4 }) {
225
+ return (_jsx(YStack, { role: "status", "aria-busy": true, "aria-label": label, gap: "$2", width: "100%", children: Array.from({ length: count }, (_, i) => (_jsxs(XStack, { items: "center", gap: "$3", px: "$3", py: "$2.5", minH: 48, rounded: "$3", borderWidth: 1, borderColor: "$borderColor", bg: "$panel", children: [_jsxs(YStack, { flex: 1, minW: 0, gap: "$1.5", children: [_jsx(Skeleton, { layout: "block", width: i % 2 === 0 ? '38%' : '48%', height: 13, rounded: "$2" }), _jsx(Skeleton, { layout: "block", width: i % 2 === 0 ? '74%' : '62%', height: 10, rounded: "$2" })] }), _jsx(Skeleton, { layout: "block", width: 28, height: 14, rounded: "$2", shrink: 0 })] }, i))) }));
226
+ }
227
+ export function MenuTrigger({ label }) {
228
+ return (_jsx(XStack, { render: "button", "aria-label": label, width: 32, height: 32, items: "center", justify: "center", shrink: 0, focusVisibleStyle: RING, children: _jsx(MoreHorizontal, { size: 15, color: "$soft", "aria-hidden": true }) }));
229
+ }
package/lib/desk.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { type DropdownMenuProps } from '@hanzo/ui';
2
2
  import type { Event } from './api/sessions.ts';
3
3
  import type { Deck, Tabs } from './tabs.ts';
4
- /** A run's panel before anyone has arranged it: what a run is read by, the terminal chosen. */
4
+ /** A run's panel before anyone has arranged it: Preview chosen first so live output opens immediately. */
5
5
  export declare const SEED: Tabs;
6
6
  export declare function Desk({ id, repo, branch, base, environment, mode, pr, title, project, sandbox, site, published, events, live, menu, refused, retry, onRetry, side, sheet, onHide, envColumn, splitPanes, onCloseSplitPane, onExpandSplitPane, }: {
7
7
  id: string;
package/lib/desk.js CHANGED
@@ -14,15 +14,17 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
14
14
  */
15
15
  import { SizableText, XStack, YStack } from '@hanzo/gui';
16
16
  import { useI18n } from '@hanzo/i18n/react';
17
- import { ChevronRight, ExternalLink, Folder, GitBranch, GitPullRequest, Globe, Info, Laptop, Maximize2, MoreHorizontal, RefreshCcw, Square, SquareTerminal, X } from '@hanzogui/lucide-icons-2';
17
+ import { ExternalLink, Folder, GitBranch, GitPullRequest, Globe, Info, Laptop, Maximize2, MoreHorizontal, RefreshCcw, Square, SquareTerminal, X } from '@hanzogui/lucide-icons-2';
18
18
  import { Button, DropdownMenu, Switch } from '@hanzo/ui';
19
- import { PreviewFrame } from '@hanzo/ui/agents';
19
+ import { Console, DEVICES, PreviewFrame, Views } from '@hanzo/ui/agents';
20
20
  import { useCallback, useEffect, useRef, useState } from 'react';
21
+ import { RING } from './pane.js';
21
22
  import { read as readChanges } from './api/changes.js';
22
23
  import { read as readEnvironment } from './api/environment.js';
23
24
  import { park, ports as listening, preview, sandbox as look, serve, served, wake } from './api/sandbox.js';
24
25
  import { cards, failure, shell, steps } from './api/turn.js';
25
26
  import { useKept, useRead } from './data.js';
27
+ import { formatDeviceLabel, useDevMode } from './dev-mode.js';
26
28
  import { Door } from './door.js';
27
29
  import { Environment } from './environment.js';
28
30
  import { Artifacts, Files } from './files.js';
@@ -30,7 +32,7 @@ import { Git } from './git.js';
30
32
  import { useHost, useTarget } from './host.js';
31
33
  import { away, Out } from './out.js';
32
34
  import { Panel } from './panel.js';
33
- /** A run's panel before anyone has arranged it: what a run is read by, the terminal chosen. */
35
+ /** A run's panel before anyone has arranged it: Preview chosen first so live output opens immediately. */
34
36
  export const SEED = {
35
37
  tabs: [
36
38
  { id: 'preview', kind: 'preview', title: 'Preview' },
@@ -39,13 +41,14 @@ export const SEED = {
39
41
  { id: 'diff', kind: 'diff', title: 'Diff' },
40
42
  { id: 'terminal', kind: 'terminal', title: 'Terminal' },
41
43
  ],
42
- at: 'terminal',
44
+ at: 'preview',
43
45
  };
44
46
  /** How often the sandbox's state, and what it serves, is read while the panel is open. */
45
47
  const EVERY = 10_000;
46
48
  const PORTS = 5_000;
47
49
  export function Desk({ id, repo, branch, base, environment, mode, pr, title, project, sandbox, site, published, events, live, menu, refused, retry, onRetry, side, sheet, onHide, envColumn = false, splitPanes = [], onCloseSplitPane, onExpandSplitPane, }) {
48
50
  const { t: say } = useI18n();
51
+ const [devMode] = useDevMode();
49
52
  const name = repo.split('/').filter(Boolean).pop() || repo;
50
53
  const lines = shell(events);
51
54
  const failed = failure(events, say);
@@ -66,12 +69,12 @@ export function Desk({ id, repo, branch, base, environment, mode, pr, title, pro
66
69
  render: () => _jsx(Artifacts, { session: id, sandbox: sandbox, repo: repo, branch: branch, mode: mode, project: project, site: site, pr: pr, onEnvironment: environ }),
67
70
  },
68
71
  { id: 'files', label: say('Files'), render: () => _jsx(Files, { session: id, repo: repo, branch: branch, sandbox: sandbox, live: held === 'running' }) },
69
- { id: 'diff', label: say('Diff'), render: () => _jsx(Git, { session: id, title: title, live: live }) },
72
+ { id: 'diff', label: devMode ? say('Diff') : say('Changes'), render: () => _jsx(Git, { session: id, title: title, live: live }) },
70
73
  {
71
74
  id: 'terminal',
72
- label: say('Terminal'),
75
+ label: devMode ? say('Terminal') : say('Activity'),
73
76
  bleed: true,
74
- render: () => _jsx(Terminal, { id: id, sandbox: sandbox, held: held, lines: lines, live: live, failed: failed, refused: refused, retry: retry, onRetry: onRetry }),
77
+ render: () => (_jsx(Terminal, { id: id, sandbox: sandbox, held: held, lines: lines, live: live, failed: failed, refused: refused, retry: retry, onRetry: onRetry, devMode: devMode })),
75
78
  },
76
79
  { id: 'desktop', label: say('Desktop'), bleed: true, render: () => _jsx(Door, { which: "screen", sandbox: sandbox, held: held, session: id }) },
77
80
  {
@@ -80,23 +83,27 @@ export function Desk({ id, repo, branch, base, environment, mode, pr, title, pro
80
83
  render: () => (_jsxs(YStack, { gap: "$2", children: [_jsx(Environment, { repo: name, busy: live && mode === 'setup' }), _jsx(SizableText, { size: "$2", color: "$ink", pt: "$4", children: say('This run') }), _jsx(Fact, { label: say('Run'), value: id }), _jsx(Fact, { label: say('Repository'), value: name || '—' }), _jsx(Fact, { label: say('Branch'), value: branch || '—' }), _jsx(Fact, { label: say('Base'), value: base || '—' }), _jsx(Fact, { label: say('Runs on'), value: environment || 'sandbox' }), _jsx(Fact, { label: say('Sandbox'), value: sandbox || '—' }), _jsx(Fact, { label: say('Mode'), value: mode || 'build' })] })),
81
84
  },
82
85
  ];
83
- const panelNode = splitPanes.length >= 2 && !sheet ? (_jsx(YStack, { flex: 1, minW: 0, minH: 0, display: "grid", gridTemplateColumns: splitPanes.length > 1 ? 'repeat(2, minmax(0, 1fr))' : 'minmax(0, 1fr)', gridTemplateRows: splitPanes.length > 2 ? 'repeat(2, minmax(0, 1fr))' : 'minmax(0, 1fr)', bg: "$background", children: splitPanes.map((pid, idx) => {
86
+ const panelNode = splitPanes.length >= 2 && !sheet ? (_jsx(YStack, { flex: 1, minW: 0, minH: 0, display: "grid", gridTemplateColumns: splitPanes.length > 1 ? 'repeat(2, minmax(0, 1fr))' : 'minmax(0, 1fr)', "$max-lg": { gridTemplateColumns: 'minmax(0, 1fr)' }, gridTemplateRows: splitPanes.length > 2 ? 'repeat(2, minmax(0, 1fr))' : 'minmax(0, 1fr)', bg: "$background", children: splitPanes.map((pid, idx) => {
84
87
  const k = kinds.find((x) => x.id === pid);
85
88
  if (!k)
86
89
  return null;
87
90
  const headerTitle = pid === 'diff'
88
- ? `${base || 'main'} → ${branch || 'HEAD'}`
91
+ ? devMode
92
+ ? `${base || 'main'} → ${branch || 'HEAD'}`
93
+ : say('Changes')
89
94
  : pid === 'terminal'
90
- ? `${say('Terminal')} ${name || 'workspace'}`
95
+ ? devMode
96
+ ? `${say('Terminal')} ${name || 'workspace'}`
97
+ : say('Activity')
91
98
  : pid === 'preview'
92
- ? say('New tab')
99
+ ? say('Preview')
93
100
  : k.label;
94
- return (_jsxs(YStack, { minW: 0, minH: 0, borderLeftWidth: idx % 2 === 1 ? 1 : 0, borderTopWidth: idx >= 2 ? 1 : 0, borderColor: "$borderColor", display: "grid", gridTemplateRows: "auto minmax(0, 1fr)", children: [_jsxs(XStack, { px: "$2.5", py: "$1.5", gap: "$1.5", items: "center", borderBottomWidth: 1, borderColor: "$borderColor", minH: 36, children: [_jsx(SizableText, { flex: 1, minW: 0, size: "$2", color: "$ink", numberOfLines: 1, children: headerTitle }), onExpandSplitPane ? (_jsx(XStack, { render: "button", "aria-label": say('Expand {pane}', { pane: k.label }), onPress: () => onExpandSplitPane(pid), p: "$1", rounded: "$2", hoverStyle: { bg: '$hover' }, children: _jsx(Maximize2, { size: 13, opacity: 0.7 }) })) : null, onCloseSplitPane ? (_jsx(XStack, { render: "button", "aria-label": say('Close {pane}', { pane: k.label }), onPress: () => onCloseSplitPane(pid), p: "$1", rounded: "$2", hoverStyle: { bg: '$hover' }, children: _jsx(X, { size: 14, opacity: 0.7 }) })) : null] }), _jsx(YStack, { flex: 1, minH: 0, overflow: k.bleed ? 'hidden' : 'scroll', ...(k.bleed ? null : { p: '$3' }), children: k.render() })] }, pid));
101
+ return (_jsxs(YStack, { minW: 0, minH: 0, borderLeftWidth: idx % 2 === 1 ? 1 : 0, borderTopWidth: idx >= 2 ? 1 : 0, "$max-lg": { borderLeftWidth: 0, borderTopWidth: idx > 0 ? 1 : 0 }, borderColor: "$borderColor", display: "grid", gridTemplateRows: "auto minmax(0, 1fr)", children: [_jsxs(XStack, { px: "$2.5", py: "$1.5", gap: "$1.5", items: "center", borderBottomWidth: 1, borderColor: "$borderColor", minH: 36, children: [_jsx(SizableText, { flex: 1, minW: 0, size: "$2", color: "$ink", numberOfLines: 1, children: headerTitle }), onExpandSplitPane ? (_jsx(XStack, { render: "button", "aria-label": say('Expand {pane}', { pane: k.label }), onClick: () => onExpandSplitPane(pid), minW: 30, minH: 30, items: "center", justify: "center", rounded: "$2", hoverStyle: { bg: '$hover' }, focusVisibleStyle: RING, children: _jsx(Maximize2, { size: 13, opacity: 0.7 }) })) : null, onCloseSplitPane ? (_jsx(XStack, { render: "button", "aria-label": say('Close {pane}', { pane: k.label }), onClick: () => onCloseSplitPane(pid), minW: 30, minH: 30, items: "center", justify: "center", rounded: "$2", hoverStyle: { bg: '$hover' }, focusVisibleStyle: RING, children: _jsx(X, { size: 14, opacity: 0.7 }) })) : null] }), _jsx(YStack, { flex: 1, minH: 0, overflow: k.bleed ? 'hidden' : 'scroll', ...(k.bleed ? null : { p: '$3' }), children: k.render() })] }, pid));
95
102
  }) })) : (_jsx(Panel, { side: side, kinds: kinds, sheet: sheet, onHide: onHide, label: say('Run details'),
96
103
  // An empty tab offers what this run made: its site and its pull request.
97
- suggested: [...(site ? [{ title: name || site, url: site }] : []), ...(pr.href ? [{ title: say('Pull request {pr}', { pr: pr.label }), url: pr.href }] : [])], bar: sandbox ? _jsx(Held, { box: box, live: live }) : null, menu: _jsx(DropdownMenu, { trigger: _jsx(XStack, { render: "button", "aria-label": say('Run actions'), p: "$1.5", rounded: "$2", hoverStyle: { bg: '$hover' }, children: _jsx(MoreHorizontal, { size: 16 }) }), items: [...menu, { key: 'details', label: say('Details'), icon: _jsx(Info, { size: 16 }), onSelect: environ }] }) }));
104
+ suggested: [...(site ? [{ title: name || site, url: site }] : []), ...(pr.href ? [{ title: say('Pull request {pr}', { pr: pr.label }), url: pr.href }] : [])], bar: sandbox ? _jsx(Held, { box: box, live: live, devMode: devMode }) : null, menu: _jsx(DropdownMenu, { trigger: _jsx(XStack, { render: "button", "aria-label": say('Run actions'), p: "$1.5", rounded: "$2", hoverStyle: { bg: '$hover' }, children: _jsx(MoreHorizontal, { size: 16 }) }), items: [...menu, { key: 'details', label: say('Details'), icon: _jsx(Info, { size: 16 }), onSelect: environ }] }) }));
98
105
  if (envColumn && !sheet) {
99
- return (_jsxs(XStack, { flex: 1, minW: 0, minH: 0, width: "100%", height: "100%", children: [_jsx(EnvironmentInspection, { id: id, repo: repo, name: name, branch: branch, environment: environment, pr: pr, title: title, events: events, live: live, onOpenEnvironment: environ, onOpenDiff: () => side.open({ kind: 'diff', title: say('Diff') }) }), _jsx(YStack, { flex: 1, minW: 0, minH: 0, borderLeftWidth: 1, borderColor: "$borderColor", children: panelNode })] }));
106
+ return (_jsxs(XStack, { flex: 1, minW: 0, minH: 0, width: "100%", height: "100%", children: [_jsx(EnvironmentInspection, { id: id, repo: repo, name: name, branch: branch, environment: environment, pr: pr, title: title, events: events, live: live, devMode: devMode, onOpenEnvironment: environ, onOpenDiff: () => side.open({ kind: 'diff', title: devMode ? say('Diff') : say('Changes') }) }), _jsx(YStack, { flex: 1, minW: 0, minH: 0, borderLeftWidth: 1, borderColor: "$borderColor", children: panelNode })] }));
100
107
  }
101
108
  return panelNode;
102
109
  }
@@ -146,26 +153,39 @@ const until = (ms) => new Date(ms).toLocaleString(undefined, { weekday: 'short',
146
153
  * The sandbox's line under the tabs: where it is, and the one thing to do to it.
147
154
  * A sandbox a run is working in is not suspended from here.
148
155
  */
149
- function Held({ box, live }) {
156
+ function Held({ box, live, devMode }) {
150
157
  const { t } = useI18n();
151
158
  const b = box.value;
152
159
  const state = b?.state ?? 'pending';
153
- const says = state === 'running'
154
- ? t('Sandbox running')
155
- : state === 'parked'
156
- ? b?.ends
157
- ? t('Sandbox suspended · its files are kept until {time}', { time: until(b.ends) })
158
- : t('Sandbox suspended · its files are kept')
159
- : state === 'pending'
160
- ? t('Sandbox starting…')
161
- : state === 'gone'
162
- ? t('Sandbox ended')
163
- : b?.error
164
- ? t('Sandbox unavailable · {error}', { error: b.error })
165
- : t('Sandbox unavailable');
166
- return (_jsxs(XStack, { px: "$3", py: "$1.5", gap: "$2", items: "center", borderBottomWidth: 1, borderColor: "$borderColor", "aria-label": t('Sandbox'), children: [_jsx(YStack, { width: 7, height: 7, rounded: 99, bg: state === 'running' ? '$green10' : state === 'parked' ? '$soft' : '$borderColor' }), _jsx(SizableText, { flex: 1, minW: 0, size: "$1", color: "$soft", numberOfLines: 1, children: box.note || says }), state === 'running' && !live ? (_jsx(Button, { size: "sm", variant: "ghost", disabled: box.busy, onPress: () => box.act('park'), children: t('Suspend') })) : state === 'parked' ? (_jsx(Button, { size: "sm", variant: "outline", disabled: box.busy, onPress: () => box.act('wake'), children: box.busy ? t('Resuming…') : t('Resume') })) : null] }));
160
+ const says = devMode
161
+ ? state === 'running'
162
+ ? t('Sandbox running')
163
+ : state === 'parked'
164
+ ? b?.ends
165
+ ? t('Sandbox suspended · its files are kept until {time}', { time: until(b.ends) })
166
+ : t('Sandbox suspended · its files are kept')
167
+ : state === 'pending'
168
+ ? t('Sandbox starting…')
169
+ : state === 'gone'
170
+ ? t('Sandbox ended')
171
+ : b?.error
172
+ ? t('Sandbox unavailable · {error}', { error: b.error })
173
+ : t('Sandbox unavailable')
174
+ : state === 'running'
175
+ ? t('Cloud workspace ready')
176
+ : state === 'parked'
177
+ ? t('Cloud workspace sleeping · files saved')
178
+ : state === 'pending'
179
+ ? t('Starting cloud workspace…')
180
+ : state === 'gone'
181
+ ? t('Cloud workspace closed')
182
+ : b?.error
183
+ ? t('Cloud workspace unavailable · {error}', { error: b.error })
184
+ : t('Cloud workspace unavailable');
185
+ return (_jsxs(XStack, { px: "$3", py: "$1.5", gap: "$2", rowGap: "$1.5", items: "center", flexWrap: "wrap", borderBottomWidth: 1, borderColor: "$borderColor", "aria-label": devMode ? t('Sandbox') : t('Workspace status'), children: [_jsx(YStack, { width: 7, height: 7, rounded: 99, bg: state === 'running' ? 'var(--state-online)' : state === 'parked' ? '$soft' : '$borderColor', shrink: 0 }), _jsx(SizableText, { flex: 1, minW: 120, size: "$1", color: "$soft", numberOfLines: 1, children: box.note || says }), state === 'running' && !live ? (_jsx(Button, { size: "sm", variant: "ghost", disabled: box.busy, onPress: () => box.act('park'), children: t('Suspend') })) : state === 'parked' ? (_jsx(Button, { size: "sm", variant: "outline", borderColor: "var(--border-strong)", disabled: box.busy, onPress: () => box.act('wake'), children: box.busy ? t('Resuming…') : devMode ? t('Resume') : t('Wake') })) : null] }));
167
186
  }
168
187
  /** What a preview page says of itself, when it cannot serve. */
188
+ const mono = { fontFamily: 'var(--f-mono, ui-monospace, monospace)', whiteSpace: 'pre' };
169
189
  const PREVIEW = 'hanzo-preview';
170
190
  /** How often a preview is opened again on its own before Retry is the person's to press. */
171
191
  const REMINTS = 2;
@@ -317,17 +337,24 @@ const WATCHING = 3_000;
317
337
  function Site({ site, live, held, serving, onStart, onEnvironment, }) {
318
338
  const { t } = useI18n();
319
339
  const frame = useRef(null);
320
- return (_jsxs(YStack, { flex: 1, minH: 0, children: [_jsxs(XStack, { px: "$2", py: "$1.5", gap: "$1.5", items: "center", borderBottomWidth: 1, borderColor: "$borderColor", children: [_jsx(XStack, { render: "button", "aria-label": t('Reload the page'), onPress: () => frame.current?.reload(), p: "$1.5", rounded: "$2", hoverStyle: { bg: '$hover' }, children: _jsx(RefreshCcw, { size: 14 }) }), _jsx(SizableText, { flex: 1, minW: 0, size: "$1", color: "$soft", numberOfLines: 1, style: mono, children: site || t('Nothing is serving yet') }), site ? (_jsx(Out, { href: site, label: t('Open in a new tab'), children: _jsx(XStack, { p: "$1.5", rounded: "$2", hoverStyle: { bg: '$hover' }, children: _jsx(ExternalLink, { size: 14 }) }) })) : null] }), _jsx(PreviewFrame, { ref: frame, src: site, title: t('Where this run is published'), device: "desktop", empty: _jsxs(YStack, { items: "center", gap: "$2.5", p: "$6", children: [_jsx(Globe, { size: 28, opacity: 0.45 }), _jsx(SizableText, { size: "$3", color: "$ink", children: t('Nothing is serving yet') }), _jsx(SizableText, { size: "$2", color: "$soft", style: { textAlign: 'center', maxWidth: 280 }, children: held === 'parked'
340
+ const [device, setDevice] = useState('desktop');
341
+ const [dock, setDock] = useKept('hanzo.build.dock', 36);
342
+ const [lines, setLines] = useState([]);
343
+ const onBridge = (e) => {
344
+ if (e.type === 'preview:console')
345
+ setLines((was) => [...was.slice(-400), { id: `p${was.length}-${Date.now()}`, level: e.level, text: e.text, source: 'page' }]);
346
+ };
347
+ return (_jsxs(YStack, { flex: 1, minH: 0, children: [_jsxs(XStack, { px: "$2", py: "$1.5", gap: "$1.5", items: "center", borderBottomWidth: 1, borderColor: "$borderColor", children: [_jsx(XStack, { render: "button", "aria-label": t('Reload the page'), onPress: () => frame.current?.reload(), p: "$1.5", rounded: "$2", hoverStyle: { bg: '$hover' }, children: _jsx(RefreshCcw, { size: 14 }) }), _jsx(SizableText, { flex: 1, minW: 0, size: "$1", color: "$soft", numberOfLines: 1, style: mono, children: site || t('Nothing is serving yet') }), _jsx(Views, { views: DEVICES, value: device, onChange: (d) => setDevice(d), label: t('Device'), labels: "none" }), site ? (_jsx(Out, { href: site, label: t('Open in a new tab'), children: _jsx(XStack, { p: "$1.5", rounded: "$2", hoverStyle: { bg: '$hover' }, children: _jsx(ExternalLink, { size: 14 }) }) })) : null] }), _jsx(PreviewFrame, { ref: frame, src: site, title: t('Where this run is published'), device: device, onBridge: onBridge, empty: _jsxs(YStack, { items: "center", gap: "$2.5", p: "$6", children: [_jsx(Globe, { size: 28, opacity: 0.45 }), _jsx(SizableText, { size: "$3", color: "$ink", children: t('Nothing is serving yet') }), _jsx(SizableText, { size: "$2", color: "$soft", style: { textAlign: 'center', maxWidth: 280 }, children: held === 'parked'
321
348
  ? `${t('The run’s sandbox is suspended.')} ${t('Resume it to see what it serves.')}`
322
349
  : live
323
350
  ? t('When the run starts a server in its sandbox, the page opens here.')
324
- : `${t('Nothing listens in this run’s sandbox, and it published no site.')} ${t('A server the run started stopped when the run ended.')}` }), serving ? (_jsxs(YStack, { items: "center", gap: "$2", width: "100%", children: [_jsx(SizableText, { size: "$2", color: "$ink", role: "status", style: { textAlign: 'center', maxWidth: 320 }, children: serving.why || (serving.command ? t('Starting {command}…', { command: serving.command }) : t('Starting the dev server…')) }), serving.log ? _jsx(Tail, { log: serving.log }) : null, serving.why ? (_jsxs(XStack, { gap: "$2", flexWrap: "wrap", justify: "center", children: [onStart ? (_jsx(Button, { size: "sm", variant: "outline", onPress: onStart, children: t('Try again') })) : null, onEnvironment ? (_jsx(Button, { size: "sm", variant: "outline", onPress: onEnvironment, children: t('Set a start command') })) : null] })) : null] })) : onStart ? (_jsx(Button, { size: "sm", onPress: onStart, children: t('Start dev server') })) : null] }) })] }));
351
+ : `${t('Nothing listens in this run’s sandbox, and it published no site.')} ${t('A server the run started stopped when the run ended.')}` }), serving ? (_jsxs(YStack, { items: "center", gap: "$2", width: "100%", children: [_jsx(SizableText, { size: "$2", color: "$ink", role: "status", style: { textAlign: 'center', maxWidth: 320 }, children: serving.why || (serving.command ? t('Starting {command}…', { command: serving.command }) : t('Starting the dev server…')) }), serving.log ? _jsx(Tail, { log: serving.log }) : null, serving.why ? (_jsxs(XStack, { gap: "$2", flexWrap: "wrap", justify: "center", children: [onStart ? (_jsx(Button, { size: "sm", variant: "outline", onPress: onStart, children: t('Try again') })) : null, onEnvironment ? (_jsx(Button, { size: "sm", variant: "outline", onPress: onEnvironment, children: t('Set a start command') })) : null] })) : null] })) : onStart ? (_jsx(Button, { size: "sm", onPress: onStart, children: t('Start dev server') })) : null] }) }), site ? _jsx(Console, { lines: lines, height: dock, onHeight: setDock, onClear: () => setLines([]), label: t('Console') }) : null] }));
325
352
  }
326
353
  /** The last lines a server wrote, as it wrote them. */
327
354
  function Tail({ log }) {
328
- return (_jsx(YStack, { width: "100%", maxW: 460, maxH: 200, overflow: "scroll", rounded: "$2", borderWidth: 1, borderColor: "$borderColor", p: "$2", children: _jsx(SizableText, { size: "$1", color: "$soft", style: { ...mono, whiteSpace: 'pre-wrap', wordBreak: 'break-word' }, children: log.split('\n').slice(-12).join('\n') }) }));
355
+ return (_jsx(YStack, { width: "100%", maxW: 460, maxH: 200, overflow: "scroll", rounded: "$2", borderWidth: 1, borderColor: "$borderColor", p: "$2", children: _jsx(SizableText, { size: "$1", color: "$soft", fontFamily: "$mono", "$platform-web": { whiteSpace: 'pre-wrap', wordBreak: 'break-word' }, children: log.split('\n').slice(-12).join('\n') }) }));
329
356
  }
330
- function EnvironmentInspection({ id, repo, name, branch, environment, pr, title, events, live, onOpenEnvironment, onOpenDiff, }) {
357
+ function EnvironmentInspection({ id, repo, name, branch, environment, pr, title, events, live, devMode, onOpenEnvironment, onOpenDiff, }) {
331
358
  const { t } = useI18n();
332
359
  const host = useHost();
333
360
  const target = useTarget();
@@ -343,28 +370,28 @@ function EnvironmentInspection({ id, repo, name, branch, environment, pr, title,
343
370
  const contextPct = Math.min(100, Math.max(1, Math.round((estTokens / 128_000) * 100)));
344
371
  const added = changes.value?.files.reduce((n, f) => n + f.additions, 0) ?? 0;
345
372
  const removed = changes.value?.files.reduce((n, f) => n + f.deletions, 0) ?? 0;
346
- return (_jsxs(YStack, { width: 264, shrink: 0, minH: 0, overflow: "scroll", bg: "$background", px: "$3", py: "$2.5", gap: "$3", children: [_jsx(SizableText, { size: "$2", color: "$ink", fontWeight: "600", children: t('Environment') }), _jsxs(YStack, { gap: "$2", children: [_jsxs(XStack, { items: "center", gap: "$2", children: [_jsx(Laptop, { size: 14, opacity: 0.7 }), _jsx(SizableText, { flex: 1, size: "$2", color: "$ink", numberOfLines: 1, children: environment && environment !== 'sandbox' ? environment : t('This computer') }), _jsx(XStack, { render: "button", onPress: onOpenEnvironment, px: "$1.5", py: "$0.5", rounded: "$2", hoverStyle: { bg: '$hover' }, children: _jsx(SizableText, { size: "$1", color: "$ink", style: { textDecorationLine: 'underline' }, children: t('Save') }) })] }), _jsxs(XStack, { items: "center", gap: "$2", children: [_jsx(Folder, { size: 14, opacity: 0.7 }), _jsx(SizableText, { size: "$2", color: "$ink", numberOfLines: 1, children: name || 'workspace' }), _jsx(SizableText, { size: "$1", color: "$soft", numberOfLines: 1, children: "\u00B7 ~/work" })] }), repo ? (_jsxs(XStack, { items: "center", gap: "$2", children: [_jsx(Folder, { size: 14, opacity: 0.7 }), _jsx(SizableText, { size: "$2", color: "$ink", numberOfLines: 1, children: repo })] })) : null, branch ? (_jsxs(XStack, { items: "center", gap: "$2", children: [_jsx(GitBranch, { size: 14, opacity: 0.7 }), _jsx(SizableText, { size: "$2", color: "$ink", numberOfLines: 1, children: branch })] })) : null, _jsxs(XStack, { items: "center", gap: "$2", pt: "$1", children: [_jsx(SizableText, { flex: 1, size: "$2", color: "$ink", children: t('Remote Control') }), _jsx(Switch, { checked: remoteControl, onCheckedChange: setRemoteControl, size: "sm", "aria-label": t('Remote Control') })] })] }), _jsx(YStack, { borderTopWidth: 1, borderColor: "$borderColor", pt: "$2.5", gap: "$2", children: _jsxs(XStack, { items: "center", gap: "$1.5", children: [_jsx(SizableText, { size: "$2", color: "$ink", fontWeight: "500", children: t('Context') }), _jsx(ChevronRight, { size: 12, opacity: 0.6 }), _jsx(SizableText, { flex: 1, size: "$1", color: "$soft", text: "end", children: `${contextPct}%` }), _jsx(YStack, { width: 28, height: 6, rounded: 99, bg: "$borderColor", overflow: "hidden", children: _jsx(YStack, { width: `${contextPct}%`, height: "100%", bg: "$blue10" }) })] }) }), _jsx(YStack, { borderTopWidth: 1, borderColor: "$borderColor", pt: "$2.5", gap: "$2", children: _jsxs(XStack, { items: "center", gap: "$1.5", children: [_jsx(SizableText, { size: "$2", color: "$ink", fontWeight: "500", children: t('Connectors') }), _jsx(ChevronRight, { size: 12, opacity: 0.6 }), _jsx(SizableText, { flex: 1, size: "$1", color: "$soft", text: "end", children: t('Connected') })] }) }), _jsxs(YStack, { borderTopWidth: 1, borderColor: "$borderColor", pt: "$2.5", gap: "$1.5", children: [_jsx(SizableText, { size: "$2", color: "$ink", fontWeight: "500", children: t('Changes') }), _jsxs(XStack, { render: "button", onPress: onOpenDiff, items: "flex-start", gap: "$2", py: "$1", rounded: "$2", hoverStyle: { bg: '$hover' }, children: [_jsx(GitPullRequest, { size: 14, color: "$green10" }), _jsxs(YStack, { flex: 1, minW: 0, gap: "$0.5", children: [_jsx(SizableText, { size: "$2", color: "$ink", numberOfLines: 1, text: "start", children: title || branch || t('Working tree') }), _jsxs(XStack, { gap: "$1.5", items: "center", children: [pr.label ? (_jsx(SizableText, { size: "$1", color: "$soft", children: pr.label })) : null, _jsx(SizableText, { size: "$1", color: "$green10", children: `+${added}` }), _jsx(SizableText, { size: "$1", color: "$red10", children: `−${removed}` })] })] })] })] }), _jsxs(YStack, { borderTopWidth: 1, borderColor: "$borderColor", pt: "$2.5", gap: "$2", children: [_jsx(SizableText, { size: "$2", color: "$ink", fontWeight: "500", children: t('Background tasks') }), runningTasks.map((task) => (_jsxs(XStack, { items: "center", gap: "$2", py: "$1", children: [_jsx(SquareTerminal, { size: 14, opacity: 0.7 }), _jsx(SizableText, { flex: 1, minW: 0, size: "$2", color: "$ink", numberOfLines: 1, children: task.command }), _jsx(Square, { size: 10, fill: "currentColor" })] }, task.key))), _jsx(XStack, { items: "center", gap: "$2", py: "$0.5", children: _jsx(SizableText, { size: "$1", color: "$soft", children: t('{n} finished', { n: finishedCount }) }) })] })] }));
373
+ const envDisplay = formatDeviceLabel(environment || 'sandbox', { devMode, say: t });
374
+ return (_jsxs(YStack, { width: 264, shrink: 0, minH: 0, overflow: "scroll", bg: "$background", px: "$3", py: "$2.5", gap: "$3", children: [_jsx(SizableText, { size: "$2", color: "$ink", fontWeight: "600", children: devMode ? t('Environment') : t('Workspace') }), _jsxs(YStack, { gap: "$2", children: [_jsxs(XStack, { items: "center", gap: "$2", children: [_jsx(Laptop, { size: 14, opacity: 0.7 }), _jsx(SizableText, { flex: 1, size: "$2", color: "$ink", numberOfLines: 1, children: envDisplay.title }), _jsx(XStack, { render: "button", onPress: onOpenEnvironment, px: "$1.5", py: "$0.5", minH: 28, items: "center", focusVisibleStyle: RING, children: _jsx(SizableText, { size: "$1", color: "$ink", textDecorationLine: "underline", children: t('Save') }) })] }), _jsxs(XStack, { items: "center", gap: "$2", children: [_jsx(Folder, { size: 14, opacity: 0.7 }), _jsx(SizableText, { size: "$2", color: "$ink", numberOfLines: 1, children: name || 'workspace' }), _jsx(SizableText, { size: "$1", color: "$soft", numberOfLines: 1, children: "\u00B7 ~/work" })] }), repo ? (_jsxs(XStack, { items: "center", gap: "$2", children: [_jsx(Folder, { size: 14, opacity: 0.7 }), _jsx(SizableText, { size: "$2", color: "$ink", numberOfLines: 1, children: repo })] })) : null, branch ? (_jsxs(XStack, { items: "center", gap: "$2", children: [_jsx(GitBranch, { size: 14, opacity: 0.7 }), _jsx(SizableText, { size: "$2", color: "$ink", numberOfLines: 1, children: branch })] })) : null, _jsxs(XStack, { items: "center", gap: "$2", pt: "$1", children: [_jsx(SizableText, { flex: 1, size: "$2", color: "$ink", children: t('Remote Control') }), _jsx(Switch, { checked: remoteControl, onCheckedChange: setRemoteControl, size: "sm", "aria-label": t('Remote Control') })] })] }), _jsx(YStack, { borderTopWidth: 1, borderColor: "$borderColor", pt: "$2.5", gap: "$2", children: _jsxs(XStack, { items: "center", gap: "$1.5", children: [_jsx(SizableText, { size: "$2", color: "$ink", fontWeight: "500", children: t('Context') }), _jsx(SizableText, { flex: 1, size: "$1", color: "$soft", text: "end", fontVariant: ['tabular-nums'], children: `${contextPct}%` }), _jsx(YStack, { width: 28, height: 6, rounded: 99, bg: "$borderColor", overflow: "hidden", children: _jsx(YStack, { width: `${contextPct}%`, height: "100%", bg: "$blue10" }) })] }) }), _jsx(YStack, { borderTopWidth: 1, borderColor: "$borderColor", pt: "$2.5", gap: "$2", children: _jsxs(XStack, { items: "center", gap: "$1.5", children: [_jsx(SizableText, { size: "$2", color: "$ink", fontWeight: "500", children: t('Connectors') }), _jsx(SizableText, { flex: 1, size: "$1", color: "$soft", text: "end", children: t('Connected') })] }) }), _jsxs(YStack, { borderTopWidth: 1, borderColor: "$borderColor", pt: "$2.5", gap: "$1.5", children: [_jsx(SizableText, { size: "$2", color: "$ink", fontWeight: "500", children: t('Changes') }), _jsxs(XStack, { render: "button", onPress: onOpenDiff, items: "flex-start", gap: "$2", py: "$1", rounded: "$2", hoverStyle: { bg: '$hover' }, children: [_jsx(GitPullRequest, { size: 14, color: "$green10" }), _jsxs(YStack, { flex: 1, minW: 0, gap: "$0.5", children: [_jsx(SizableText, { size: "$2", color: "$ink", numberOfLines: 1, text: "start", children: title || branch || (devMode ? t('Working tree') : t('Latest changes')) }), _jsxs(XStack, { gap: "$1.5", items: "center", children: [pr.label ? (_jsx(SizableText, { size: "$1", color: "$soft", children: pr.label })) : null, _jsx(SizableText, { size: "$1", color: "var(--state-success)", fontVariant: ['tabular-nums'], children: `+${added}` }), _jsx(SizableText, { size: "$1", color: "var(--state-error)", fontVariant: ['tabular-nums'], children: `−${removed}` })] })] })] })] }), _jsxs(YStack, { borderTopWidth: 1, borderColor: "$borderColor", pt: "$2.5", gap: "$2", children: [_jsx(SizableText, { size: "$2", color: "$ink", fontWeight: "500", children: t('Background tasks') }), runningTasks.map((task) => (_jsxs(XStack, { items: "center", gap: "$2", py: "$1", children: [_jsx(SquareTerminal, { size: 14, opacity: 0.7 }), _jsx(SizableText, { flex: 1, minW: 0, size: "$2", color: "$ink", numberOfLines: 1, children: task.command }), _jsx(Square, { size: 10, fill: "currentColor" })] }, task.key))), _jsx(XStack, { items: "center", gap: "$2", py: "$0.5", children: _jsx(SizableText, { size: "$1", color: "$soft", children: t('{n} finished', { n: finishedCount }) }) })] })] }));
347
375
  }
348
376
  function Fact({ label, value }) {
349
377
  return (_jsxs(XStack, { gap: "$3", items: "baseline", children: [_jsx(SizableText, { size: "$1", color: "$soft", width: 96, children: label }), _jsx(SizableText, { flex: 1, size: "$2", color: "$ink", numberOfLines: 2, children: value })] }));
350
378
  }
351
- const mono = { fontFamily: 'var(--f-mono, ui-monospace, monospace)', whiteSpace: 'pre' };
352
379
  /**
353
380
  * The Terminal tab: a shell in the run's sandbox, in the same working tree as the
354
381
  * agent, while the sandbox is kept; and the agent's log, which outlives it. The
355
382
  * shell is a tmux session named for the run, so a reopened tab reattaches to it.
356
383
  */
357
- function Terminal({ id, sandbox, held, lines, live, failed, refused, retry, onRetry, }) {
384
+ function Terminal({ id, sandbox, held, lines, live, failed, refused, retry, onRetry, devMode, }) {
358
385
  const { t } = useI18n();
359
386
  const reachable = Boolean(sandbox) && held === 'running';
360
- // The shell while there is one, unless the log was asked for.
361
- const [log, setLog] = useState(false);
387
+ // The agent log is the tab it opens on; the shell is one press away for everyone whenever the sandbox is reachable.
388
+ const [log, setLog] = useState(true);
362
389
  const showShell = reachable && !log;
363
- return (_jsxs(YStack, { flex: 1, minH: 0, bg: "$background", children: [_jsxs(XStack, { px: "$2", py: "$1.5", gap: "$1", borderBottomWidth: 1, borderColor: "$borderColor", items: "center", children: [reachable ? (_jsx(XStack, { render: "button", "aria-label": t('Shell'), onPress: () => setLog(false), px: "$2", py: "$1", rounded: "$2", bg: showShell ? '$hover' : 'transparent', children: _jsx(SizableText, { size: "$1", color: showShell ? '$ink' : '$soft', children: t('Shell') }) })) : null, _jsx(XStack, { render: "button", "aria-label": t('Agent log'), onPress: () => setLog(true), px: "$2", py: "$1", rounded: "$2", bg: showShell ? 'transparent' : '$hover', children: _jsx(SizableText, { size: "$1", color: showShell ? '$soft' : '$ink', children: t('Agent log') }) })] }), showShell ? _jsx(Door, { which: "terminal", sandbox: sandbox, held: held, session: `run-${id.replace(/^sess_/, '').slice(0, 12)}` }) : _jsx(Log, { lines: lines, live: live, failed: failed, refused: refused, retry: retry, onRetry: onRetry })] }));
390
+ return (_jsxs(YStack, { flex: 1, minH: 0, bg: "$background", children: [_jsxs(XStack, { px: "$2", py: "$1.5", gap: "$1", rowGap: "$1", flexWrap: "wrap", borderBottomWidth: 1, borderColor: "$borderColor", items: "center", children: [reachable ? (_jsx(XStack, { render: "button", "aria-label": t('Shell'), "aria-pressed": showShell, onPress: () => setLog(false), px: "$2.5", py: "$1", minH: 30, items: "center", focusVisibleStyle: RING, children: _jsx(SizableText, { size: "$1", color: showShell ? '$ink' : '$soft', children: t('Shell') }) })) : null, _jsx(XStack, { render: "button", "aria-label": t('Agent log'), "aria-pressed": !showShell, onPress: () => setLog(true), px: "$2.5", py: "$1", minH: 30, items: "center", focusVisibleStyle: RING, children: _jsx(SizableText, { size: "$1", color: showShell ? '$soft' : '$ink', children: t('Agent log') }) })] }), showShell ? _jsx(Door, { which: "terminal", sandbox: sandbox, held: held, session: `run-${id.replace(/^sess_/, '').slice(0, 12)}` }) : _jsx(Log, { lines: lines, live: live, failed: failed, refused: refused, retry: retry, onRetry: onRetry })] }));
364
391
  }
365
392
  function Log({ lines, live, failed, refused, retry, onRetry, }) {
366
393
  const { t } = useI18n();
367
394
  const prompt = 'workspace';
368
395
  const idle = lines.length === 0 && !live;
369
- return (_jsxs(YStack, { flex: 1, minH: 0, children: [_jsxs(YStack, { flex: 1, minH: 0, overflow: "scroll", px: "$3", py: "$3", gap: "$1", children: [idle ? (_jsxs(YStack, { flex: 1, items: "center", justify: "center", gap: "$3", py: "$8", children: [_jsx(SizableText, { size: "$2", color: "$soft", style: { textAlign: 'center' }, children: refused || (failed ? t('This run stopped before its first command: {reason}', { reason: failed }) : t('This run finished without writing a command.')) }), refused ? (_jsx(Button, { size: "sm", variant: "outline", onPress: onRetry, children: retry })) : null] })) : (lines.map((line, i) => line.role === 'cmd' ? (_jsxs(XStack, { gap: "$2", children: [_jsx(SizableText, { size: "$1", color: "$soft", style: mono, children: `${prompt} $` }), _jsx(SizableText, { flex: 1, size: "$1", color: "$ink", style: mono, children: line.text })] }, i)) : (_jsx(SizableText, { size: "$1", color: "$ink", style: mono, children: line.text }, i)))), live ? (_jsxs(XStack, { gap: "$2", items: "center", children: [_jsx(SizableText, { size: "$1", color: "$soft", style: mono, children: `${prompt} $` }), _jsx(YStack, { width: 7, height: 14, bg: "$ink" })] })) : null] }), _jsx(XStack, { px: "$3", py: "$2", borderTopWidth: 1, borderColor: "$borderColor", children: _jsx(SizableText, { size: "$1", color: "$soft", children: t('Commands appear here as the run writes them.') }) })] }));
396
+ return (_jsxs(YStack, { flex: 1, minH: 0, children: [_jsxs(YStack, { flex: 1, minH: 0, overflow: "scroll", px: "$3", py: "$3", gap: "$1", children: [idle ? (_jsxs(YStack, { flex: 1, items: "center", justify: "center", gap: "$3", py: "$8", children: [_jsx(SizableText, { size: "$2", color: "$soft", text: "center", children: refused || (failed ? t('This run stopped before its first command: {reason}', { reason: failed }) : t('This run finished without writing a command.')) }), refused ? (_jsx(Button, { size: "sm", variant: "outline", onPress: onRetry, children: retry })) : null] })) : (lines.map((line, i) => line.role === 'cmd' ? (_jsxs(XStack, { gap: "$2", children: [_jsx(SizableText, { size: "$1", color: "$soft", fontFamily: "$mono", "$platform-web": { whiteSpace: 'pre' }, children: `${prompt} $` }), _jsx(SizableText, { flex: 1, size: "$1", color: "$ink", fontFamily: "$mono", "$platform-web": { whiteSpace: 'pre' }, children: line.text })] }, i)) : (_jsx(SizableText, { size: "$1", color: "$ink", fontFamily: "$mono", "$platform-web": { whiteSpace: 'pre' }, children: line.text }, i)))), live ? (_jsxs(XStack, { gap: "$2", items: "center", children: [_jsx(SizableText, { size: "$1", color: "$soft", fontFamily: "$mono", "$platform-web": { whiteSpace: 'pre' }, children: `${prompt} $` }), _jsx(YStack, { width: 7, height: 14, bg: "$ink" })] })) : null] }), _jsx(XStack, { px: "$3", py: "$2", borderTopWidth: 1, borderColor: "$borderColor", children: _jsx(SizableText, { size: "$1", color: "$soft", children: t('Commands appear here as the run writes them.') }) })] }));
370
397
  }
@@ -0,0 +1,22 @@
1
+ import type { Say } from '@hanzo/i18n/react';
2
+ export declare const DEV_MODE_KEY = "hanzo.dev_mode";
3
+ export declare const DEV_MODE_EVENT = "hanzo:dev-mode";
4
+ export declare function getDevMode(): boolean;
5
+ export declare function setDevMode(next: boolean): void;
6
+ export declare function useDevMode(): [boolean, (next: boolean) => void];
7
+ export interface DeviceLabelOptions {
8
+ hardware?: string | null;
9
+ host?: string | null;
10
+ devMode?: boolean;
11
+ /** The reader's `t`; English where none is given. */
12
+ say?: Say;
13
+ }
14
+ /**
15
+ * A device as a person reads it. A developer sees the name the machine reports.
16
+ * Anyone else sees that name tidied (`MacBook-Pro.local` → `MacBook-Pro`) with
17
+ * the hardware beneath, and the cloud workspace in plain words.
18
+ */
19
+ export declare function formatDeviceLabel(raw: string | null | undefined, opts?: DeviceLabelOptions): {
20
+ title: string;
21
+ detail?: string;
22
+ };
@@ -0,0 +1,80 @@
1
+ import { useCallback, useSyncExternalStore } from 'react';
2
+ import { english } from './say.js';
3
+ export const DEV_MODE_KEY = 'hanzo.dev_mode';
4
+ export const DEV_MODE_EVENT = 'hanzo:dev-mode';
5
+ export function getDevMode() {
6
+ if (typeof window === 'undefined')
7
+ return false;
8
+ try {
9
+ return window.localStorage.getItem(DEV_MODE_KEY) === 'true';
10
+ }
11
+ catch {
12
+ return false;
13
+ }
14
+ }
15
+ export function setDevMode(next) {
16
+ if (typeof window === 'undefined')
17
+ return;
18
+ try {
19
+ window.localStorage.setItem(DEV_MODE_KEY, next ? 'true' : 'false');
20
+ }
21
+ catch {
22
+ /* ignore storage errors */
23
+ }
24
+ window.dispatchEvent(new CustomEvent(DEV_MODE_EVENT, { detail: { enabled: next } }));
25
+ }
26
+ function subscribeDevMode(onChange) {
27
+ if (typeof window === 'undefined')
28
+ return () => { };
29
+ const handler = () => onChange();
30
+ const onStorage = (e) => {
31
+ if (e.key === DEV_MODE_KEY)
32
+ onChange();
33
+ };
34
+ window.addEventListener(DEV_MODE_EVENT, handler);
35
+ window.addEventListener('storage', onStorage);
36
+ return () => {
37
+ window.removeEventListener(DEV_MODE_EVENT, handler);
38
+ window.removeEventListener('storage', onStorage);
39
+ };
40
+ }
41
+ export function useDevMode() {
42
+ const enabled = useSyncExternalStore(subscribeDevMode, getDevMode, () => false);
43
+ const update = useCallback((next) => setDevMode(next), []);
44
+ return [enabled, update];
45
+ }
46
+ function mergeDetail(...parts) {
47
+ const seen = new Set();
48
+ const out = [];
49
+ for (const p of parts) {
50
+ for (const seg of (p ?? '').trim().split(/\s*·\s*/)) {
51
+ const key = seg.trim().toLowerCase();
52
+ if (key && !seen.has(key)) {
53
+ seen.add(key);
54
+ out.push(seg.trim());
55
+ }
56
+ }
57
+ }
58
+ return out.length ? out.join(' · ') : undefined;
59
+ }
60
+ /**
61
+ * A device as a person reads it. A developer sees the name the machine reports.
62
+ * Anyone else sees that name tidied (`MacBook-Pro.local` → `MacBook-Pro`) with
63
+ * the hardware beneath, and the cloud workspace in plain words.
64
+ */
65
+ export function formatDeviceLabel(raw, opts = {}) {
66
+ const say = opts.say ?? english;
67
+ const name = (raw ?? '').trim();
68
+ if (opts.devMode)
69
+ return name ? { title: name, detail: mergeDetail(opts.hardware, opts.host && opts.host !== name ? opts.host : undefined) } : { title: 'Cloud' };
70
+ const lower = name.toLowerCase();
71
+ if (!name || /^(hanzo sandbox|sandbox|cloud|cloud workspace)$/.test(lower) || /^cloud-\d+(\s|·|$)/.test(lower)) {
72
+ return { title: say('Cloud workspace'), detail: !name || !lower.startsWith('cloud-') ? say('Managed Hanzo cloud workspace') : name };
73
+ }
74
+ const tidy = name
75
+ .split(/\s*·\s*/)[0]
76
+ .replace(/\s*\((?:shell|desk|tmux|tty)[^)]*\)\s*$/i, '')
77
+ .replace(/\.(local|lan|home|internal)$/i, '')
78
+ .trim();
79
+ return { title: tidy || name, detail: mergeDetail(opts.hardware, opts.host, name !== tidy ? name : undefined) };
80
+ }
@@ -44,16 +44,16 @@ export function Environment({ repo, busy }) {
44
44
  setStart(shown.proposal?.start ?? shown.start);
45
45
  }, [shown]);
46
46
  if (!signed) {
47
- return _jsx(Soft, { children: t('Sign in to see this codebase’s environment.') });
47
+ return _jsx(Soft, { children: t('Sign in to view project environment settings.') });
48
48
  }
49
49
  if (!repo) {
50
- return _jsx(Soft, { children: t('This run has no codebase, so it has no environment.') });
50
+ return _jsx(Soft, { children: t('This session uses an automatic workspace — no custom setup needed.') });
51
51
  }
52
52
  if (env.error) {
53
53
  return _jsx(Soft, { children: t('{repo}’s environment could not be read right now.', { repo }) });
54
54
  }
55
55
  if (!shown) {
56
- return _jsx(Soft, { children: t('Reading the environment…') });
56
+ return _jsx(Soft, { children: t('Loading environment…') });
57
57
  }
58
58
  const changed = install !== shown.install || startCmd !== shown.start || shown.proposal !== null;
59
59
  const needed = (shown.proposal?.secrets ?? []).filter((n) => !shown.secrets.includes(n));
@@ -161,7 +161,7 @@ export function SetupDialog({ repo, homes, open, onOpenChange, onStart, onSaved,
161
161
  setWorking('');
162
162
  }
163
163
  };
164
- return (_jsx(Dialog, { open: open, onOpenChange: onOpenChange, children: _jsxs(DialogContent, { maxW: 480, showCloseButton: false, children: [_jsxs(XStack, { items: "center", justify: "space-between", gap: "$2", children: [_jsx(DialogTitle, { children: t('Set up an environment') }), _jsx(XStack, { render: "button", "aria-label": t('Close'), p: "$1", onPress: () => onOpenChange(false), children: _jsx(X, { size: 16 }) })] }), _jsxs(YStack, { gap: "$3", children: [_jsxs(YStack, { gap: "$1.5", children: [_jsx(SizableText, { size: "$2", color: "$soft", children: t('Repository') }), _jsx(XStack, { px: "$3", py: "$2", rounded: "$3", borderWidth: 1, borderColor: stranger ? '$ink' : '$borderColor', items: "center", gap: "$2", "aria-label": t('Chosen repository'), children: _jsx(SizableText, { size: "$2", color: home || (chosen && !stranger) ? '$ink' : '$soft', numberOfLines: 1, flex: 1, minW: 0, children: home ? home.label : chosen || t('Choose a repository') }) }), stranger ? (_jsx(SizableText, { size: "$1", color: "$ink", role: "alert", children: t('{repo} is not one of this organization’s repositories. Choose one below.', { repo: chosen }) })) : null, _jsx(Input, { value: q, onChangeText: setQ, placeholder: t('Find a repository…'), "aria-label": t('Find a repository') }), _jsx(YStack, { gap: 2, "aria-label": t('Repositories'), children: homes.loading && !list.length ? (_jsx(SizableText, { size: "$1", color: "$soft", children: t('Reading the repositories…') })) : homes.error && !list.length ? (_jsxs(XStack, { items: "center", gap: "$2", flexWrap: "wrap", children: [_jsx(SizableText, { size: "$1", color: "$soft", children: t('The repository list could not be read right now.') }), _jsx(Button, { size: "sm", variant: "outline", onPress: homes.reload, children: t('Read again') })] })) : shown.length === 0 ? (_jsx(SizableText, { size: "$1", color: "$soft", children: list.length ? t('Nothing matches.') : t('This organization has no repositories on the forge yet.') })) : (shown.map((h) => {
164
+ return (_jsx(Dialog, { open: open, onOpenChange: onOpenChange, children: _jsxs(DialogContent, { maxW: 480, showCloseButton: false, children: [_jsxs(XStack, { items: "center", justify: "space-between", gap: "$2", children: [_jsx(DialogTitle, { children: t('Set up an environment') }), _jsx(XStack, { render: "button", "aria-label": t('Close'), p: "$1", onPress: () => onOpenChange(false), children: _jsx(X, { size: 16 }) })] }), _jsxs(YStack, { gap: "$3", children: [_jsxs(YStack, { gap: "$1.5", children: [_jsx(SizableText, { size: "$2", color: "$soft", children: t('Repository') }), _jsx(XStack, { px: "$3", py: "$2", rounded: "$3", borderWidth: 1, borderColor: stranger ? '$ink' : '$borderColor', items: "center", gap: "$2", "aria-label": t('Chosen repository'), children: _jsx(SizableText, { size: "$2", color: home || (chosen && !stranger) ? '$ink' : '$soft', numberOfLines: 1, flex: 1, minW: 0, children: home ? home.label : chosen || t('Choose a repository') }) }), stranger ? (_jsx(SizableText, { size: "$1", color: "$ink", role: "alert", children: t('{repo} is not one of this organization’s repositories. Choose one below.', { repo: chosen }) })) : null, _jsx(Input, { value: q, onChangeText: setQ, placeholder: t('Find a repository…'), "aria-label": t('Find a repository') }), _jsx(YStack, { gap: 2, "aria-label": t('Repositories'), children: homes.loading && !list.length ? (_jsx(SizableText, { size: "$1", color: "$soft", children: t('Loading projects…') })) : homes.error && !list.length ? (_jsxs(XStack, { items: "center", gap: "$2", flexWrap: "wrap", children: [_jsx(SizableText, { size: "$1", color: "$soft", children: t('The project list could not be loaded right now.') }), _jsx(Button, { size: "sm", variant: "outline", onPress: homes.reload, children: t('Try again') })] })) : shown.length === 0 ? (_jsx(SizableText, { size: "$1", color: "$soft", children: list.length ? t('Nothing matches.') : t('This organization has no repositories on the forge yet.') })) : (shown.map((h) => {
165
165
  const on = h.name.toLowerCase() === chosen.toLowerCase();
166
166
  return (_jsx(XStack, { render: "button", "aria-pressed": on, "aria-label": t('Choose {repo}', { repo: h.label }), onPress: () => {
167
167
  setChosen(h.name);