@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/project.js CHANGED
@@ -44,14 +44,16 @@ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-run
44
44
  */
45
45
  import { SizableText, useMedia, XStack, YStack } from '@hanzo/gui';
46
46
  import { useI18n } from '@hanzo/i18n/react';
47
- import { Clock, ExternalLink, MousePointerClick, PanelLeft, RefreshCcw, Share2, Upload, } from '@hanzogui/lucide-icons-2';
47
+ import { AlertCircle, Check, Clock, ExternalLink, Globe, MousePointerClick, PanelLeft, RefreshCcw, Search, Share2, Upload, } from '@hanzogui/lucide-icons-2';
48
48
  import { Attachments, CHAT, Console, DEVICES, Feedback, FileTabs, FileTree, PageSelect, PreviewFrame, ProjectChip, VIEWS, Views, Workspace, fold, } from '@hanzo/ui/agents';
49
49
  import { Composer, Message } from '@hanzo/ui/chat';
50
- import { Button, Dialog, DialogContent, DialogTitle } from '@hanzo/ui';
50
+ import { Button, Dialog, DialogContent, DialogTitle, Input, Skeleton, toast } from '@hanzo/ui';
51
51
  import { HanzoMark } from '@hanzo/ui/product';
52
52
  import { useLimits } from '@hanzo/ui/product/useLimits';
53
53
  import { useDictation, useVoice } from '@hanzo/voice';
54
54
  import { useEffect, useMemo, useRef, useState } from 'react';
55
+ import { copy as toClipboard } from './clipboard.js';
56
+ import { RING } from './pane.js';
55
57
  import { read as pushed } from './api/changes.js';
56
58
  import { codebases, one } from './api/codebases.js';
57
59
  import { start } from './api/coding.js';
@@ -112,7 +114,7 @@ function Turn({ run, open, onOpen, project }) {
112
114
  setV(null);
113
115
  setNote(e.message);
114
116
  });
115
- } }), note ? (_jsx(SizableText, { size: "$1", color: "$soft", children: note })) : null, !open ? (_jsx(XStack, { render: "button", onPress: onOpen, hitSlop: 8, children: _jsx(SizableText, { size: "$1", color: "$soft", textDecorationLine: "underline", children: t('Show steps') }) })) : null] }), children: _jsx(SizableText, { size: "$2", color: "$ink", children: run.status === 'done' ? t('Done.') : run.status === 'error' ? t('This run hit an error.') : run.status === 'stopped' ? t('Stopped.') : t('Working…') }) })] }));
117
+ } }), note ? (_jsx(SizableText, { size: "$1", color: "$soft", children: note })) : null, !open ? (_jsx(XStack, { render: "button", onPress: onOpen, px: "$1.5", py: "$1", minH: 28, items: "center", focusVisibleStyle: RING, children: _jsx(SizableText, { size: "$1", color: "$soft", textDecorationLine: "underline", children: t('Show steps') }) })) : null] }), children: _jsx(SizableText, { size: "$2", color: "$ink", children: run.status === 'done' ? t('Done.') : run.status === 'error' ? t('This run hit an error.') : run.status === 'stopped' ? t('Stopped.') : t('Working…') }) })] }));
116
118
  }
117
119
  export function Project({ at }) {
118
120
  const host = useHost();
@@ -163,6 +165,7 @@ export function Project({ at }) {
163
165
  setNow(Date.now());
164
166
  again();
165
167
  setRedo({ busy: false, error: '' });
168
+ toast.success(t('Publish queued for {name}', { name: title }));
166
169
  }
167
170
  catch (e) {
168
171
  setRedo({ busy: false, error: e.message });
@@ -217,7 +220,12 @@ export function Project({ at }) {
217
220
  const [history, setHistory] = useState(false);
218
221
  const [publish, setPublish] = useState(null);
219
222
  const [switcher, setSwitcher] = useState(false);
223
+ const [switchQ, setSwitchQ] = useState('');
220
224
  const repos = useRead(switcher && signed ? () => codebases(target) : null, [], [target, switcher, signed]);
225
+ const filteredRepos = useMemo(() => {
226
+ const needle = switchQ.trim().toLowerCase();
227
+ return needle ? repos.value.filter((c) => `${c.org}/${c.name}`.toLowerCase().includes(needle)) : repos.value;
228
+ }, [repos.value, switchQ]);
221
229
  const frame = useRef(null);
222
230
  // What was published may be new files at the same address: the project is read
223
231
  // for its address, and the frame loads again.
@@ -384,94 +392,95 @@ export function Project({ at }) {
384
392
  };
385
393
  const share = async () => {
386
394
  const link = project?.live || `${window.location.origin}${window.location.pathname}`;
387
- try {
388
- await navigator.clipboard.writeText(link);
389
- setNote(t('Copied {link}', { link }));
390
- }
391
- catch {
392
- setNote(link);
393
- }
395
+ setNote((await toClipboard(link)) ? t('Copied {link}', { link }) : link);
394
396
  };
395
397
  if (!signed) {
396
- return (_jsxs(YStack, { flex: 1, items: "center", justify: "center", gap: "$3", children: [_jsx(SizableText, { size: "$4", color: "$ink", children: t('Sign in to open this project.') }), _jsx(Button, { onPress: () => host.signIn?.(), children: t('Sign in') })] }));
398
+ return (_jsx(YStack, { flex: 1, items: "center", justify: "center", px: "$4", children: _jsxs(YStack, { borderWidth: 1, borderColor: "var(--border-strong)", rounded: "$4", bg: "$panel", px: "$6", py: "$8", gap: "$3", items: "center", width: "100%", maxW: 440, children: [_jsx(SizableText, { size: "$4", fontWeight: "500", color: "$ink", text: "center", children: t('Sign in to open this project.') }), _jsx(Button, { size: "sm", variant: "primary", onPress: () => host.signIn?.(), children: t('Sign in') })] }) }));
397
399
  }
398
400
  // A repository of another organization is opened in that one.
399
401
  if (named && host.org && named.org.toLowerCase() !== host.org.toLowerCase()) {
400
402
  const member = host.memberships?.some((m) => m.toLowerCase() === named.org.toLowerCase()) && host.chooseOrg;
401
- return (_jsxs(YStack, { flex: 1, items: "center", justify: "center", gap: "$3", px: "$4", children: [_jsx(SizableText, { size: "$4", color: "$ink", text: "center", children: t('{repo} is in {org}, and you are working in {current}.', { repo: `${named.org}/${named.name}`, org: named.org, current: host.org }) }), member ? (_jsx(Button, { variant: "outline", onPress: () => host.chooseOrg?.(named.org), children: t('Switch to {org}', { org: named.org }) })) : (_jsx(Button, { variant: "outline", onPress: () => host.go(path({ kind: 'screen', screen: 'projects' })), children: t('See this organization’s projects') }))] }));
403
+ return (_jsx(YStack, { flex: 1, items: "center", justify: "center", px: "$4", children: _jsxs(YStack, { borderWidth: 1, borderColor: "var(--border-strong)", rounded: "$4", bg: "$panel", px: "$6", py: "$8", gap: "$3", items: "center", width: "100%", maxW: 480, children: [_jsx(SizableText, { size: "$4", fontWeight: "500", color: "$ink", text: "center", children: t('{repo} is in {org}, and you are working in {current}.', { repo: `${named.org}/${named.name}`, org: named.org, current: host.org }) }), member ? (_jsx(Button, { size: "sm", variant: "outline", borderColor: "var(--border-strong)", onPress: () => host.chooseOrg?.(named.org), children: t('Switch to {org}', { org: named.org }) })) : (_jsx(Button, { size: "sm", variant: "outline", borderColor: "var(--border-strong)", onPress: () => host.go(path({ kind: 'screen', screen: 'projects' })), children: t('See this organization’s projects') }))] }) }));
402
404
  }
403
405
  if (named ? !forge.loading && !forge.value : !all.loading && !project && !all.error) {
404
- return (_jsxs(YStack, { flex: 1, items: "center", justify: "center", gap: "$3", px: "$4", children: [_jsx(SizableText, { size: "$4", color: "$ink", text: "center", children: named
405
- ? forge.error && !/not found|404/i.test(forge.error.message)
406
- ? forge.error.message
407
- : t('{org} has no repository named {name}.', { org: named.org, name: named.name })
408
- : host.org
409
- ? t('{org} has no project named {name}.', { org: host.org, name: slug })
410
- : t('There is no project named {name}.', { name: slug }) }), _jsx(Button, { variant: "outline", onPress: () => host.go(path({ kind: 'screen', screen: named ? 'projects' : 'artifacts' })), children: named ? t('See this organization’s projects') : t('See what this organization has built') })] }));
406
+ return (_jsx(YStack, { flex: 1, items: "center", justify: "center", px: "$4", children: _jsxs(YStack, { borderWidth: 1, borderColor: "var(--border-strong)", rounded: "$4", bg: "$panel", px: "$6", py: "$8", gap: "$3", items: "center", width: "100%", maxW: 480, children: [_jsx(SizableText, { size: "$4", fontWeight: "500", color: "$ink", text: "center", children: named
407
+ ? forge.error && !/not found|404/i.test(forge.error.message)
408
+ ? forge.error.message
409
+ : t('{org} has no repository named {name}.', { org: named.org, name: named.name })
410
+ : host.org
411
+ ? t('{org} has no project named {name}.', { org: host.org, name: slug })
412
+ : t('There is no project named {name}.', { name: slug }) }), _jsx(Button, { size: "sm", variant: "outline", borderColor: "var(--border-strong)", onPress: () => host.go(path({ kind: 'screen', screen: named ? 'projects' : 'artifacts' })), children: named ? t('See this organization’s projects') : t('See what this organization has built') })] }) }));
411
413
  }
412
- const chat = (_jsxs(YStack, { "data-slot": "project-chat", flex: 1, minH: 0, position: "relative", children: [_jsx(YStack, { flex: 1, minH: 0, overflow: "scroll", px: "$3", pt: "$2", pb: "$4", gap: "$4", $md: { pr: 0 }, children: ordered.length === 0 ? (_jsx(SizableText, { size: "$2", color: "$ink", children: runs.loading
413
- ? t('Reading this project’s runs…')
414
- : project?.live
415
- ? t('{name} is loaded — it is in the preview, and every run on it is under the clock above. Say what to change and it gets built.', { name: project.name })
416
- : stalled
417
- ? t('{name} has been publishing for {minutes} minutes without finishing. Publish it again from the preview, or say what to change and it gets built.', { name: project?.name ?? '', minutes: Math.floor(ran / 60) })
418
- : failed
419
- ? t('{name} could not be published. Publish it again from the preview, or say what to change and it gets built.', { name: project?.name ?? '' })
420
- : building
421
- ? t('{name} is being published — it appears in the preview when its build finishes. Say what to change and it gets built.', { name: project?.name ?? '' })
422
- : starter
423
- ? t('{name} is loaded — the preview shows the {starter} starter until your copy is published. Say what to change and it gets built.', { name: project?.name ?? '', starter: starter.title })
424
- : project
425
- ? t('{name} is loaded and nothing is published yet. Say what to change and it gets built.', { name: project.name })
426
- : named
427
- ? t('{repo} is open on {branch}. Say what to change and it gets built there.', { repo: `${named.org}/${named.name}`, branch: home })
428
- : t('{name} is loaded. Say what to change and it gets built.', { name: slug }) })) : (ordered.map((r) => (_jsxs(YStack, { gap: "$2", children: [_jsx(Turn, { run: r, open: r.id === current, onOpen: () => setChosen(r.id), project: slug }), r.id === current ? (_jsxs(YStack, { gap: "$1", paddingInlineStart: "$2", borderInlineStartWidth: 1, borderColor: "$borderColor", children: [fold(run.events.map((e) => ({ kind: e.kind, actor: who(e.actor), seq: e.seq, id: e.id, text: said(e, run.record?.mode, t) })).filter((b) => b.text)).map((b) => (_jsx(SizableText, { size: "$1", color: "$soft", children: b.text }, b.key))), pr.href ? (_jsxs(XStack, { items: "center", gap: "$2", flexWrap: "wrap", children: [_jsxs(Out, { href: pr.href, label: t('Open pull request {pr}', { pr: pr.label }), children: [_jsx(SizableText, { size: "$1", color: "$ink", textDecorationLine: "underline", children: t('Pull request {pr}', { pr: pr.label }) }), _jsx(ExternalLink, { size: 11 })] }), _jsx(Merge, { session: r.id, open: proposing, onMerged: merged })] })) : null] })) : null] }, r.id)))) }), _jsxs(YStack, { "data-slot": "project-ask", px: "$3", pb: "$3", gap: "$2", minW: 0, $md: { pr: 0 }, children: [note ? (_jsx(SizableText, { size: "$1", color: "$soft", role: "status", children: note })) : null, picked.length ? _jsx(Attachments, { items: picked, onRemove: () => setPicked([]) }) : null, _jsx(Composer, { column: true, value: draft, onChange: setDraft, onSend: () => void (current && running ? steer(current) : send()), onStop: current
414
+ const chat = (_jsxs(YStack, { "data-slot": "project-chat", flex: 1, minH: 0, position: "relative", children: [_jsx(YStack, { flex: 1, minH: 0, overflow: "scroll", px: "$3", pt: "$2", pb: "$4", gap: "$4", $md: { pr: 0 }, children: ordered.length === 0 ? (runs.loading ? (_jsxs(YStack, { gap: "$3", "aria-busy": true, children: [_jsx(SizableText, { size: "$2", color: "$soft", children: t('Reading this project’s runs…') }), _jsx(Skeleton, { layout: "block", width: "84%", height: 14, rounded: "$2" }), _jsx(Skeleton, { layout: "block", width: "66%", height: 14, rounded: "$2" }), _jsx(Skeleton, { layout: "block", width: "92%", height: 56, rounded: "$3" })] })) : (_jsx(SizableText, { size: "$2", color: "$ink", children: project?.live
415
+ ? t('{name} is loaded — it is in the preview, and every run on it is under the clock above. Say what to change and it gets built.', { name: project.name })
416
+ : stalled
417
+ ? t('{name} has been publishing for {minutes} minutes without finishing. Publish it again from the preview, or say what to change and it gets built.', { name: project?.name ?? '', minutes: Math.floor(ran / 60) })
418
+ : failed
419
+ ? t('{name} could not be published. Publish it again from the preview, or say what to change and it gets built.', { name: project?.name ?? '' })
420
+ : building
421
+ ? t('{name} is being published — it appears in the preview when its build finishes. Say what to change and it gets built.', { name: project?.name ?? '' })
422
+ : starter
423
+ ? t('{name} is loaded — the preview shows the {starter} starter until your copy is published. Say what to change and it gets built.', { name: project?.name ?? '', starter: starter.title })
424
+ : project
425
+ ? t('{name} is loaded and nothing is published yet. Say what to change and it gets built.', { name: project.name })
426
+ : named
427
+ ? t('{repo} is open on {branch}. Say what to change and it gets built there.', { repo: `${named.org}/${named.name}`, branch: home })
428
+ : t('{name} is loaded. Say what to change and it gets built.', { name: slug }) }))) : (ordered.map((r) => (_jsxs(YStack, { gap: "$2", children: [_jsx(Turn, { run: r, open: r.id === current, onOpen: () => setChosen(r.id), project: slug }), r.id === current ? (_jsxs(YStack, { gap: "$1", paddingInlineStart: "$2", borderInlineStartWidth: 1, borderColor: "$borderColor", children: [fold(run.events.map((e) => ({ kind: e.kind, actor: who(e.actor), seq: e.seq, id: e.id, text: said(e, run.record?.mode, t) })).filter((b) => b.text)).map((b) => (_jsx(SizableText, { size: "$1", color: "$soft", children: b.text }, b.key))), pr.href ? (_jsxs(XStack, { items: "center", gap: "$2", flexWrap: "wrap", children: [_jsxs(Out, { href: pr.href, label: t('Open pull request {pr}', { pr: pr.label }), children: [_jsx(SizableText, { size: "$1", color: "$ink", textDecorationLine: "underline", children: t('Pull request {pr}', { pr: pr.label }) }), _jsx(ExternalLink, { size: 11 })] }), _jsx(Merge, { session: r.id, open: proposing, onMerged: merged })] })) : null] })) : null] }, r.id)))) }), _jsxs(YStack, { "data-slot": "project-ask", px: "$3", pb: "$3", gap: "$2", minW: 0, $md: { pr: 0 }, children: [note ? (_jsx(SizableText, { size: "$1", color: "$soft", role: "status", children: note })) : null, picked.length ? _jsx(Attachments, { items: picked, onRemove: () => setPicked([]) }) : null, _jsx(Composer, { column: true, value: draft, onChange: setDraft, onSend: () => void (current && running ? steer(current) : send()), onStop: current
429
429
  ? () => void stop(target, current).then(() => setNote(t('Stop requested — the run keeps its work on its branch')), (e) => setNote(e.message))
430
430
  : undefined, busy: busy || (running && !draft.trim()), placeholder: running ? t('Steer this run') : t('Ask Hanzo for edits'), label: t('Ask Hanzo for edits'), plus: { upload: () => pick(attached, setAttached, setNote, t) }, carried: carrying(attached, setAttached), mode: running ? null : { value: mode === 'plan' ? 'plan' : 'auto', set: (m) => setMode(m === 'plan' ? 'plan' : 'build'), items: MODES.filter((m) => m.id !== 'manual') }, mind: running ? null : mind, effort: running ? null : pacing(mind), voice: voice })] }), wide && !shut ? (_jsx(Gutter, { side: "left", span: across, floor: CHAT_FLOOR, ceil: most, reset: CHAT_WIDTH, onSpan: setSplit, label: t('Resize the chat'), gap: GUTTER })) : null] }));
431
431
  // The preview stays loaded while another view is open, so coming back to it
432
432
  // is the page as it was left.
433
- const preview = (_jsxs(YStack, { "data-slot": "preview", flex: 1, minH: 0, minW: 0, gap: "$2", display: view === 'preview' ? 'flex' : 'none', children: [_jsxs(XStack, { "data-slot": "preview-bar", items: "center", gap: "$1.5", minW: 0, shrink: 0, "$max-md": { px: '$2' }, children: [_jsx(XStack, { render: "button", "aria-label": t('Reload the preview'), onPress: () => frame.current?.reload(), p: "$1.5", rounded: "$3", hoverStyle: { bg: '$hover' }, children: _jsx(RefreshCcw, { size: 16 }) }), _jsx(PageSelect, { pages: pages, value: page, onChange: setPage, shrink: 1 }), _jsx(XStack, { flex: 1 }), _jsx(Views, { views: DEVICES, value: device, onChange: (d) => setDevice(d), label: t('Device'), labels: "none" }), src ? (_jsx(Out, { href: src, label: t('Open in a new tab'), children: _jsx(XStack, { p: "$1.5", rounded: "$3", hoverStyle: { bg: '$hover' }, children: _jsx(ExternalLink, { size: 16 }) }) })) : null] }), _jsx(PreviewFrame, { ref: frame, src: src, title: t('{title} preview', { title }), device: device, onBridge: onBridge, empty: _jsxs(YStack, { items: "center", gap: "$2", p: "$6", children: [_jsx(SizableText, { size: "$3", color: "$ink", children: stalled
434
- ? t('Publishing is taking too long')
435
- : building
436
- ? project?.forked
437
- ? t('Publishing your copy…')
438
- : t('Publishing…')
439
- : failed
440
- ? t('Publishing failed')
441
- : t('Nothing deployed yet') }), _jsx(SizableText, { size: "$2", color: "$soft", text: "center", children: stalled
442
- ? t('Its build started {minutes} minutes ago and has not finished.', { minutes: Math.floor(ran / 60) })
443
- : building
444
- ? t('Its page appears here when the build finishes.')
445
- : failed
446
- ? why
447
- : t('Publish this project and its page appears here.') }), (stalled || failed) && clone ? (_jsx(Button, { variant: "outline", disabled: redo.busy, onPress: () => void retry(), children: t('Publish again') })) : null, redo.error ? (_jsx(SizableText, { size: "$2", color: "$soft", text: "center", role: "alert", children: redo.error })) : null] }), toolbar: bridge ? (_jsx(XStack, { render: "button", "aria-pressed": editing, "aria-label": editing ? t('Stop picking elements') : t('Pick an element to edit'), onPress: () => {
433
+ const preview = (_jsxs(YStack, { "data-slot": "preview", flex: 1, minH: 0, minW: 0, gap: "$2", display: view === 'preview' ? 'flex' : 'none', children: [_jsxs(XStack, { "data-slot": "preview-bar", items: "center", gap: "$1.5", minW: 0, shrink: 0, "$max-md": { px: '$2' }, children: [_jsx(XStack, { render: "button", "aria-label": t('Reload the preview'), onPress: () => frame.current?.reload(), p: "$1.5", rounded: "$3", hoverStyle: { bg: '$hover' }, children: _jsx(RefreshCcw, { size: 16 }) }), _jsx(PageSelect, { pages: pages, value: page, onChange: setPage, shrink: 1 }), _jsx(XStack, { flex: 1 }), _jsx(Views, { views: DEVICES, value: device, onChange: (d) => setDevice(d), label: t('Device'), labels: "none" }), src ? (_jsx(Out, { href: src, label: t('Open in a new tab'), children: _jsx(XStack, { p: "$1.5", rounded: "$3", hoverStyle: { bg: '$hover' }, children: _jsx(ExternalLink, { size: 16 }) }) })) : null] }), _jsx(PreviewFrame, { ref: frame, src: src, title: t('{title} preview', { title }), device: device, onBridge: onBridge, empty: _jsx(YStack, { items: "center", justify: "center", p: "$6", width: "100%", children: _jsxs(YStack, { items: "center", gap: "$2.5", px: "$5", py: "$6", rounded: "$4", borderWidth: 1, borderColor: "var(--border-strong)", bg: "$panel", width: "100%", maxW: 420, children: [_jsx(YStack, { width: 36, height: 36, rounded: "$3", bg: "$raised", items: "center", justify: "center", "aria-hidden": true, children: stalled || failed ? _jsx(AlertCircle, { size: 18, color: "var(--state-error)" }) : _jsx(Globe, { size: 18, color: "$soft" }) }), _jsx(SizableText, { size: "$3", fontWeight: "500", color: "$ink", text: "center", children: stalled
434
+ ? t('Publishing is taking too long')
435
+ : building
436
+ ? project?.forked
437
+ ? t('Publishing your copy…')
438
+ : t('Publishing…')
439
+ : failed
440
+ ? t('Publishing failed')
441
+ : t('Nothing deployed yet') }), _jsx(SizableText, { size: "$2", color: "$soft", text: "center", children: stalled
442
+ ? t('Its build started {minutes} minutes ago and has not finished.', { minutes: Math.floor(ran / 60) })
443
+ : building
444
+ ? t('Its page appears here when the build finishes.')
445
+ : failed
446
+ ? why
447
+ : t('Publish this project and its page appears here.') }), (stalled || failed) && clone ? (_jsx(Button, { size: "sm", variant: "outline", borderColor: "var(--border-strong)", disabled: redo.busy, onPress: () => void retry(), children: redo.busy ? t('Publishing…') : t('Publish again') })) : null, redo.error ? (_jsx(SizableText, { size: "$2", color: "var(--state-error)", text: "center", role: "alert", children: redo.error })) : null] }) }), toolbar: bridge ? (_jsx(XStack, { render: "button", "aria-pressed": editing, "aria-label": editing ? t('Stop picking elements') : t('Pick an element to edit'), onPress: () => {
448
448
  const next = !editing;
449
449
  setEditing(next);
450
450
  frame.current?.post({ type: 'preview:editable', active: next });
451
- }, p: "$2", rounded: "$10", children: _jsx(MousePointerClick, { size: 16 }) })) : undefined })] }));
452
- const body = view === 'preview' ? null : view === 'files' ? (repo && root.error ? (_jsx(SizableText, { size: "$2", color: "$soft", p: "$4", role: "status", children: t('Nothing to show for {repo} at {ref}: the forge answered “{reason}”.', { repo, ref, reason: root.error.message }) })) : repo ? (_jsx(FileTree, { load: async (dir) => (await tree(target, repo, ref, dir)).map((e) => ({ path: e.path, kind: e.dir ? 'dir' : 'file' })), value: file, onSelect: (p) => void openFile(p), label: t('{repo} at {ref}', { repo, ref }) }, round)) : (_jsx(SizableText, { size: "$2", color: "$soft", p: "$4", children: t('This project has no repository yet. Its first run creates one.') }))) : view === 'code' ? (_jsx(FileTabs, { files: files, value: file, onSelect: setFile, onClose: (p) => {
451
+ }, minW: 36, minH: 36, items: "center", justify: "center", rounded: "$10", focusVisibleStyle: RING, children: _jsx(MousePointerClick, { size: 16 }) })) : undefined })] }));
452
+ const body = view === 'preview' ? null : view === 'files' ? (repo && root.error ? (_jsx(YStack, { p: "$4", children: _jsx(SizableText, { size: "$2", color: "var(--state-error)", role: "status", children: t('Nothing to show for {repo} at {ref}: the forge answered “{reason}”.', { repo, ref, reason: root.error.message }) }) })) : repo ? (_jsx(FileTree, { load: async (dir) => (await tree(target, repo, ref, dir)).map((e) => ({ path: e.path, kind: e.dir ? 'dir' : 'file' })), value: file, onSelect: (p) => void openFile(p), label: t('{repo} at {ref}', { repo, ref }) }, round)) : (_jsx(SizableText, { size: "$2", color: "$soft", p: "$4", children: t('This project has no repository yet. Its first run creates one.') }))) : view === 'code' ? (_jsx(FileTabs, { files: files, value: file, onSelect: setFile, onClose: (p) => {
453
453
  setFiles((was) => was.filter((f) => f.path !== p));
454
454
  if (file === p)
455
455
  setFile(null);
456
- }, empty: _jsx(SizableText, { size: "$2", color: "$soft", p: "$4", children: t('Open a file from Files. Code here is read at {ref}; ask in the chat to change it.', { ref }) }) })) : (_jsx(YStack, { p: "$4", gap: "$2", children: picked.length ? (picked.map((p) => (_jsxs(SizableText, { size: "$2", color: "$ink", children: [p.label, " \u2014 ", p.id] }, p.id)))) : (_jsx(SizableText, { size: "$2", color: "$soft", children: bridge
457
- ? t('Pick an element in the preview to see it here and attach it to your next ask.')
458
- : t('Layers are read through the preview bridge, and this page does not run it. Its elements cannot be listed from here.') })) }));
459
- return (_jsxs(_Fragment, { children: [_jsxs(Workspace, { start: _jsxs(XStack, { items: "center", gap: "$2", minW: 0, shrink: 1, children: [_jsx(XStack, { render: "button", "aria-label": t('All runs'), onPress: () => host.go(''), p: "$1", shrink: 0, children: _jsx(HanzoMark, { size: 20 }) }), _jsx(ProjectChip, { name: title, onPress: () => setSwitcher(true) }), _jsx(XStack, { render: "button", "aria-label": t('History'), onPress: () => setHistory(true), p: "$1.5", rounded: "$3", shrink: 0, hoverStyle: { bg: '$hover' }, children: _jsx(Clock, { size: 16 }) }), _jsx(XStack, { render: "button", "aria-label": shut ? t('Show the chat') : t('Hide the chat'), "aria-pressed": !shut, onPress: () => (cramped ? setAsked(!asked) : setCollapsed(!collapsed)), p: "$1.5", rounded: "$3", shrink: 0, hoverStyle: { bg: '$hover' }, "$max-md": { display: 'none' }, children: _jsx(PanelLeft, { size: 16 }) })] }), middle: _jsx(Views, { views: [CHAT, ...VIEWS], value: pane === 'chat' && !wide ? 'chat' : view, onChange: (v) => {
456
+ }, empty: _jsx(SizableText, { size: "$2", color: "$soft", p: "$4", children: t('Open a file from Files. Code here is read at {ref}; ask in the chat to change it.', { ref }) }) })) : (_jsx(YStack, { p: "$4", gap: "$2", children: picked.length ? (picked.map((p) => (_jsxs(XStack, { items: "center", gap: "$2.5", px: "$3", py: "$2.5", rounded: "$3", borderWidth: 1, borderColor: "$borderColor", bg: "$panel", children: [_jsx(MousePointerClick, { size: 14, color: "$soft" }), _jsxs(SizableText, { size: "$2", color: "$ink", fontFamily: "$mono", flex: 1, minW: 0, children: [p.label, " \u2014 ", p.id] })] }, p.id)))) : (_jsx(YStack, { p: "$5", rounded: "$4", borderWidth: 1, borderColor: "$borderColor", bg: "$panel", items: "center", gap: "$2", children: _jsx(SizableText, { size: "$2", color: "$soft", text: "center", children: bridge
457
+ ? t('Pick an element in the preview to see it here and attach it to your next ask.')
458
+ : t('Layers are read through the preview bridge, and this page does not run it. Its elements cannot be listed from here.') }) })) }));
459
+ return (_jsxs(_Fragment, { children: [_jsxs(Workspace, { start: _jsxs(XStack, { items: "center", gap: "$2", minW: 0, shrink: 1, children: [_jsx(XStack, { render: "button", "aria-label": t('All runs'), onPress: () => host.go(''), p: "$1", shrink: 0, children: _jsx(HanzoMark, { size: 20 }) }), _jsx(ProjectChip, { name: title, onPress: () => setSwitcher(true) }), _jsx(XStack, { render: "button", "aria-label": t('History'), onPress: () => setHistory(true), p: "$1.5", rounded: "$3", shrink: 0, hoverStyle: { bg: '$hover' }, children: _jsx(Clock, { size: 16 }) }), _jsx(XStack, { render: "button", "aria-label": shut ? t('Show the chat') : t('Hide the chat'), "aria-pressed": !shut, onClick: () => (cramped ? setAsked(!asked) : setCollapsed(!collapsed)), minW: 32, minH: 32, items: "center", justify: "center", rounded: "$3", shrink: 0, hoverStyle: { bg: '$hover' }, focusVisibleStyle: RING, "$max-md": { display: 'none' }, children: _jsx(PanelLeft, { size: 16 }) })] }), middle: _jsx(Views, { views: [CHAT, ...VIEWS], value: pane === 'chat' && !wide ? 'chat' : view, onChange: (v) => {
460
460
  if (v === 'chat')
461
461
  return setPane('chat');
462
462
  setView(v);
463
463
  setPane('view');
464
- }, label: t('View') }), end: _jsxs(XStack, { items: "center", gap: "$2", children: [_jsx(XStack, { display: "none", $md: { display: 'flex' }, children: _jsxs(Button, { variant: "outline", size: "sm", onPress: () => void share(), children: [_jsx(Share2, { size: 14 }), " ", t('Share')] }) }), _jsxs(Button, { size: "sm", "aria-label": t('Publish'), disabled: !clone || !slug, onPress: () => setPublish({ repo: clone, title, ref, name: slug, project: slug }), children: [_jsx(Upload, { size: 14 }), _jsx(SizableText, { size: "$2", color: "inherit", "$max-md": { display: 'none' }, children: t('Publish') })] })] }), chat: chat, dock: _jsx(Console, { lines: lines, height: dock, onHeight: setDock, onClear: () => setPageLines([]), status: run.status || end.status || undefined, label: t('Console') }), collapsed: shut, pane: pane, width: across, onLayout: (e) => setRoom(e.nativeEvent.layout.width), children: [preview, body] }), _jsx(Dialog, { open: history, onOpenChange: setHistory, children: _jsxs(DialogContent, { maxW: 480, children: [_jsx(DialogTitle, { children: t('Runs on {title}', { title }) }), _jsx(YStack, { gap: "$1", children: runs.value.length === 0 ? (_jsx(SizableText, { size: "$2", color: "$soft", children: t('No runs yet.') })) : (runs.value.map((r) => (_jsxs(XStack, { render: "button", onPress: () => {
465
- setChosen(r.id);
466
- setHistory(false);
467
- }, justify: "space-between", px: "$2", py: "$1.5", rounded: "$3", hoverStyle: { bg: '$hover' }, children: [_jsx(SizableText, { size: "$2", color: "$ink", numberOfLines: 1, flex: 1, children: r.title || t('Untitled run') }), _jsx(SizableText, { size: "$1", color: "$soft", children: r.status })] }, r.id)))) })] }) }), _jsx(Dialog, { open: switcher, onOpenChange: setSwitcher, children: _jsxs(DialogContent, { maxW: 420, children: [_jsx(DialogTitle, { children: t('Projects') }), _jsx(YStack, { gap: "$1", maxH: 420, overflow: "scroll", children: repos.error ? (_jsx(SizableText, { size: "$2", color: "$soft", children: repos.error.message })) : repos.loading && repos.value.length === 0 ? (_jsx(SizableText, { size: "$2", color: "$soft", children: t('Reading the forge…') })) : (repos.value.map((c) => {
464
+ }, label: t('View') }), end: _jsxs(XStack, { items: "center", gap: "$2", children: [_jsx(XStack, { display: "none", $md: { display: 'flex' }, children: _jsxs(Button, { variant: "outline", size: "sm", onPress: () => void share(), children: [_jsx(Share2, { size: 14 }), " ", t('Share')] }) }), _jsxs(Button, { size: "sm", variant: "primary", "aria-label": t('Publish'), disabled: !clone || !slug, onPress: () => setPublish({ repo: clone, title, ref, name: slug, project: slug }), children: [_jsx(Upload, { size: 14 }), _jsx(SizableText, { size: "$2", color: "inherit", "$max-md": { display: 'none' }, children: t('Publish') })] })] }), chat: chat, dock: _jsx(Console, { lines: lines, height: dock, onHeight: setDock, onClear: () => setPageLines([]), status: run.status || end.status || undefined, label: t('Console') }), collapsed: shut, pane: pane, width: across, onLayout: (e) => setRoom(e.nativeEvent.layout.width), children: [preview, body] }), _jsx(Dialog, { open: history, onOpenChange: setHistory, children: _jsxs(DialogContent, { maxW: 480, children: [_jsx(DialogTitle, { children: t('Runs on {title}', { title }) }), _jsx(YStack, { gap: "$1", children: runs.value.length === 0 ? (_jsx(SizableText, { size: "$2", color: "$soft", children: t('No runs yet.') })) : (runs.value.map((r) => {
465
+ const active = r.id === current;
466
+ return (_jsxs(XStack, { render: "button", "aria-current": active ? 'true' : undefined, onPress: () => {
467
+ setChosen(r.id);
468
+ setHistory(false);
469
+ }, justify: "space-between", items: "center", gap: "$2", px: "$2.5", py: "$2", minH: 40, "$platform-web": { textAlign: 'start' }, focusVisibleStyle: RING, children: [_jsx(SizableText, { size: "$2", color: "$ink", fontWeight: active ? '500' : '400', numberOfLines: 1, flex: 1, children: r.title || t('Untitled run') }), _jsx(SizableText, { size: "$1", color: "$soft", shrink: 0, children: r.status })] }, r.id));
470
+ })) })] }) }), _jsx(Dialog, { open: switcher, onOpenChange: (o) => {
471
+ setSwitcher(o);
472
+ if (!o)
473
+ setSwitchQ('');
474
+ }, children: _jsxs(DialogContent, { maxW: 420, gap: "$3", children: [_jsx(DialogTitle, { children: t('Projects') }), repos.value.length > 6 ? (_jsx(Input, { value: switchQ, onChangeText: setSwitchQ, placeholder: t('Find a project…'), "aria-label": t('Find a project'), startAdornment: _jsx(Search, { size: 14, color: "$soft" }) })) : null, _jsx(YStack, { gap: "$1", maxH: 420, overflow: "scroll", children: repos.error ? (_jsx(SizableText, { size: "$2", color: "$soft", children: repos.error.message })) : repos.loading && repos.value.length === 0 ? (_jsxs(YStack, { gap: "$2", children: [_jsx(SizableText, { size: "$2", color: "$soft", children: t('Reading the forge…') }), _jsx(Skeleton, { layout: "block", height: 36, rounded: "$3" }), _jsx(Skeleton, { layout: "block", height: 36, rounded: "$3" }), _jsx(Skeleton, { layout: "block", height: 36, rounded: "$3" })] })) : filteredRepos.length === 0 ? (_jsx(SizableText, { size: "$2", color: "$soft", py: "$2", children: t('Nothing matches.') })) : (filteredRepos.map((c) => {
468
475
  const here = Boolean(named) && c.name === named?.name;
469
- return (_jsx(XStack, { render: "button", "aria-label": t('Open {repo}', { repo: `${c.org}/${c.name}` }), "aria-current": here ? 'page' : undefined, onPress: () => {
476
+ return (_jsxs(XStack, { render: "button", "aria-label": t('Open {repo}', { repo: `${c.org}/${c.name}` }), "aria-current": here ? 'page' : undefined, onPress: () => {
470
477
  setSwitcher(false);
478
+ setSwitchQ('');
471
479
  host.go(path({ kind: 'repo', org: c.org || host.org || '', name: c.name }));
472
- }, px: "$2", py: "$1.5", rounded: "$3", bg: here ? '$hover' : undefined, hoverStyle: { bg: '$hover' }, children: _jsx(SizableText, { size: "$2", color: "$ink", numberOfLines: 1, children: c.name }) }, `${c.org}/${c.name}`));
480
+ }, px: "$2.5", py: "$2", minH: 40, items: "center", justify: "space-between", gap: "$2", rounded: "$3", hoverStyle: { bg: '$hover' }, "$platform-web": { textAlign: 'start' }, focusVisibleStyle: RING, children: [_jsx(SizableText, { size: "$2", color: "$ink", numberOfLines: 1, children: c.name }), here ? _jsx(Check, { size: 14, color: "$ink" }) : null] }, `${c.org}/${c.name}`));
473
481
  })) }), _jsx(Button, { variant: "outline", size: "sm", onPress: () => {
474
482
  setSwitcher(false);
483
+ setSwitchQ('');
475
484
  host.go(path({ kind: 'screen', screen: 'projects' }));
476
485
  }, children: t('All projects') })] }) }), _jsx(Publish, { source: publish, onClose: () => setPublish(null), onLive: fresh })] }));
477
486
  }
package/lib/reply.d.ts CHANGED
@@ -26,6 +26,11 @@ export declare function speakable(raw: string): string;
26
26
  export type Listen = (text: string, done: () => void) => () => void;
27
27
  /** A reader on the platform's voice (`/v1/audio/speech`), one reply at a time on the page. */
28
28
  export declare function speaker(t: Target): Listen;
29
+ export type Vote = 'up' | 'down';
30
+ /** Show a verdict at once and send it; if sending fails, put the earlier one back, unless the person has voted again since (`last` counts the votes). */
31
+ export declare function rated(prev: Vote | null, next: Vote, send: ((vote: Vote) => void | Promise<void>) | undefined, set: (to: Vote | null) => void, last: {
32
+ n: number;
33
+ }): void;
29
34
  /** Copy, Rate/Vote, Listen, Share, Redo, Branch and Open under an answer; `children` follow them. */
30
35
  export declare function Reply({ text, title, listen, onOpen, onRedo, onBranch, onRate, timestamp, children, }: {
31
36
  text: string;
@@ -34,7 +39,7 @@ export declare function Reply({ text, title, listen, onOpen, onRedo, onBranch, o
34
39
  onOpen?: () => void;
35
40
  onRedo?: (action: RedoAction) => void;
36
41
  onBranch?: () => void;
37
- onRate?: (vote: 'up' | 'down') => void;
42
+ onRate?: (vote: Vote) => void | Promise<void>;
38
43
  timestamp?: string;
39
44
  children?: ReactNode;
40
45
  }): import("react").JSX.Element;
package/lib/reply.js CHANGED
@@ -14,6 +14,7 @@ import { Dialog, DialogContent, DialogTitle, DropdownMenu, DropdownMenuContent,
14
14
  import { ArrowUp, Check, Copy, Globe, Lightbulb, Link2, PanelRight, RefreshCw, Share, Square, ThumbsDown, ThumbsUp, Volume2, } from '@hanzogui/lucide-icons-2';
15
15
  import { mouth, speech } from '@hanzo/voice';
16
16
  import { useEffect, useMemo, useRef, useState } from 'react';
17
+ import { copy as toClipboard } from './clipboard.js';
17
18
  const FENCE = /```([^\n`]*)\n([\s\S]*?)```/g;
18
19
  const MIME = {
19
20
  html: 'text/html',
@@ -93,6 +94,19 @@ export function speaker(t) {
93
94
  return stop;
94
95
  };
95
96
  }
97
+ /** Show a verdict at once and send it; if sending fails, put the earlier one back, unless the person has voted again since (`last` counts the votes). */
98
+ export function rated(prev, next, send, set, last) {
99
+ const mine = ++last.n;
100
+ set(next);
101
+ if (!send)
102
+ return;
103
+ Promise.resolve()
104
+ .then(() => send(next))
105
+ .catch(() => {
106
+ if (last.n === mine)
107
+ set(prev);
108
+ });
109
+ }
96
110
  /** One quiet control in the row. It rests dim and comes up under a pointer or focus. */
97
111
  function Act({ label, onPress, children, lit = false, slot, }) {
98
112
  return (_jsx(XStack, { render: "button", role: "button", "aria-label": label, "data-slot": slot, onPress: onPress, items: "center", justify: "center", gap: "$1", px: "$1.5", height: 28, minW: 28, rounded: "$2", cursor: "pointer", bg: lit ? '$hover' : 'transparent', opacity: lit ? 1 : 0.65, hoverStyle: { opacity: 1, bg: '$hover' }, focusStyle: { opacity: 1 }, children: children }));
@@ -103,6 +117,7 @@ export function Reply({ text, title, listen, onOpen, onRedo, onBranch, onRate, t
103
117
  const [took, setTook] = useState(false);
104
118
  const [speaking, setSpeaking] = useState(false);
105
119
  const [vote, setVote] = useState(null);
120
+ const votes = useRef({ n: 0 });
106
121
  const [redoOpen, setRedoOpen] = useState(false);
107
122
  const [shareOpen, setShareOpen] = useState(false);
108
123
  const [shareCopied, setShareCopied] = useState(false);
@@ -147,13 +162,8 @@ export function Reply({ text, title, listen, onOpen, onRedo, onBranch, onRate, t
147
162
  setRedoPrompt('');
148
163
  onRedo?.(payload);
149
164
  };
150
- return (_jsxs(XStack, { "data-slot": "reply", ml: "$-1", items: "center", gap: "$1", flexWrap: "wrap", children: [_jsx(Act, { slot: "reply-copy", label: took ? say('Copied') : say('Copy this answer'), lit: took, onPress: () => void navigator.clipboard?.writeText(text).then(() => setTook(true), () => { }), children: took ? _jsx(Check, { size: 15 }) : _jsx(Copy, { size: 15 }) }), _jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx(Act, { slot: "reply-rate", label: say('Rate this response'), lit: vote !== null, children: vote === 'down' ? _jsx(ThumbsDown, { size: 15 }) : _jsx(ThumbsUp, { size: 15 }) }) }), _jsxs(DropdownMenuContent, { align: "start", minW: 176, "data-slot": "reply-rate-menu", children: [_jsx(DropdownMenuItem, { "data-slot": "reply-rate-up", onSelect: () => {
151
- setVote('up');
152
- onRate?.('up');
153
- }, children: _jsxs(XStack, { items: "center", gap: "$2", children: [_jsx(ThumbsUp, { size: 15 }), _jsx(SizableText, { size: "$2", color: "$ink", children: say('Good response') })] }) }), _jsx(DropdownMenuItem, { "data-slot": "reply-rate-down", onSelect: () => {
154
- setVote('down');
155
- onRate?.('down');
156
- }, children: _jsxs(XStack, { items: "center", gap: "$2", children: [_jsx(ThumbsDown, { size: 15 }), _jsx(SizableText, { size: "$2", color: "$ink", children: say('Bad response') })] }) })] })] }), listen ? (_jsx(Act, { slot: "reply-listen", label: speaking ? say('Stop reading') : say('Listen to this answer'), lit: speaking, onPress: () => {
165
+ const rate = (next) => rated(vote, next, onRate, setVote, votes.current);
166
+ return (_jsxs(XStack, { "data-slot": "reply", ml: "$-1", items: "center", gap: "$1", flexWrap: "wrap", children: [_jsx(Act, { slot: "reply-copy", label: took ? say('Copied') : say('Copy this answer'), lit: took, onPress: () => void toClipboard(text).then((ok) => ok && setTook(true)), children: took ? _jsx(Check, { size: 15 }) : _jsx(Copy, { size: 15 }) }), _jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx(Act, { slot: "reply-rate", label: say('Rate this response'), lit: vote !== null, children: vote === 'down' ? _jsx(ThumbsDown, { size: 15 }) : _jsx(ThumbsUp, { size: 15 }) }) }), _jsxs(DropdownMenuContent, { align: "start", minW: 176, "data-slot": "reply-rate-menu", children: [_jsx(DropdownMenuItem, { "data-slot": "reply-rate-up", onSelect: () => rate('up'), children: _jsxs(XStack, { items: "center", gap: "$2", children: [_jsx(ThumbsUp, { size: 15 }), _jsx(SizableText, { size: "$2", color: "$ink", children: say('Good response') })] }) }), _jsx(DropdownMenuItem, { "data-slot": "reply-rate-down", onSelect: () => rate('down'), children: _jsxs(XStack, { items: "center", gap: "$2", children: [_jsx(ThumbsDown, { size: 15 }), _jsx(SizableText, { size: "$2", color: "$ink", children: say('Bad response') })] }) })] })] }), listen ? (_jsx(Act, { slot: "reply-listen", label: speaking ? say('Stop reading') : say('Listen to this answer'), lit: speaking, onPress: () => {
157
167
  if (speaking) {
158
168
  stop.current?.();
159
169
  setSpeaking(false);
@@ -161,7 +171,7 @@ export function Reply({ text, title, listen, onOpen, onRedo, onBranch, onRate, t
161
171
  }
162
172
  setSpeaking(true);
163
173
  stop.current = listen(text, () => setSpeaking(false));
164
- }, children: speaking ? _jsx(Square, { size: 14 }) : _jsx(Volume2, { size: 15 }) })) : null, _jsx(Act, { slot: "reply-share", label: say('Share message'), lit: shareOpen, onPress: () => setShareOpen(true), children: _jsx(Share, { size: 15 }) }), _jsxs(DropdownMenu, { open: redoOpen, onOpenChange: setRedoOpen, children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx(Act, { slot: "reply-redo", label: say('Regenerate response'), lit: redoOpen, children: _jsx(RefreshCw, { size: 15 }) }) }), _jsxs(DropdownMenuContent, { align: "start", minW: 232, "data-slot": "reply-redo-menu", children: [_jsxs(XStack, { items: "center", gap: "$1.5", px: "$2", py: "$1.5", children: [_jsx(Input, { "data-slot": "reply-redo-input", placeholder: say('Ask to change response'), value: redoPrompt, onChangeText: setRedoPrompt, onKeyDown: (e) => {
174
+ }, children: speaking ? _jsx(Square, { size: 14 }) : _jsx(Volume2, { size: 15 }) })) : null, _jsx(Act, { slot: "reply-share", label: say('Share message'), lit: shareOpen, onPress: () => setShareOpen(true), children: _jsx(Share, { size: 15 }) }), onRedo ? (_jsxs(DropdownMenu, { open: redoOpen, onOpenChange: setRedoOpen, children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx(Act, { slot: "reply-redo", label: say('Regenerate response'), lit: redoOpen, children: _jsx(RefreshCw, { size: 15 }) }) }), _jsxs(DropdownMenuContent, { align: "start", minW: 232, "data-slot": "reply-redo-menu", children: [_jsxs(XStack, { items: "center", gap: "$1.5", px: "$2", py: "$1.5", children: [_jsx(Input, { "data-slot": "reply-redo-input", placeholder: say('Ask to change response'), value: redoPrompt, onChangeText: setRedoPrompt, onKeyDown: (e) => {
165
175
  e.stopPropagation?.();
166
176
  if (e.key === 'Enter' && redoPrompt.trim()) {
167
177
  e.preventDefault?.();
@@ -171,7 +181,7 @@ export function Reply({ text, title, listen, onOpen, onRedo, onBranch, onRate, t
171
181
  if (redoPrompt.trim()) {
172
182
  triggerRedo({ mode: 'prompt', prompt: redoPrompt.trim() });
173
183
  }
174
- }, children: _jsx(ArrowUp, { size: 14 }) })] }), _jsx(DropdownMenuSeparator, {}), _jsx(DropdownMenuItem, { "data-slot": "redo-retry", onSelect: () => triggerRedo({ mode: 'retry' }), children: _jsxs(XStack, { items: "center", gap: "$2", children: [_jsx(RefreshCw, { size: 15 }), _jsx(SizableText, { size: "$2", color: "$ink", children: say('Try again') }), _jsx(SizableText, { size: "$2", color: "$hint", children: "\u00B7 Auto" })] }) }), _jsx(DropdownMenuItem, { "data-slot": "redo-think", onSelect: () => triggerRedo({ mode: 'think' }), children: _jsxs(XStack, { items: "center", gap: "$2", children: [_jsx(Lightbulb, { size: 15 }), _jsx(SizableText, { size: "$2", color: "$ink", children: say('Think longer') })] }) }), _jsx(DropdownMenuItem, { "data-slot": "redo-web", onSelect: () => triggerRedo({ mode: 'web' }), children: _jsxs(XStack, { items: "center", gap: "$2", children: [_jsx(Globe, { size: 15 }), _jsx(SizableText, { size: "$2", color: "$ink", children: say('Search the web') })] }) })] })] }), onOpen ? (_jsxs(Act, { slot: "reply-open", label: say('Open in the side panel'), onPress: onOpen, children: [_jsx(PanelRight, { size: 14 }), _jsx(SizableText, { size: "$1", color: "$ink", children: say('Open') })] })) : null, children, _jsx(Dialog, { open: shareOpen, onOpenChange: setShareOpen, children: _jsxs(DialogContent, { maxW: 540, width: "100%", gap: "$3.5", "data-slot": "reply-share-modal", children: [_jsx(DialogTitle, { children: title || say('Conversation') }), _jsx(YStack, { p: "$3.5", rounded: "$4", bg: "$panel", borderWidth: 1, borderColor: "$borderColor", maxH: 220, overflow: "scroll", children: _jsx(SizableText, { size: "$2", color: "$ink", lineHeight: "$4", children: text }) }), _jsxs(XStack, { items: "flex-start", gap: "$2.5", children: [_jsx(Globe, { size: 16 }), _jsxs(YStack, { gap: "$0.5", flex: 1, children: [_jsx(SizableText, { size: "$2", fontWeight: "600", color: "$ink", children: say('Share a public link to this message') }), _jsx(SizableText, { size: "$1", color: "$soft", children: say('Anyone with this link can access this message.') })] })] }), _jsxs(XStack, { items: "center", justify: "center", gap: "$5", pt: "$1", children: [_jsxs(YStack, { render: "button", role: "button", "data-slot": "share-copy-link", items: "center", gap: "$1.5", cursor: "pointer", onPress: () => void navigator.clipboard?.writeText(shareUrl).then(() => setShareCopied(true), () => { }), children: [_jsx(XStack, { width: 44, height: 44, rounded: 999, bg: "$hover", items: "center", justify: "center", children: shareCopied ? _jsx(Check, { size: 17 }) : _jsx(Link2, { size: 17 }) }), _jsx(SizableText, { size: "$1", color: "$soft", children: shareCopied ? say('Copied!') : say('Copy link') })] }), _jsxs(YStack, { render: "button", role: "button", "data-slot": "share-x", items: "center", gap: "$1.5", cursor: "pointer", onPress: () => {
184
+ }, children: _jsx(ArrowUp, { size: 14 }) })] }), _jsx(DropdownMenuSeparator, {}), _jsx(DropdownMenuItem, { "data-slot": "redo-retry", onSelect: () => triggerRedo({ mode: 'retry' }), children: _jsxs(XStack, { items: "center", gap: "$2", children: [_jsx(RefreshCw, { size: 15 }), _jsx(SizableText, { size: "$2", color: "$ink", children: say('Try again') }), _jsx(SizableText, { size: "$2", color: "$hint", children: "\u00B7 Auto" })] }) }), _jsx(DropdownMenuItem, { "data-slot": "redo-think", onSelect: () => triggerRedo({ mode: 'think' }), children: _jsxs(XStack, { items: "center", gap: "$2", children: [_jsx(Lightbulb, { size: 15 }), _jsx(SizableText, { size: "$2", color: "$ink", children: say('Think longer') })] }) }), _jsx(DropdownMenuItem, { "data-slot": "redo-web", onSelect: () => triggerRedo({ mode: 'web' }), children: _jsxs(XStack, { items: "center", gap: "$2", children: [_jsx(Globe, { size: 15 }), _jsx(SizableText, { size: "$2", color: "$ink", children: say('Search the web') })] }) })] })] })) : null, onOpen ? (_jsxs(Act, { slot: "reply-open", label: say('Open in the side panel'), onPress: onOpen, children: [_jsx(PanelRight, { size: 14 }), _jsx(SizableText, { size: "$1", color: "$ink", children: say('Open') })] })) : null, children, _jsx(Dialog, { open: shareOpen, onOpenChange: setShareOpen, children: _jsxs(DialogContent, { maxW: 540, width: "100%", gap: "$3.5", "data-slot": "reply-share-modal", children: [_jsx(DialogTitle, { children: title || say('Conversation') }), _jsx(YStack, { p: "$3.5", rounded: "$4", bg: "$panel", borderWidth: 1, borderColor: "$borderColor", maxH: 220, overflow: "scroll", children: _jsx(SizableText, { size: "$2", color: "$ink", lineHeight: "$4", children: text }) }), _jsxs(XStack, { items: "flex-start", gap: "$2.5", children: [_jsx(Link2, { size: 16 }), _jsxs(YStack, { gap: "$0.5", flex: 1, children: [_jsx(SizableText, { size: "$2", fontWeight: "600", color: "$ink", children: say('Copy link to this run') }), _jsx(SizableText, { size: "$1", color: "$soft", children: say('Members of your workspace with access can open this link.') })] })] }), _jsxs(XStack, { items: "center", justify: "center", gap: "$5", pt: "$1", children: [_jsxs(YStack, { render: "button", role: "button", "data-slot": "share-copy-link", items: "center", gap: "$1.5", cursor: "pointer", onPress: () => void toClipboard(shareUrl).then((ok) => ok && setShareCopied(true)), children: [_jsx(XStack, { width: 44, height: 44, rounded: 999, bg: "$hover", items: "center", justify: "center", children: shareCopied ? _jsx(Check, { size: 17 }) : _jsx(Link2, { size: 17 }) }), _jsx(SizableText, { size: "$1", color: "$soft", children: shareCopied ? say('Copied!') : say('Copy link') })] }), _jsxs(YStack, { render: "button", role: "button", "data-slot": "share-x", items: "center", gap: "$1.5", cursor: "pointer", onPress: () => {
175
185
  const snippet = text.length > 200 ? `${text.slice(0, 197)}...` : text;
176
186
  window.open(`https://x.com/intent/tweet?text=${encodeURIComponent(snippet)}&url=${encodeURIComponent(shareUrl)}`, '_blank', 'noopener,noreferrer');
177
187
  }, children: [_jsx(XStack, { width: 44, height: 44, rounded: 999, bg: "$hover", items: "center", justify: "center", children: _jsx(SizableText, { size: "$3", fontWeight: "700", color: "$ink", children: "\uD835\uDD4F" }) }), _jsx(SizableText, { size: "$1", color: "$soft", children: "X" })] }), _jsxs(YStack, { render: "button", role: "button", "data-slot": "share-linkedin", items: "center", gap: "$1.5", cursor: "pointer", onPress: () => {
package/lib/run.js CHANGED
@@ -29,12 +29,13 @@ import { SizableText, useMedia, XStack, YStack } from '@hanzo/gui';
29
29
  import { phrase } from '@hanzo/i18n';
30
30
  import { useI18n } from '@hanzo/i18n/react';
31
31
  import { Check, ChevronDown, ChevronRight, Clock, Copy, ExternalLink, FileDiff, Folder, GitPullRequest, Globe, Layers, MessageSquare, MoreHorizontal, Pencil, Share, SlidersHorizontal, SquareTerminal, } from '@hanzogui/lucide-icons-2';
32
- import { Button, Dialog, DialogContent, DialogTitle, DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, Input, Switch, } from '@hanzo/ui';
32
+ import { Button, Dialog, DialogContent, DialogTitle, DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, Input, } from '@hanzo/ui';
33
33
  import { Steer } from '@hanzo/ui/agents';
34
34
  import { Composer, Failure, measure } from '@hanzo/ui/chat';
35
35
  import { useLimits } from '@hanzo/ui/product/useLimits';
36
36
  import { useDictation, useVoice } from '@hanzo/voice';
37
- import { useEffect, useMemo, useRef, useState } from 'react';
37
+ import { useEffect, useMemo, useState } from 'react';
38
+ import { copy as toClipboard } from './clipboard.js';
38
39
  import { approve, followUp, headline, retry, start, steer } from './api/coding.js';
39
40
  import { limits as readLimits } from './api/models.js';
40
41
  import { list, message, pause, publish, rename, resume, stop, story, took } from './api/sessions.js';
@@ -43,11 +44,13 @@ import { answer as reply, say as talk, talks } from './api/talk.js';
43
44
  import { verdict } from './api/verdict.js';
44
45
  import { useKept, useProjects, useRead, useRun } from './data.js';
45
46
  import { Desk, SEED } from './desk.js';
47
+ import { useDevMode } from './dev-mode.js';
48
+ import { KeepAwake, useKeepAwake } from './awake.js';
46
49
  import { useHost, useTarget } from './host.js';
47
50
  import { level, pacing, useMind } from './mind.js';
48
51
  import { Out } from './out.js';
49
52
  import { Gutter } from './gutter.js';
50
- import { gap, pane } from './pane.js';
53
+ import { gap, pane, RING, RING_INSET } from './pane.js';
51
54
  import { useEar, useSpoken } from './voice.js';
52
55
  import { speaker } from './reply.js';
53
56
  import { PanelToggle } from './panel.js';
@@ -79,6 +82,7 @@ function Job({ id, state: read }) {
79
82
  const host = useHost();
80
83
  const t = useTarget();
81
84
  const signed = Boolean(host.person);
85
+ const [devMode] = useDevMode();
82
86
  const { detail, record, events, status, refused } = read;
83
87
  const [draft, setDraft] = useState('');
84
88
  const [files, setFiles] = useState([]);
@@ -100,13 +104,12 @@ function Job({ id, state: read }) {
100
104
  const [name, setName] = useState('');
101
105
  const [copied, setCopied] = useState('');
102
106
  const [unfolded, setUnfolded] = useState(false);
103
- const [transcriptView, setTranscriptView] = useKept('hanzo.build.transcript.view', 'normal');
104
107
  const [outputStyle, setOutputStyle] = useKept('hanzo.build.output.style', 'default');
108
+ const [transcriptView, setTranscriptView] = useKept('hanzo.build.transcript.view', 'normal');
105
109
  const [envColumn, setEnvColumn] = useState(false);
106
110
  const [splitPanes, setSplitPanes] = useState([]);
107
111
  const [queued, setQueued] = useState([]);
108
- const [keepAwake, setKeepAwake] = useState(false);
109
- const wakeLockRef = useRef(null);
112
+ const [keepAwake, setKeepAwake] = useKeepAwake();
110
113
  const [nowMs, setNowMs] = useState(() => Date.now());
111
114
  // The model and effort a run started here uses: the one choice Chat and New share.
112
115
  const { limits } = useLimits(signed ? (signal) => readLimits(t, signal) : null, t);
@@ -330,13 +333,10 @@ function Job({ id, state: read }) {
330
333
  }
331
334
  };
332
335
  const copy = async (what, value) => {
333
- try {
334
- await navigator.clipboard.writeText(value);
336
+ if (await toClipboard(value))
335
337
  setCopied(what);
336
- }
337
- catch {
338
+ else
338
339
  setNote(say('This browser would not copy.'));
339
- }
340
340
  };
341
341
  const share = (on) => act(async () => {
342
342
  await publish(t, id, on);
@@ -410,22 +410,6 @@ function Job({ id, state: read }) {
410
410
  const timer = setInterval(() => setNowMs(Date.now()), 1000);
411
411
  return () => clearInterval(timer);
412
412
  }, [running, paused]);
413
- const toggleKeepAwake = async (on) => {
414
- setKeepAwake(on);
415
- try {
416
- const nav = navigator;
417
- if (on && nav.wakeLock) {
418
- wakeLockRef.current = await nav.wakeLock.request('screen');
419
- }
420
- else if (!on && wakeLockRef.current?.release) {
421
- await wakeLockRef.current.release();
422
- wakeLockRef.current = null;
423
- }
424
- }
425
- catch {
426
- /* WakeLock API optional */
427
- }
428
- };
429
413
  const toggleDockPane = (kind, label) => {
430
414
  if (!desk)
431
415
  setDesk(true);
@@ -490,15 +474,15 @@ function Job({ id, state: read }) {
490
474
  setSplitPanes([]);
491
475
  side.open({ kind: pid, title: say(pid.charAt(0).toUpperCase() + pid.slice(1)) });
492
476
  } }));
493
- const triggerButton = (_jsxs(XStack, { render: "button", "aria-label": say('Manage this run'), items: "center", gap: "$1.5", maxW: "100%", minW: 0, px: "$1.5", mx: "$-1.5", py: "$0.5", rounded: "$2", hoverStyle: { bg: '$hover' }, children: [_jsx(SizableText, { render: "h1", size: "$5", color: "$ink", numberOfLines: 1, minW: 0, children: title }), _jsx(ChevronDown, { size: 14, opacity: 0.7 })] }));
477
+ const triggerButton = (_jsxs(XStack, { render: "button", "aria-label": say('Manage this run'), items: "center", gap: "$1.5", maxW: "100%", minW: 0, px: "$1.5", mx: "$-1.5", py: "$0.5", minH: 32, rounded: "$2", hoverStyle: { bg: '$hover' }, focusVisibleStyle: RING, children: [_jsx(SizableText, { render: "h1", size: "$5", color: "$ink", numberOfLines: 1, minW: 0, children: title }), _jsx(ChevronDown, { size: 14, opacity: 0.7 })] }));
494
478
  return (_jsxs(XStack, { "data-slot": "run-split", display: "grid", gridTemplateColumns: "minmax(0, 1fr) auto", width: "100%", height: "100%", minH: 0, minW: 0, children: [_jsxs(YStack, { "data-slot": "run", ref: split.main, ...pane, display: "grid", gridTemplateRows: "auto minmax(0, 1fr) auto", width: "100%", height: "100%", minH: 0, minW: 0, children: [_jsxs(XStack, { px: "$4", pt: "$3", pb: "$2", gap: "$1.5", items: "center", minH: 44, children: [_jsxs(YStack, { flex: 1, minW: 0, items: "flex-start", children: [_jsx(XStack, { items: "center", gap: "$1", maxW: "100%", minW: 0, children: signed && record ? (_jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: triggerButton }), _jsxs(DropdownMenuContent, { align: "start", minW: 210, children: [_jsxs(DropdownMenuSub, { children: [_jsx(DropdownMenuSubTrigger, { children: _jsx(SizableText, { size: "$2", color: "$ink", flex: 1, children: say('Open in') }) }), _jsxs(DropdownMenuSubContent, { minW: 170, children: [_jsx(DropdownMenuItem, { onSelect: () => {
495
479
  window.open(`vscode://file/home/z/work/${record.repo.split('/').pop() || ''}`, '_blank');
496
480
  }, children: _jsx(SizableText, { size: "$2", color: "$ink", children: "VS Code" }) }), _jsx(DropdownMenuItem, { onSelect: () => {
497
481
  window.open(`cursor://file/home/z/work/${record.repo.split('/').pop() || ''}`, '_blank');
498
482
  }, children: _jsx(SizableText, { size: "$2", color: "$ink", children: "Cursor" }) }), _jsx(DropdownMenuItem, { onSelect: () => {
499
- side.open({ kind: 'terminal', title: say('Terminal') });
483
+ side.open({ kind: 'terminal', title: say(devMode ? 'Terminal' : 'Activity') });
500
484
  setDesk(true);
501
- }, children: _jsx(SizableText, { size: "$2", color: "$ink", children: say('Terminal') }) }), record.repo ? (_jsx(DropdownMenuItem, { onSelect: () => {
485
+ }, children: _jsx(SizableText, { size: "$2", color: "$ink", children: say(devMode ? 'Terminal' : 'Activity') }) }), record.repo ? (_jsx(DropdownMenuItem, { onSelect: () => {
502
486
  window.open(pr.href || `https://github.com/${record.repo}`, '_blank', 'noopener,noreferrer');
503
487
  }, children: _jsx(SizableText, { size: "$2", color: "$ink", children: "GitHub" }) })) : null, _jsx(DropdownMenuItem, { onSelect: () => void copy('path', record.repo || id), children: _jsx(SizableText, { size: "$2", color: "$ink", children: say('Copy path') }) })] })] }), _jsx(DropdownMenuSeparator, {}), _jsxs(DropdownMenuItem, { "aria-label": say('Rename'), onSelect: () => {
504
488
  setName(title);
@@ -530,7 +514,7 @@ function Job({ id, state: read }) {
530
514
  if (!desk)
531
515
  setDesk(true);
532
516
  setEnvColumn((v) => !v);
533
- }, p: "$1.5", rounded: "$2", bg: envColumn ? '$hover' : 'transparent', hoverStyle: { bg: '$hover' }, children: _jsx(SlidersHorizontal, { size: 15, opacity: envColumn ? 1 : 0.7 }) }), _jsx(XStack, { render: "button", "aria-label": say('Toggle terminal pane'), "aria-pressed": splitPanes.includes('terminal'), onPress: () => toggleDockPane('terminal', say('Terminal')), p: "$1.5", rounded: "$2", bg: splitPanes.includes('terminal') ? '$hover' : 'transparent', hoverStyle: { bg: '$hover' }, children: _jsx(SquareTerminal, { size: 15, opacity: splitPanes.includes('terminal') ? 1 : 0.7 }) }), _jsx(XStack, { render: "button", "aria-label": say('Toggle diff pane'), "aria-pressed": splitPanes.includes('diff'), onPress: () => toggleDockPane('diff', say('Diff')), p: "$1.5", rounded: "$2", bg: splitPanes.includes('diff') ? '$hover' : 'transparent', hoverStyle: { bg: '$hover' }, children: _jsx(FileDiff, { size: 15, opacity: splitPanes.includes('diff') ? 1 : 0.7 }) }), _jsx(XStack, { render: "button", "aria-label": say('Toggle browser pane'), "aria-pressed": splitPanes.includes('preview'), onPress: () => toggleDockPane('preview', say('Preview')), p: "$1.5", rounded: "$2", bg: splitPanes.includes('preview') ? '$hover' : 'transparent', hoverStyle: { bg: '$hover' }, children: _jsx(Globe, { size: 15, opacity: splitPanes.includes('preview') ? 1 : 0.7 }) }), _jsx(XStack, { render: "button", "aria-label": say('Toggle files pane'), "aria-pressed": splitPanes.includes('files'), onPress: () => toggleDockPane('files', say('Files')), p: "$1.5", rounded: "$2", bg: splitPanes.includes('files') ? '$hover' : 'transparent', hoverStyle: { bg: '$hover' }, children: _jsx(Folder, { size: 15, opacity: splitPanes.includes('files') ? 1 : 0.7 }) }), _jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx(XStack, { render: "button", "aria-label": say('More workspace options'), p: "$1.5", rounded: "$2", hoverStyle: { bg: '$hover' }, children: _jsx(MoreHorizontal, { size: 15, opacity: 0.7 }) }) }), _jsxs(DropdownMenuContent, { align: "end", minW: 220, children: [_jsxs(DropdownMenuItem, { onSelect: () => {
517
+ }, minW: 32, minH: 32, items: "center", justify: "center", rounded: "$2", bg: envColumn ? '$hover' : 'transparent', hoverStyle: { bg: '$hover' }, focusVisibleStyle: RING, children: _jsx(SlidersHorizontal, { size: 15, opacity: envColumn ? 1 : 0.7 }) }), _jsx(XStack, { render: "button", "aria-label": say(devMode ? 'Toggle terminal pane' : 'Toggle activity pane'), "aria-pressed": splitPanes.includes('terminal'), onPress: () => toggleDockPane('terminal', say(devMode ? 'Terminal' : 'Activity')), minW: 32, minH: 32, items: "center", justify: "center", rounded: "$2", bg: splitPanes.includes('terminal') ? '$hover' : 'transparent', hoverStyle: { bg: '$hover' }, focusVisibleStyle: RING, children: _jsx(SquareTerminal, { size: 15, opacity: splitPanes.includes('terminal') ? 1 : 0.7 }) }), _jsx(XStack, { render: "button", "aria-label": say('Toggle diff pane'), "aria-pressed": splitPanes.includes('diff'), onClick: () => toggleDockPane('diff', say('Diff')), minW: 32, minH: 32, items: "center", justify: "center", rounded: "$2", bg: splitPanes.includes('diff') ? '$hover' : 'transparent', hoverStyle: { bg: '$hover' }, focusVisibleStyle: RING, children: _jsx(FileDiff, { size: 15, opacity: splitPanes.includes('diff') ? 1 : 0.7 }) }), _jsx(XStack, { render: "button", "aria-label": say('Toggle browser pane'), "aria-pressed": splitPanes.includes('preview'), onClick: () => toggleDockPane('preview', say('Preview')), minW: 32, minH: 32, items: "center", justify: "center", rounded: "$2", bg: splitPanes.includes('preview') ? '$hover' : 'transparent', hoverStyle: { bg: '$hover' }, focusVisibleStyle: RING, children: _jsx(Globe, { size: 15, opacity: splitPanes.includes('preview') ? 1 : 0.7 }) }), _jsx(XStack, { render: "button", "aria-label": say('Toggle files pane'), "aria-pressed": splitPanes.includes('files'), onClick: () => toggleDockPane('files', say('Files')), minW: 32, minH: 32, items: "center", justify: "center", rounded: "$2", bg: splitPanes.includes('files') ? '$hover' : 'transparent', hoverStyle: { bg: '$hover' }, focusVisibleStyle: RING, children: _jsx(Folder, { size: 15, opacity: splitPanes.includes('files') ? 1 : 0.7 }) }), _jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx(XStack, { render: "button", "aria-label": say('More workspace options'), p: "$1.5", rounded: "$2", hoverStyle: { bg: '$hover' }, children: _jsx(MoreHorizontal, { size: 15, opacity: 0.7 }) }) }), _jsxs(DropdownMenuContent, { align: "end", minW: 220, children: [_jsxs(DropdownMenuItem, { onSelect: () => {
534
518
  if (!desk)
535
519
  setDesk(true);
536
520
  setEnvColumn((v) => !v);
@@ -538,9 +522,7 @@ function Job({ id, state: read }) {
538
522
  if (!desk)
539
523
  setDesk(true);
540
524
  setEnvColumn(true);
541
- }, children: [_jsx(Layers, { size: 15 }), _jsx(SizableText, { size: "$2", color: "$ink", flex: 1, children: say('Background tasks') }), _jsx(XStack, { px: "$1.5", py: "$0.5", rounded: 99, bg: "$hover", children: _jsx(SizableText, { size: "$1", color: "$soft", children: String(bgTaskCount) }) })] }), _jsx(DropdownMenuSeparator, {}), _jsxs(DropdownMenuItem, { preventCloseOnSelect: true, onSelect: () => {
542
- void toggleKeepAwake(!keepAwake);
543
- }, children: [_jsxs(YStack, { flex: 1, minW: 0, children: [_jsx(SizableText, { size: "$2", color: "$ink", children: say('Keep computer awake') }), _jsx(SizableText, { size: "$1", color: "$soft", children: say('Only for this session') })] }), _jsx(Switch, { checked: keepAwake, onCheckedChange: (v) => void toggleKeepAwake(v), size: "sm", "aria-label": say('Keep computer awake') })] })] })] })] })) : null, _jsx(PanelToggle, { open: desk, onToggle: () => setDesk(!desk) })] }), _jsx(Transcript, { cards: shown, view: transcriptView, queued: queued, onSendQueued: sendQueued, onOpen: look, onDiff: () => {
525
+ }, children: [_jsx(Layers, { size: 15 }), _jsx(SizableText, { size: "$2", color: "$ink", flex: 1, children: say('Background tasks') }), _jsx(XStack, { px: "$1.5", py: "$0.5", rounded: 99, bg: "$hover", children: _jsx(SizableText, { size: "$1", color: "$soft", children: String(bgTaskCount) }) })] }), _jsx(DropdownMenuSeparator, {}), _jsx(KeepAwake, { on: keepAwake, onToggle: (on) => void setKeepAwake(on) })] })] })] })) : null, _jsx(PanelToggle, { open: desk, onToggle: () => setDesk(!desk) })] }), _jsx(Transcript, { cards: shown, view: transcriptView, queued: queued, onSendQueued: sendQueued, onOpen: look, onDiff: () => {
544
526
  side.open({ kind: 'diff', title: say('Diff') });
545
527
  setDesk(true);
546
528
  }, listen: signed ? listen : undefined, end: failed ? (_jsx(Failure, { onRetry: busy ? undefined : () => void act(() => carry(again, 'retry')), children: end.problem
@@ -561,12 +543,12 @@ function Job({ id, state: read }) {
561
543
  ? setup
562
544
  ? say('Setting up environment')
563
545
  : say('Starting…')
564
- : say('Waiting for the run’s first step…') })) : (_jsxs(YStack, { gap: "$3", items: "flex-start", children: [_jsx(SizableText, { size: "$2", color: "$soft", children: say('Sign in to follow this run.') }), _jsx(Button, { size: "sm", onPress: () => host.signIn?.(), children: say('Sign in') })] })) }), _jsxs(YStack, { pb: "$3", pt: "$2", gap: "$2", children: [_jsxs(YStack, { ...measure, gap: "$2", children: [end.problem ? (_jsx(SizableText, { size: "$1", color: "$soft", children: say('The branch is pushed, and the pull request could not be opened.') })) : null, note || (signed && refused) ? (_jsx(SizableText, { size: "$1", color: "$soft", role: "status", children: note || refused })) : null, plan.length ? (_jsxs(YStack, { borderWidth: 1, borderColor: "$borderColor", rounded: "$3", overflow: "hidden", children: [_jsxs(XStack, { render: "button", "aria-label": say('Steps · {n}', { n: plan.length }), "aria-expanded": unfolded, onPress: () => setUnfolded(!unfolded), px: "$3", py: "$1.5", gap: "$2", items: "center", hoverStyle: { bg: '$hover' }, children: [unfolded ? _jsx(ChevronDown, { size: 14 }) : _jsx(ChevronRight, { size: 14 }), _jsx(SizableText, { size: "$2", color: "$ink", children: say('Steps · {n}', { n: plan.length }) }), current && !unfolded ? (_jsx(SizableText, { flex: 1, minW: 0, size: "$1", color: "$soft", numberOfLines: 1, text: "end", children: current.name })) : null] }), unfolded
546
+ : say('Waiting for the run’s first step…') })) : (_jsxs(YStack, { gap: "$3", items: "flex-start", children: [_jsx(SizableText, { size: "$2", color: "$soft", children: say('Sign in to follow this run.') }), _jsx(Button, { size: "sm", onPress: () => host.signIn?.(), children: say('Sign in') })] })) }), _jsxs(YStack, { pb: "$3", pt: "$2", gap: "$2", children: [_jsxs(YStack, { ...measure, gap: "$2", children: [end.problem ? (_jsx(SizableText, { size: "$1", color: "$soft", children: say('The branch is pushed, and the pull request could not be opened.') })) : null, note || (signed && refused) ? (_jsx(SizableText, { size: "$1", color: "$soft", role: "status", children: note || refused })) : null, plan.length ? (_jsxs(YStack, { borderWidth: 1, borderColor: "$borderColor", rounded: "$3", overflow: "hidden", children: [_jsxs(XStack, { render: "button", "aria-label": say('Steps · {n}', { n: plan.length }), "aria-expanded": unfolded, onClick: () => setUnfolded(!unfolded), width: "100%", px: "$3", py: "$1.5", minH: 36, gap: "$2", items: "center", hoverStyle: { bg: '$hover' }, focusVisibleStyle: RING_INSET, children: [unfolded ? _jsx(ChevronDown, { size: 14 }) : _jsx(ChevronRight, { size: 14 }), _jsx(SizableText, { size: "$2", color: "$ink", children: say('Steps · {n}', { n: plan.length }) }), current && !unfolded ? (_jsx(SizableText, { flex: 1, minW: 0, size: "$1", color: "$soft", numberOfLines: 1, text: "end", children: current.name })) : null] }), unfolded
565
547
  ? plan.map((s) => {
566
548
  const on = s === current;
567
549
  return (_jsxs(XStack, { items: "center", gap: "$2", px: "$3", py: "$1.5", borderTopWidth: 1, borderColor: "$borderColor", children: [_jsx(SizableText, { size: "$2", color: s.done || on ? '$ink' : '$soft', children: s.done ? '✓' : on ? '●' : '○' }), _jsx(SizableText, { size: "$2", color: s.done ? '$soft' : '$ink', numberOfLines: 1, children: s.name })] }, s.name));
568
550
  })
569
- : null] })) : null, setup && running && !seen ? _jsx(Onboarding, { onDone: () => setSeen(true) }) : null, running && !paused ? (_jsxs(XStack, { items: "center", gap: "$2", px: "$1", children: [_jsx(SizableText, { size: "$1", color: "$orange10", children: "\u2022\u00B7" }), _jsx(SizableText, { size: "$1", color: "$soft", children: `${elapsedLabel} · ${tokenLabel} · ${say('Thinking')}` })] })) : null, running ? (_jsxs(XStack, { items: "center", gap: "$2", px: "$3", py: "$2", rounded: "$10", borderWidth: 1, borderColor: "$borderColor", flexWrap: "wrap", rowGap: "$1", children: [_jsx(SizableText, { size: "$2", color: "$ink", flex: 1, minW: 160, children: paused
551
+ : null] })) : null, setup && running && !seen ? _jsx(Onboarding, { onDone: () => setSeen(true) }) : null, running && !paused ? (_jsxs(XStack, { items: "center", gap: "$2", px: "$1", children: [_jsx(YStack, { width: 6, height: 6, rounded: 99, bg: "var(--state-online)", shrink: 0 }), _jsx(SizableText, { size: "$1", color: "$soft", fontVariant: ['tabular-nums'], children: devMode ? `${elapsedLabel} · ${tokenLabel} · ${say('Thinking')}` : `${elapsedLabel} · ${say('Working…')}` })] })) : null, running ? (_jsxs(XStack, { items: "center", gap: "$2", px: "$3", py: "$2", rounded: "$10", borderWidth: 1, borderColor: "$borderColor", flexWrap: "wrap", rowGap: "$1", children: [_jsx(SizableText, { size: "$2", color: "$ink", flex: 1, minW: 160, children: paused
570
552
  ? kept.pushed
571
553
  ? say('Paused — its work so far is on its branch.')
572
554
  : say('Paused.')
@@ -601,9 +583,9 @@ function Onboarding({ onDone }) {
601
583
  t('Name the secrets it needs — you set their values'),
602
584
  t('Propose the environment for you to review and save'),
603
585
  ];
604
- return (_jsxs(YStack, { gap: "$3", p: "$4", rounded: "$4", borderWidth: 1, borderColor: "$borderColor", bg: "$panel", children: [_jsx(SizableText, { size: "$4", color: "$ink", children: t('Set up a cloud environment') }), _jsx(SizableText, { size: "$2", color: "$soft", children: [
605
- t('An environment lets every later run install, start, test and check its changes the way an engineer does.'),
606
- t('Setup is agent-led and takes several minutes.'),
607
- t('The agent will:'),
608
- ].join(' ') }), _jsx(YStack, { gap: "$1.5", children: steps.map((s, i) => (_jsxs(XStack, { gap: "$3", children: [_jsx(SizableText, { size: "$2", color: "$soft", width: 12, children: String(i + 1) }), _jsx(SizableText, { size: "$2", color: "$ink", children: s })] }, s))) }), _jsx(SizableText, { size: "$2", color: "$soft", children: t('Interrupt anytime to steer the agent or ask it questions.') }), _jsx(Button, { size: "sm", onPress: onDone, children: t('Got it') })] }));
586
+ return (_jsxs(YStack, { gap: "$3", p: "$5", rounded: "$4", borderWidth: 1, borderColor: "var(--border-strong)", bg: "$panel", children: [_jsxs(YStack, { gap: "$1.5", children: [_jsx(SizableText, { size: "$4", fontWeight: "600", color: "$ink", children: t('Set up a cloud environment') }), _jsx(SizableText, { size: "$2", color: "$soft", children: [
587
+ t('An environment lets every later run install, start, test and check its changes the way an engineer does.'),
588
+ t('Setup is agent-led and takes several minutes.'),
589
+ t('The agent will:'),
590
+ ].join(' ') })] }), _jsx(YStack, { gap: "$1.5", children: steps.map((s, i) => (_jsxs(XStack, { gap: "$2.5", children: [_jsx(SizableText, { size: "$2", color: "$soft", width: 16, fontVariant: ['tabular-nums'], children: String(i + 1) }), _jsx(SizableText, { size: "$2", color: "$ink", children: s })] }, s))) }), _jsx(SizableText, { size: "$2", color: "$soft", children: t('Interrupt anytime to steer the agent or ask it questions.') }), _jsx(Button, { size: "sm", onPress: onDone, children: t('Got it') })] }));
609
591
  }