@hanzo/app 0.3.93 → 0.3.95
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Account.d.ts +9 -3
- package/dist/Account.js +142 -141
- package/dist/App.js +71 -37
- package/dist/Bar.js +1 -1
- package/dist/Betas.d.ts +1 -1
- package/dist/Betas.js +16 -22
- package/dist/Board.js +113 -47
- package/dist/CalScheduler.d.ts +1 -0
- package/dist/CalScheduler.js +223 -57
- package/dist/Chat.js +432 -153
- package/dist/Contacts.js +35 -31
- package/dist/ContextMenu.js +126 -42
- package/dist/Directory.js +1 -1
- package/dist/Drawer.js +1 -1
- package/dist/Drive.js +351 -119
- package/dist/Gate.js +156 -13
- package/dist/Home.js +31 -53
- package/dist/Inbox.js +29 -15
- package/dist/InlineRename.d.ts +6 -0
- package/dist/InlineRename.js +41 -0
- package/dist/Learning.js +132 -13
- package/dist/Market.js +13 -9
- package/dist/Meet.d.ts +5 -0
- package/dist/Meet.js +75 -51
- package/dist/MoreMenu.d.ts +19 -0
- package/dist/MoreMenu.js +33 -0
- package/dist/NeedMoreUsage.js +2 -2
- package/dist/OrgSwitcher.js +6 -2
- package/dist/Rail.d.ts +73 -7
- package/dist/Rail.js +372 -111
- package/dist/Recents.js +77 -24
- package/dist/RightPane.js +2 -2
- package/dist/Search.d.ts +13 -1
- package/dist/Search.js +366 -50
- package/dist/Setup.js +34 -5
- package/dist/Shared.js +12 -12
- package/dist/Shell.js +210 -151
- package/dist/Sidebar.d.ts +14 -3
- package/dist/Sidebar.js +411 -129
- package/dist/SkipLink.d.ts +8 -0
- package/dist/SkipLink.js +11 -0
- package/dist/Start.js +51 -52
- package/dist/Terminals.js +159 -11
- package/dist/ToBottom.js +1 -1
- package/dist/Upgrade.d.ts +8 -3
- package/dist/Upgrade.js +194 -103
- package/dist/Usage.d.ts +1 -1
- package/dist/Usage.js +186 -82
- package/dist/WalletPill.js +8 -2
- package/dist/Work.js +162 -53
- package/dist/archive.d.ts +8 -0
- package/dist/archive.js +16 -0
- package/dist/bots/Bots.js +1 -1
- package/dist/bots/ComputerDialog.js +53 -26
- package/dist/bots/ConnectorsDialog.js +34 -15
- package/dist/bots/Make.js +5 -1
- package/dist/bots/Panel.js +37 -31
- package/dist/bots/Roster.js +18 -13
- package/dist/bots/Thread.js +54 -27
- package/dist/bots/face.js +6 -2
- package/dist/bots/kit.d.ts +1 -0
- package/dist/bots/kit.js +1 -1
- package/dist/bots/refusal.d.ts +13 -4
- package/dist/bots/refusal.js +62 -8
- package/dist/chord.d.ts +13 -0
- package/dist/chord.js +30 -1
- package/dist/crew.js +47 -4
- package/dist/ground.d.ts +1 -1
- package/dist/ground.js +1 -1
- package/dist/help.d.ts +7 -3
- package/dist/help.js +19 -14
- package/dist/keys.d.ts +28 -0
- package/dist/keys.js +58 -0
- package/dist/lib/arrival.d.ts +5 -0
- package/dist/lib/arrival.js +10 -0
- package/dist/lib/betas.d.ts +2 -0
- package/dist/lib/betas.js +10 -0
- package/dist/lib/branch.d.ts +11 -0
- package/dist/lib/branch.js +11 -0
- package/dist/lib/chatPreferences.d.ts +1 -1
- package/dist/lib/chatPreferences.js +1 -1
- package/dist/lib/dev-mode.d.ts +18 -0
- package/dist/lib/dev-mode.js +102 -0
- package/dist/lib/info-hint.d.ts +7 -0
- package/dist/lib/info-hint.js +8 -0
- package/dist/lib/model-picker.d.ts +2 -0
- package/dist/lib/model-picker.js +12 -0
- package/dist/lib/owners.d.ts +5 -0
- package/dist/lib/owners.js +15 -0
- package/dist/lib/pay.d.ts +2 -0
- package/dist/lib/pay.js +4 -0
- package/dist/lib/todo.d.ts +6 -0
- package/dist/lib/todo.js +37 -25
- package/dist/look.js +39 -8
- package/dist/rail-open.d.ts +9 -0
- package/dist/rail-open.js +34 -0
- package/dist/renaming.d.ts +10 -0
- package/dist/renaming.js +25 -0
- package/dist/thread.d.ts +2 -1
- package/dist/thread.js +85 -44
- package/package.json +11 -11
package/dist/Work.js
CHANGED
|
@@ -12,19 +12,74 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
12
12
|
// so a fan-out is invisible until you ask for it: each root with `children > 0`
|
|
13
13
|
// gets one `tree` read, and `nest` is not needed here because the server
|
|
14
14
|
// already materialises the nesting. A root with no children costs no request.
|
|
15
|
-
import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
15
|
+
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
16
|
+
import { Plus } from 'lucide-react';
|
|
16
17
|
import { useAi, useSession, useSessions } from '@hanzo/ai/react';
|
|
17
18
|
import { useOpen } from './open.js';
|
|
18
19
|
import { asked, KEY } from './watch.js';
|
|
19
20
|
import { AgentBoard, ChannelHeader, Pane, ProgressBlock, Steer, steps, } from '@hanzo/ui/agents';
|
|
20
|
-
import { Text, XStack, YStack } from '@hanzo/ui';
|
|
21
|
+
import { Box, Button, Skeleton, Text, XStack, YStack } from '@hanzo/ui';
|
|
21
22
|
import { useIam } from '@hanzo/iam/react';
|
|
23
|
+
import { enter, LOGIN } from './lib/destination.js';
|
|
22
24
|
import { useI18n } from '@hanzo/i18n/react';
|
|
23
25
|
import { Composer } from '@hanzo/ui/chat';
|
|
24
26
|
import { Start } from './Start.js';
|
|
25
27
|
import { Bar } from './progress.js';
|
|
26
28
|
/** The server's four statuses, plus the honest fallback for anything else. */
|
|
27
29
|
const STATUS = (s) => s === 'running' || s === 'paused' || s === 'done' || s === 'error' ? s : 'unknown';
|
|
30
|
+
/** Format elapsed duration in crisp human units: `14s`, `2m 10s`, `1h 4m`. */
|
|
31
|
+
function formatDuration(startedAt, endedAt, nowMs = Date.now()) {
|
|
32
|
+
if (!startedAt)
|
|
33
|
+
return null;
|
|
34
|
+
const start = Date.parse(startedAt);
|
|
35
|
+
const end = endedAt ? Date.parse(endedAt) : nowMs;
|
|
36
|
+
if (!Number.isFinite(start) || !Number.isFinite(end))
|
|
37
|
+
return null;
|
|
38
|
+
const totalSec = Math.max(0, Math.floor((end - start) / 1000));
|
|
39
|
+
if (totalSec < 60)
|
|
40
|
+
return `${totalSec}s`;
|
|
41
|
+
if (totalSec < 3600) {
|
|
42
|
+
const mins = Math.floor(totalSec / 60);
|
|
43
|
+
const secs = totalSec % 60;
|
|
44
|
+
return secs > 0 ? `${mins}m ${secs}s` : `${mins}m`;
|
|
45
|
+
}
|
|
46
|
+
const hours = Math.floor(totalSec / 3600);
|
|
47
|
+
const mins = Math.floor((totalSec % 3600) / 60);
|
|
48
|
+
return mins > 0 ? `${hours}h ${mins}m` : `${hours}h`;
|
|
49
|
+
}
|
|
50
|
+
function statusLabel(status, t) {
|
|
51
|
+
switch (status) {
|
|
52
|
+
case 'running':
|
|
53
|
+
return t('Running');
|
|
54
|
+
case 'paused':
|
|
55
|
+
return t('Needs review');
|
|
56
|
+
case 'done':
|
|
57
|
+
return t('Done');
|
|
58
|
+
case 'error':
|
|
59
|
+
return t('Failed');
|
|
60
|
+
default:
|
|
61
|
+
return t('Queued');
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
function matchesFilter(status, filter) {
|
|
65
|
+
if (filter === 'all')
|
|
66
|
+
return true;
|
|
67
|
+
if (filter === 'running')
|
|
68
|
+
return status === 'running';
|
|
69
|
+
if (filter === 'review')
|
|
70
|
+
return status === 'paused';
|
|
71
|
+
if (filter === 'done')
|
|
72
|
+
return status === 'done';
|
|
73
|
+
return status === 'error';
|
|
74
|
+
}
|
|
75
|
+
/** Calm monochrome layout-matched skeleton for the runs sidebar list. */
|
|
76
|
+
function RunsSkeleton({ label }) {
|
|
77
|
+
return (_jsxs(YStack, { role: "status", "aria-busy": true, "aria-label": label, gap: "$2.5", p: "$3", width: "100%", children: [_jsx(Skeleton, { layout: "block", width: 72, height: 11, rounded: "$2" }), [0, 1, 2, 3].map((i) => (_jsxs(XStack, { items: "center", gap: "$2.5", p: "$2.5", rounded: "$3", borderWidth: 1, borderColor: "$edge", bg: "$panel", children: [_jsx(Skeleton, { layout: "block", width: 8, height: 8, rounded: 9999, shrink: 0 }), _jsxs(YStack, { flex: 1, minW: 0, gap: "$1.5", children: [_jsx(Skeleton, { layout: "block", width: i % 2 === 0 ? '78%' : '64%', height: 13, rounded: "$2" }), _jsx(Skeleton, { layout: "block", width: i % 2 === 0 ? '48%' : '38%', height: 10, rounded: "$2" })] }), _jsx(Skeleton, { layout: "block", width: 36, height: 11, rounded: "$2", shrink: 0 })] }, i)))] }));
|
|
78
|
+
}
|
|
79
|
+
/** Calm monochrome layout-matched skeleton for the full Mission Control workspace. */
|
|
80
|
+
function WorkWorkspaceSkeleton({ label }) {
|
|
81
|
+
return (_jsxs(YStack, { role: "status", "aria-busy": true, "aria-label": label, flex: 1, minH: 0, width: "100%", overflow: "hidden", $lg: { flexDirection: 'row' }, children: [_jsx(YStack, { width: "100%", height: 200, shrink: 0, borderBottomWidth: 1, borderColor: "$edge", $lg: { width: 280, height: '100%', borderBottomWidth: 0, borderRightWidth: 1 }, children: _jsx(RunsSkeleton, { label: label }) }), _jsxs(YStack, { flex: 1, minW: 0, minH: 0, p: "$5", gap: "$4", children: [_jsxs(XStack, { items: "center", justify: "space-between", gap: "$3", children: [_jsx(Skeleton, { layout: "block", width: 220, height: 20, rounded: "$2" }), _jsx(Skeleton, { layout: "block", width: 68, height: 20, rounded: "$10" })] }), _jsxs(YStack, { gap: "$3", p: "$4", rounded: "$4", borderWidth: 1, borderColor: "$edge", bg: "$panel", children: [_jsx(Skeleton, { layout: "block", width: "60%", height: 14, rounded: "$2" }), _jsx(Skeleton, { layout: "block", width: "88%", height: 12, rounded: "$2" }), _jsx(Skeleton, { layout: "block", width: "72%", height: 12, rounded: "$2" })] })] })] }));
|
|
82
|
+
}
|
|
28
83
|
/**
|
|
29
84
|
* A session as the board reads it.
|
|
30
85
|
*
|
|
@@ -65,19 +120,25 @@ const previewOf = (preview, t) => {
|
|
|
65
120
|
default: return kind.replace(/_/g, ' ');
|
|
66
121
|
}
|
|
67
122
|
};
|
|
68
|
-
const toRun = (s, t, children = []) =>
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
123
|
+
const toRun = (s, t, nowMs, children = []) => {
|
|
124
|
+
const status = STATUS(s.status);
|
|
125
|
+
const ended = status === 'running' ? undefined : (s.endedAt || s.updatedAt);
|
|
126
|
+
const elapsed = formatDuration(s.startedAt || s.createdAt, ended, nowMs);
|
|
127
|
+
const meta = [s.target, elapsed].filter(Boolean).join(' · ');
|
|
128
|
+
return {
|
|
129
|
+
id: s.id,
|
|
130
|
+
agent: s.title || s.agent || s.id,
|
|
131
|
+
status,
|
|
132
|
+
doing: previewOf(s.lastEvent?.preview, t),
|
|
133
|
+
target: meta || undefined,
|
|
134
|
+
project: s.project,
|
|
135
|
+
children,
|
|
136
|
+
};
|
|
137
|
+
};
|
|
77
138
|
/** Flatten the server's tree into the board's, dropping the node we asked for. */
|
|
78
|
-
const kidsOf = (node, t) =>
|
|
139
|
+
const kidsOf = (node, t, nowMs) =>
|
|
79
140
|
// `children` is NULL on a leaf, not `[]` — the guard is load-bearing.
|
|
80
|
-
(node?.children ?? []).map((child) => child.session ? toRun(child.session, t, kidsOf(child, t)) : null).filter((r) => r !== null);
|
|
141
|
+
(node?.children ?? []).map((child) => child.session ? toRun(child.session, t, nowMs, kidsOf(child, t, nowMs)) : null).filter((r) => r !== null);
|
|
81
142
|
function Watching({ idle }) {
|
|
82
143
|
const { t } = useI18n();
|
|
83
144
|
const ai = useAi();
|
|
@@ -89,6 +150,16 @@ function Watching({ idle }) {
|
|
|
89
150
|
// and the list is re-read when the id changes so the new row is there to open.
|
|
90
151
|
const { session: open, openSession: setOpen } = useOpen();
|
|
91
152
|
const [trees, setTrees] = useState({});
|
|
153
|
+
const [filter, setFilter] = useState('all');
|
|
154
|
+
const [nowMs, setNowMs] = useState(() => Date.now());
|
|
155
|
+
const safeSessions = useMemo(() => (Array.isArray(sessions) ? sessions : []), [sessions]);
|
|
156
|
+
const hasRunning = useMemo(() => safeSessions.some((s) => STATUS(s?.status) === 'running'), [safeSessions]);
|
|
157
|
+
useEffect(() => {
|
|
158
|
+
if (!hasRunning)
|
|
159
|
+
return;
|
|
160
|
+
const timer = window.setInterval(() => setNowMs(Date.now()), 1000);
|
|
161
|
+
return () => window.clearInterval(timer);
|
|
162
|
+
}, [hasRunning]);
|
|
92
163
|
// A run the address names opens on arrival: Home's "{n} failed" sends
|
|
93
164
|
// /work?session=<id> (./watch). The param is then dropped, the way Chat drops
|
|
94
165
|
// `?thread=`, so the address is the board's own again and a reload does not
|
|
@@ -110,61 +181,88 @@ function Watching({ idle }) {
|
|
|
110
181
|
// One `tree` read per root that says it has children. Roots without a
|
|
111
182
|
// fan-out are left alone, so an org of solo runs costs exactly one request.
|
|
112
183
|
useEffect(() => {
|
|
113
|
-
const safeSessions = Array.isArray(sessions) ? sessions : [];
|
|
114
184
|
const swarms = safeSessions.filter((s) => (s?.children ?? 0) > 0);
|
|
115
185
|
if (!swarms.length)
|
|
116
186
|
return;
|
|
117
187
|
const stop = new AbortController();
|
|
188
|
+
const snapshotNow = Date.now();
|
|
118
189
|
void Promise.all(swarms.map((s) => ai.sessions
|
|
119
190
|
.tree(s.id, { signal: stop.signal })
|
|
120
|
-
.then((node) => [s.id, kidsOf(node, t)])
|
|
191
|
+
.then((node) => [s.id, kidsOf(node, t, snapshotNow)])
|
|
121
192
|
.catch(() => [s.id, []]))).then((pairs) => {
|
|
122
193
|
if (!stop.signal.aborted)
|
|
123
194
|
setTrees(Object.fromEntries(pairs));
|
|
124
195
|
});
|
|
125
196
|
return () => stop.abort();
|
|
126
|
-
}, [ai,
|
|
127
|
-
const runs = useMemo(() =>
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
197
|
+
}, [ai, safeSessions, t]);
|
|
198
|
+
const runs = useMemo(() => safeSessions.map((s) => toRun(s, t, nowMs, trees[s.id] ?? [])), [safeSessions, trees, t, nowMs]);
|
|
199
|
+
const counts = useMemo(() => {
|
|
200
|
+
let running = 0;
|
|
201
|
+
let review = 0;
|
|
202
|
+
let done = 0;
|
|
203
|
+
let failed = 0;
|
|
204
|
+
for (const r of runs) {
|
|
205
|
+
if (r.status === 'running')
|
|
206
|
+
running += 1;
|
|
207
|
+
else if (r.status === 'paused')
|
|
208
|
+
review += 1;
|
|
209
|
+
else if (r.status === 'done')
|
|
210
|
+
done += 1;
|
|
211
|
+
else if (r.status === 'error')
|
|
212
|
+
failed += 1;
|
|
213
|
+
}
|
|
214
|
+
return { all: runs.length, running, review, done, failed };
|
|
215
|
+
}, [runs]);
|
|
216
|
+
const visibleRuns = useMemo(() => runs.filter((r) => matchesFilter(r.status, filter)), [runs, filter]);
|
|
217
|
+
const [composing, setComposing] = useState(false);
|
|
218
|
+
const didAutoSelectRef = useRef(false);
|
|
219
|
+
useEffect(() => {
|
|
220
|
+
if (open)
|
|
221
|
+
setComposing(false);
|
|
222
|
+
}, [open]);
|
|
223
|
+
// Auto-select the first active (or most recent) run on mount/load so /work opens directly to live activity.
|
|
224
|
+
useEffect(() => {
|
|
225
|
+
if (didAutoSelectRef.current || composing || open || runs.length === 0)
|
|
226
|
+
return;
|
|
227
|
+
if (typeof window !== 'undefined' && new URLSearchParams(window.location.search).has(KEY))
|
|
228
|
+
return;
|
|
229
|
+
const latest = runs.find((r) => r.status === 'running') ?? runs[0];
|
|
230
|
+
if (latest) {
|
|
231
|
+
didAutoSelectRef.current = true;
|
|
232
|
+
setOpen(latest.id);
|
|
233
|
+
}
|
|
234
|
+
}, [composing, open, runs, setOpen]);
|
|
235
|
+
const filterPills = [
|
|
236
|
+
{ id: 'all', label: t('All'), count: counts.all },
|
|
237
|
+
{ id: 'running', label: t('Running'), count: counts.running },
|
|
238
|
+
{ id: 'review', label: t('Needs review'), count: counts.review },
|
|
239
|
+
{ id: 'done', label: t('Done'), count: counts.done },
|
|
240
|
+
{ id: 'failed', label: t('Failed'), count: counts.failed },
|
|
241
|
+
];
|
|
242
|
+
return (_jsxs(YStack, { flex: 1, minH: 0, width: "100%", overflow: "hidden", $lg: { flexDirection: 'row' }, children: [_jsxs(YStack
|
|
243
|
+
// AN EMPTY BOARD DRAWS NOTHING ACROSS THE TOP once settled. While loading,
|
|
244
|
+
// keep it mounted so the calm shimmer skeleton shows without layout jump.
|
|
135
245
|
, {
|
|
136
|
-
// AN EMPTY BOARD DRAWS NOTHING ACROSS THE TOP
|
|
137
|
-
//
|
|
138
|
-
|
|
139
|
-
// whole budget spent saying there is nothing to show. As a COLUMN it is
|
|
140
|
-
// still worth drawing empty, because a column with a heading is where a
|
|
141
|
-
// reader looks for the list; a strip is not.
|
|
142
|
-
display: runs.length === 0 ? 'none' : 'flex', width: "100%",
|
|
143
|
-
// A STRIP HAS A HEIGHT, and `maxHeight` could not give it one. The
|
|
144
|
-
// board inside is a ScrollView at `flex: 1 1 0` — a zero basis — so in
|
|
145
|
-
// a column with an auto height it measured 1px and the strip vanished.
|
|
146
|
-
// "Up to 220" is not expressible over a child that contributes nothing;
|
|
147
|
-
// 220 is.
|
|
148
|
-
height: 220, shrink: 0, borderBottomWidth: 1,
|
|
149
|
-
// A COLUMN NEEDS A WINDOW WIDE ENOUGH FOR TWO. At 640 this took 300 of
|
|
150
|
-
// the 316px left after the rail and the sidebar, so the pane beside it
|
|
151
|
-
// was 32px wide and the run itself was unreadable — a narrow strip with
|
|
152
|
-
// a rule down it, which is what a squeezed column looks like. Above
|
|
153
|
-
// 1024 there is space for both; below it the board is a strip across the
|
|
154
|
-
// top and the run has the whole width under it.
|
|
155
|
-
//
|
|
156
|
-
// STATE THE VALUE, NEVER `undefined`. gui emits nothing for an
|
|
157
|
-
// undefined value, so the base cap this block used to lift SURVIVED
|
|
158
|
-
// into `$lg` and the full-height column described here was a 220px stub
|
|
159
|
-
// at every width — measured in the browser at 1280.
|
|
160
|
-
$lg: {
|
|
246
|
+
// AN EMPTY BOARD DRAWS NOTHING ACROSS THE TOP once settled. While loading,
|
|
247
|
+
// keep it mounted so the calm shimmer skeleton shows without layout jump.
|
|
248
|
+
display: runs.length === 0 && !loading ? 'none' : 'flex', width: "100%", height: 220, $sm: { height: 248 }, shrink: 0, borderBottomWidth: 1, $lg: {
|
|
161
249
|
display: 'flex',
|
|
162
250
|
width: 300,
|
|
163
251
|
shrink: 0,
|
|
164
252
|
height: '100%',
|
|
165
253
|
borderBottomWidth: 0,
|
|
166
254
|
borderRightWidth: 1,
|
|
167
|
-
}, borderColor: "$borderColor", children:
|
|
255
|
+
}, borderColor: "$borderColor", children: [_jsxs(YStack, { gap: "$2", px: "$3", pt: "$3", pb: "$2.5", borderBottomWidth: 1, borderColor: "$edge", shrink: 0, children: [_jsxs(XStack, { items: "center", justify: "space-between", gap: "$2", children: [_jsxs(XStack, { items: "center", gap: "$2", minW: 0, flex: 1, children: [_jsx(Text, { fontSize: "$3", fontWeight: "600", color: "$ink", numberOfLines: 1, children: t('Runs') }), _jsxs(XStack, { "data-slot": "work-run-count", items: "center", gap: "$1.5", px: "$2", py: 2, rounded: "$10", bg: "$panel", borderWidth: 1, borderColor: "var(--border-strong)", shrink: 0, children: [counts.running > 0 ? (_jsx(YStack, { "data-motion": "pulse", width: 6, height: 6, rounded: 9999, bg: "var(--state-success)", shrink: 0, "aria-hidden": true })) : null, _jsx(Text, { fontFamily: "$mono", fontSize: "$1", fontWeight: "500", color: "$ink", fontVariant: ['tabular-nums'], children: counts.running > 0 ? t('{count} live', { count: counts.running }) : String(counts.all) })] })] }), _jsxs(Box, { render: _jsx("button", { type: "button" }), "data-slot": "work-new-run", "aria-label": t('New run'), onClick: () => {
|
|
256
|
+
didAutoSelectRef.current = true;
|
|
257
|
+
setComposing(true);
|
|
258
|
+
setOpen(null);
|
|
259
|
+
}, px: "$2", py: "$1", minH: 26, "$max-sm": { minH: 44, px: '$2.5' }, rounded: "$2", borderWidth: 1, borderColor: "var(--border-strong)", bg: composing && !open ? '$panel' : 'transparent', display: "inline-flex", items: "center", gap: "$1", shrink: 0, cursor: "pointer", hoverStyle: { bg: '$hover' }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: 'solid', outlineColor: 'var(--ring)' }, children: [_jsx(Plus, { size: 12, color: "var(--foreground)", "aria-hidden": true }), _jsx(Text, { fontSize: "$1", fontWeight: "500", color: "$ink", numberOfLines: 1, children: t('New run') })] })] }), _jsx(XStack, { "data-slot": "work-status-filters", items: "center", gap: "$1", flexWrap: "wrap", role: "group", "aria-label": t('Filter runs by status'), children: filterPills.map((pill) => {
|
|
260
|
+
const active = filter === pill.id;
|
|
261
|
+
return (_jsxs(Box, { render: _jsx("button", { type: "button" }), "aria-pressed": active, onClick: () => setFilter(pill.id), px: "$2", py: "$1", rounded: "$10", minH: 26, "$max-sm": { minH: 44, px: '$2.5' }, display: "inline-flex", items: "center", gap: "$1", cursor: "pointer", borderWidth: 1, borderColor: active ? 'var(--border-strong)' : '$edge', bg: active ? '$raised' : 'transparent', hoverStyle: { bg: active ? '$raised' : '$hover' }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: 'solid', outlineColor: 'var(--ring)' }, children: [_jsx(Text, { fontSize: "$1", fontWeight: active ? '600' : '500', color: active ? '$ink' : '$quiet', children: pill.label }), pill.count > 0 && pill.id !== 'all' ? (_jsx(Text, { fontFamily: "$mono", fontSize: "$1", color: "$soft", fontVariant: ['tabular-nums'], children: pill.count })) : null] }, pill.id));
|
|
262
|
+
}) })] }), loading && runs.length === 0 ? (_jsx(RunsSkeleton, { label: t('Loading runs') })) : (_jsx(AgentBoard, { runs: visibleRuns, active: open ?? undefined, onOpen: (id) => {
|
|
263
|
+
setComposing(false);
|
|
264
|
+
setOpen(id);
|
|
265
|
+
}, empty: runs.length > 0 && filter !== 'all' ? (_jsxs(YStack, { gap: "$2", items: "flex-start", children: [_jsx(Text, { fontSize: "$2", color: "$soft", children: t('No runs in this state.') }), _jsx(Box, { render: _jsx("button", { type: "button" }), onClick: () => setFilter('all'), px: "$2.5", py: "$1.5", minH: 32, "$max-sm": { minH: 44 }, rounded: "$2", borderWidth: 1, borderColor: "var(--border-strong)", bg: "transparent", hoverStyle: { bg: '$hover' }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: 'solid', outlineColor: 'var(--ring)' }, cursor: "pointer", children: _jsx(Text, { fontSize: "$1", fontWeight: "500", color: "$ink", children: t('Show all runs') }) })] })) : (_jsx(Text, { fontSize: "$2", color: "$soft", children: t('No runs yet. Start one and it appears here.') })) }))] }), _jsx(YStack, { width: "100%", flex: 1, minW: 0, minH: 0, overflow: "hidden", $lg: { width: 'auto' }, children: open ? _jsx(Watch, { id: open }, open) : loading && runs.length === 0 ? (_jsxs(YStack, { flex: 1, minH: 0, p: "$5", gap: "$4", role: "status", "aria-busy": true, "aria-label": t('Loading runs'), children: [_jsx(Skeleton, { layout: "block", width: 200, height: 20, rounded: "$2" }), _jsxs(YStack, { gap: "$2.5", p: "$4", rounded: "$4", borderWidth: 1, borderColor: "$edge", bg: "$panel", children: [_jsx(Skeleton, { layout: "block", width: "55%", height: 14, rounded: "$2" }), _jsx(Skeleton, { layout: "block", width: "84%", height: 12, rounded: "$2" }), _jsx(Skeleton, { layout: "block", width: "68%", height: 12, rounded: "$2" })] })] })) : composing ? (_jsx(Idle, { runs: 0 })) : (idle ?? _jsx(Idle, { runs: runs.length })) })] }));
|
|
168
266
|
}
|
|
169
267
|
/**
|
|
170
268
|
* Nothing is open. What that MEANS depends on whether there is anything to
|
|
@@ -225,6 +323,14 @@ function Watch({ id }) {
|
|
|
225
323
|
const { steps: shown, message } = useMemo(() => steps(events), [events]);
|
|
226
324
|
const status = STATUS(session?.status);
|
|
227
325
|
const finished = status === 'done' || status === 'error';
|
|
326
|
+
const [tickNow, setTickNow] = useState(() => Date.now());
|
|
327
|
+
useEffect(() => {
|
|
328
|
+
if (status !== 'running')
|
|
329
|
+
return;
|
|
330
|
+
const timer = window.setInterval(() => setTickNow(Date.now()), 1000);
|
|
331
|
+
return () => window.clearInterval(timer);
|
|
332
|
+
}, [status]);
|
|
333
|
+
const elapsed = formatDuration(session?.startedAt || session?.createdAt, status === 'running' ? undefined : (session?.endedAt || session?.updatedAt), tickNow);
|
|
228
334
|
const steer = useCallback(async (command) => {
|
|
229
335
|
setNote(null);
|
|
230
336
|
try {
|
|
@@ -261,7 +367,7 @@ function Watch({ id }) {
|
|
|
261
367
|
setNote(t('Could not reach this run'));
|
|
262
368
|
}
|
|
263
369
|
}, [ai, draft, id, t]);
|
|
264
|
-
return (_jsxs(
|
|
370
|
+
return (_jsxs(YStack, { flex: 1, minH: 0, minW: 0, overflow: "hidden", $xl: { flexDirection: 'row' }, children: [_jsxs(YStack, { flex: 1, minH: 0, minW: 0, overflow: "hidden", children: [_jsx(ChannelHeader, { name: session?.title || session?.agent || id, artifacts: 0, children: _jsxs(XStack, { items: "center", gap: "$2", children: [_jsxs(XStack, { items: "center", gap: "$1.5", px: "$2", py: 2, rounded: "$10", bg: "$panel", borderWidth: 1, borderColor: "$edge", children: [status === 'running' ? (_jsx(YStack, { "data-motion": "pulse", width: 6, height: 6, rounded: 9999, bg: "var(--state-success)", shrink: 0, "aria-hidden": true })) : null, _jsx(Text, { fontSize: "$1", fontWeight: "500", color: status === 'error' ? 'var(--state-error)' : '$quiet', children: statusLabel(status, t) })] }), elapsed ? (_jsx(Text, { fontFamily: "$mono", fontSize: "$1", color: "$quiet", fontVariant: ['tabular-nums'], children: elapsed })) : null] }) }), _jsx(XStack, { px: "$4", pb: "$2", children: _jsx(Bar, { run: session }) }), _jsx(YStack, { flex: 1, minH: 0, overflowY: "auto", overflowX: "hidden", p: "$4", gap: "$4", children: _jsx(ProgressBlock, { steps: shown, done: finished, children: message ? (_jsx(Text, { fontSize: "$4", color: "$ink", children: message })) : null }) }), _jsxs(YStack, { p: "$3", gap: "$2", borderTopWidth: 1, borderColor: "$borderColor", shrink: 0, children: [_jsx(Steer, { onCommand: (c) => void steer(c), withhold: finished ? ['pause', 'resume', 'stop'] : [], note: note }), _jsx(Composer, { value: draft, onChange: setDraft, onSend: () => void send(), placeholder: t('Steer this run…'), label: t('Steer this run') })] })] }), _jsx(YStack, { width: "100%", height: 190, "$max-sm": { height: 168 }, shrink: 0, p: "$3", borderTopWidth: 1, $xl: { width: 360, height: '100%', shrink: 0, borderTopWidth: 0, borderLeftWidth: 1 }, borderColor: "$borderColor", overflow: "hidden", children: _jsx(Pane, { tabs: [
|
|
265
371
|
{ id: 'code', label: t('Code'), kind: 'code', content: _jsx(Nothing, { what: "changes" }) },
|
|
266
372
|
{ id: 'view', label: t('View'), kind: 'view', content: _jsx(Nothing, { what: "preview" }) },
|
|
267
373
|
{ id: 'canvas', label: t('Canvas'), kind: 'canvas', content: _jsx(Nothing, { what: "summary" }) },
|
|
@@ -287,8 +393,11 @@ function Nothing({ what }) {
|
|
|
287
393
|
export function Work({ idle }) {
|
|
288
394
|
const { t } = useI18n();
|
|
289
395
|
const { user, isLoading } = useIam();
|
|
290
|
-
if (isLoading
|
|
291
|
-
return
|
|
396
|
+
if (isLoading) {
|
|
397
|
+
return _jsx(WorkWorkspaceSkeleton, { label: t('Loading runs') });
|
|
398
|
+
}
|
|
399
|
+
if (!user) {
|
|
400
|
+
return (_jsxs(YStack, { flex: 1, items: "center", justify: "center", p: "$6", gap: "$2", children: [_jsx(Text, { render: "h1", fontSize: "$5", fontWeight: "600", color: "$ink", children: t('Agents') }), _jsx(Text, { fontSize: "$3", color: "$soft", text: "center", children: t('Sign in to watch your agents work.') }), _jsx(Button, { size: "sm", variant: "primary", rounded: "$3", minH: 36, "$max-sm": { minH: 44 }, mt: "$2", onClick: () => enter(LOGIN), children: t('Sign in') })] }));
|
|
292
401
|
}
|
|
293
402
|
return _jsx(Watching, { idle: idle });
|
|
294
403
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Thread } from '@hanzo/ai';
|
|
2
|
+
/** What archiving a conversation needs of the store: the change, answered true when it held. */
|
|
3
|
+
interface Archiver {
|
|
4
|
+
archive: (t: Thread) => Promise<boolean>;
|
|
5
|
+
}
|
|
6
|
+
/** Archive or unarchive one conversation. An archive is said with an Undo that puts it back, since nothing else brings it back to the list. */
|
|
7
|
+
export declare function archiveWithUndo(act: Archiver, t: (s: string) => string, target: Thread): Promise<void>;
|
|
8
|
+
export {};
|
package/dist/archive.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { toast } from '@hanzo/ui';
|
|
2
|
+
/** Archive or unarchive one conversation. An archive is said with an Undo that puts it back, since nothing else brings it back to the list. */
|
|
3
|
+
export async function archiveWithUndo(act, t, target) {
|
|
4
|
+
const wasArchived = Boolean(target.archived);
|
|
5
|
+
if (!(await act.archive(target)))
|
|
6
|
+
return;
|
|
7
|
+
if (wasArchived) {
|
|
8
|
+
toast.success(t('Unarchived chat'));
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
const archived = { ...target, archived: true };
|
|
12
|
+
toast(t('Archived chat'), {
|
|
13
|
+
duration: 5000,
|
|
14
|
+
action: { label: t('Undo'), onClick: () => void act.archive(archived) },
|
|
15
|
+
});
|
|
16
|
+
}
|
package/dist/bots/Bots.js
CHANGED
|
@@ -324,7 +324,7 @@ export function Bots({ foot = true, bot: held, onBot, } = {}) {
|
|
|
324
324
|
const panel = activeGroup ? (_jsx(GroupPanel, { group: activeGroup, groups: groups, bots: bots ?? [], onClose: close, onEdit: () => setEditingGroup(activeGroup), onDelete: removeGroup, onPickBot: pick }, `grp:${activeGroup.name}`)) : bot ? (_jsx(Panel, { bot: bot, groups: groups, runs: runs ?? [], kept: kept[bot.name] ?? '', onClose: close, onSchedule: schedule, onDelete: remove, onBotChanged: read, onPickGroup: pick, focus: over && !laptop }, bot.name)) : null;
|
|
325
325
|
const shown = laptop ? side : over;
|
|
326
326
|
const hasSelection = Boolean(bot || activeGroup);
|
|
327
|
-
return (_jsxs(XStack, { "data-parity-key": "bots.window", width: "100%", height: "100%", overflow: "hidden", bg: FLOOR, position: "relative", children: [_jsx(YStack, { "data-parity-key": "bots.roster", width: 260, shrink: 0, height: "100%", bg: FLOOR, borderRightWidth: 1, borderColor: LINE, "$max-md": { width: '100%', borderRightWidth: 0, display: hasSelection ? 'none' : 'flex' }, children: _jsx(Roster, { bots: bots, groups: groups, last: last, open: openRef, unread: unread, me: foot ? user : null, onPick: pick, onMake: () => setMaking(true), onMakeGroup: () => setMakingGroup(true), disabled: !live }) }), _jsx(YStack, { "data-parity-key": "bots.center", flex: 1, minW: 0, height: "100%", bg: GROUND, "$max-md": { display: hasSelection ? 'flex' : 'none' }, children: activeGroup ? (_jsx(GroupThread, { group: activeGroup, bots: bots ?? [], side: shown, onSide: () => (laptop ? setSide(!side) : setOver(!over)), onBack: back, onEdit: () => setEditingGroup(activeGroup), onPickBot: pick })) : (_jsx(Thread, { bot: bot, bots: bots ?? [], runs: runs, pending: pending, notice: notice, wrong: wrong, side: shown, live: live, loaded: bots !== null, onSend: send, onDismiss: () => setNotice(null), onSide: () => (laptop ? setSide(!side) : setOver(!over)), onBack: back, onMake: () => setMaking(true) })) }), laptop && side && panel ? (_jsx(YStack, { "data-parity-key": "bots.panel", width: 300, shrink: 0, height: "100%", bg: GROUND, borderLeftWidth: 1, borderColor: LINE, "$max-xl": { display: 'none' }, children: panel })) : null, over && panel && !laptop ? (_jsx(YStack, { "data-parity-key": "bots.panel.over", role: "dialog", "aria-modal": true, "aria-label": activeGroup?.name || bot?.name, position: "absolute", t: 0, r: 0, b: 0, width: 300, maxW: "100%", z: 10, bg: GROUND, borderLeftWidth: 1, borderColor: LINE, boxShadow: "var(--shadow-floating)", children: panel })) : null, making ? _jsx(Make, { groups: groups, onDone: made, onCancel: () => setMaking(false) }) : null, makingGroup || editingGroup ? (_jsx(MakeGroupDialog, { bots: bots ?? [], groups: groups, initial: editingGroup, onDone: savedGroup, onCancel: () => {
|
|
327
|
+
return (_jsxs(XStack, { "data-parity-key": "bots.window", width: "100%", height: "100%", overflow: "hidden", bg: FLOOR, position: "relative", children: [_jsx(YStack, { "data-parity-key": "bots.roster", width: 260, shrink: 0, height: "100%", bg: FLOOR, borderRightWidth: 1, borderColor: LINE, "$max-md": { width: '100%', borderRightWidth: 0, display: hasSelection ? 'none' : 'flex' }, children: _jsx(Roster, { bots: bots, groups: groups, last: last, open: openRef, unread: unread, me: foot ? user : null, onPick: pick, onMake: () => setMaking(true), onMakeGroup: () => setMakingGroup(true), disabled: !live }) }), _jsx(YStack, { "data-parity-key": "bots.center", flex: 1, minW: 0, height: "100%", bg: GROUND, "$max-md": { display: hasSelection ? 'flex' : 'none' }, children: activeGroup ? (_jsx(GroupThread, { group: activeGroup, bots: bots ?? [], side: shown, onSide: () => (laptop ? setSide(!side) : setOver(!over)), onBack: back, onEdit: () => setEditingGroup(activeGroup), onPickBot: pick }, activeGroup.name)) : (_jsx(Thread, { bot: bot, bots: bots ?? [], runs: runs, pending: pending, notice: notice, wrong: wrong, side: shown, live: live, loaded: bots !== null, onSend: send, onDismiss: () => setNotice(null), onSide: () => (laptop ? setSide(!side) : setOver(!over)), onBack: back, onMake: () => setMaking(true) })) }), laptop && side && panel ? (_jsx(YStack, { "data-parity-key": "bots.panel", width: 312, minW: 300, shrink: 0, height: "100%", bg: GROUND, borderLeftWidth: 1, borderColor: LINE, "$max-xl": { display: 'none' }, children: panel })) : null, over && panel && !laptop ? (_jsx(YStack, { "data-parity-key": "bots.panel.over", role: "dialog", "aria-modal": true, "aria-label": activeGroup?.name || bot?.name, position: "absolute", t: 0, r: 0, b: 0, width: 312, minW: 300, "$max-sm": { minW: 0 }, maxW: "100%", z: 10, bg: GROUND, borderLeftWidth: 1, borderColor: LINE, boxShadow: "var(--shadow-floating)", children: panel })) : null, making ? _jsx(Make, { groups: groups, onDone: made, onCancel: () => setMaking(false) }) : null, makingGroup || editingGroup ? (_jsx(MakeGroupDialog, { bots: bots ?? [], groups: groups, initial: editingGroup, onDone: savedGroup, onCancel: () => {
|
|
328
328
|
setMakingGroup(false);
|
|
329
329
|
setEditingGroup(null);
|
|
330
330
|
} })) : null] }));
|
|
@@ -10,21 +10,15 @@ import { useCallback, useEffect, useRef, useState } from 'react';
|
|
|
10
10
|
import { useI18n } from '@hanzo/i18n/react';
|
|
11
11
|
import { Input, Text, XStack, YStack } from '@hanzo/gui';
|
|
12
12
|
import { Dialog, DialogContent, DialogTitle, DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger, } from '@hanzo/ui';
|
|
13
|
-
import { Camera, ClipboardPaste, ExternalLink, Eye, KeyRound, Maximize2, Minimize2, Monitor, MousePointerClick, Pause, Play, RefreshCw, Send, Sparkles, Terminal, } from 'lucide-react';
|
|
13
|
+
import { Camera, ClipboardPaste, ExternalLink, Eye, KeyRound, Maximize2, Minimize2, Monitor, MousePointerClick, Pause, Play, RefreshCw, Send, Sparkles, Terminal, X, } from 'lucide-react';
|
|
14
14
|
import { useAi } from '../lib/ai.js';
|
|
15
15
|
import { say } from '../failure.js';
|
|
16
16
|
import { called } from '../team.js';
|
|
17
17
|
import { VaultDialog, readVault } from '../vault.js';
|
|
18
18
|
import { actComputer, bootOrResumeComputer, disk, findBotComputer, grant, opened, parkComputer, runDesktopAgent, updateBotMeta, } from './api.js';
|
|
19
|
-
import { CLIP, PILL, WORD } from './kit.js';
|
|
20
|
-
import { DIM } from './ink.js';
|
|
21
|
-
|
|
22
|
-
// invariant across light and dark page themes.
|
|
23
|
-
const FLOOR = 'var(--white-05)';
|
|
24
|
-
const RAISED = 'var(--white-08)';
|
|
25
|
-
const PICKED = 'var(--white-16)';
|
|
26
|
-
const LINE = 'var(--white-15)';
|
|
27
|
-
const INK = 'var(--pure-white)';
|
|
19
|
+
import { CLIP, PILL, ROUND, WORD } from './kit.js';
|
|
20
|
+
import { DIM, EDGE, FLOOR, GROUND, INK, LINE, PICKED, RAISED } from './ink.js';
|
|
21
|
+
import { useDevMode } from '../lib/dev-mode.js';
|
|
28
22
|
function PulsingCluster({ label }) {
|
|
29
23
|
const [step, setStep] = useState(0);
|
|
30
24
|
useEffect(() => {
|
|
@@ -34,11 +28,12 @@ function PulsingCluster({ label }) {
|
|
|
34
28
|
return (_jsxs(YStack, { items: "center", justify: "center", gap: 18, "aria-live": "polite", children: [_jsx(XStack, { items: "center", justify: "center", gap: 6, height: 20, children: [0, 1, 2].map((i) => {
|
|
35
29
|
const active = step === i;
|
|
36
30
|
const mid = i === 1;
|
|
37
|
-
return (_jsx(YStack, { width: mid ? 7 : 4, height: mid ? 7 : 4, rounded: 999, bg:
|
|
38
|
-
}) }), _jsx(Text, { fontSize: 13, lineHeight: 18, fontWeight: "500", color:
|
|
31
|
+
return (_jsx(YStack, { width: mid ? 7 : 4, height: mid ? 7 : 4, rounded: 999, bg: INK, opacity: active ? 1 : 0.3 }, i));
|
|
32
|
+
}) }), _jsx(Text, { fontSize: 13, lineHeight: 18, fontWeight: "500", color: DIM, children: label })] }));
|
|
39
33
|
}
|
|
40
34
|
export function ComputerDialog({ open, onOpenChange, bot, box, onUpdated, }) {
|
|
41
35
|
const { t } = useI18n();
|
|
36
|
+
const [devMode] = useDevMode();
|
|
42
37
|
const { client } = useAi();
|
|
43
38
|
const displayName = called(bot.name);
|
|
44
39
|
const iframeRef = useRef(null);
|
|
@@ -260,8 +255,12 @@ export function ComputerDialog({ open, onOpenChange, bot, box, onUpdated, }) {
|
|
|
260
255
|
}
|
|
261
256
|
setStatusToast(out.text ||
|
|
262
257
|
(field === 'totp'
|
|
263
|
-
?
|
|
264
|
-
|
|
258
|
+
? devMode
|
|
259
|
+
? t('Typed 6-digit 2FA code for {name} via KMS.', { name: item.name })
|
|
260
|
+
: t('Entered 6-digit verification code for {name}.', { name: item.name })
|
|
261
|
+
: devMode
|
|
262
|
+
? t('Autofilled {name} via zero-knowledge KMS.', { name: item.name })
|
|
263
|
+
: t('Filled login for {name}.', { name: item.name })));
|
|
265
264
|
}
|
|
266
265
|
catch (e) {
|
|
267
266
|
setError(say(e, t('credential autofill'), 'save', t));
|
|
@@ -282,11 +281,17 @@ export function ComputerDialog({ open, onOpenChange, bot, box, onUpdated, }) {
|
|
|
282
281
|
action: 'save_credential',
|
|
283
282
|
});
|
|
284
283
|
if (out.ok === false) {
|
|
285
|
-
setError(out.text ||
|
|
284
|
+
setError(out.text ||
|
|
285
|
+
(devMode
|
|
286
|
+
? t('No staged credential found at /dev/shm/.hanzo-credential.json.')
|
|
287
|
+
: t('No staged app login found to save.')));
|
|
286
288
|
return;
|
|
287
289
|
}
|
|
288
290
|
await refreshVault();
|
|
289
|
-
setStatusToast(out.text ||
|
|
291
|
+
setStatusToast(out.text ||
|
|
292
|
+
(devMode
|
|
293
|
+
? t('Sealed sandbox app credential into Hanzo KMS and shredded RAM file.')
|
|
294
|
+
: t('Saved login to your vault.')));
|
|
290
295
|
}
|
|
291
296
|
catch (e) {
|
|
292
297
|
setError(say(e, t('sandbox credential save'), 'save', t));
|
|
@@ -361,17 +366,31 @@ export function ComputerDialog({ open, onOpenChange, bot, box, onUpdated, }) {
|
|
|
361
366
|
setRunningTask(false);
|
|
362
367
|
}
|
|
363
368
|
};
|
|
369
|
+
useEffect(() => {
|
|
370
|
+
if (!open || vaultOpen)
|
|
371
|
+
return;
|
|
372
|
+
const onKey = (e) => {
|
|
373
|
+
if (e.key === 'Escape') {
|
|
374
|
+
e.preventDefault();
|
|
375
|
+
onOpenChange(false);
|
|
376
|
+
}
|
|
377
|
+
};
|
|
378
|
+
window.addEventListener('keydown', onKey);
|
|
379
|
+
return () => window.removeEventListener('keydown', onKey);
|
|
380
|
+
}, [open, vaultOpen, onOpenChange]);
|
|
364
381
|
const logins = vaultItems.filter((i) => i.kind === 'login');
|
|
365
382
|
const otherSecrets = vaultItems.filter((i) => i.kind !== 'login');
|
|
366
383
|
const showBottomBar = phase === 'connecting' || phase === 'live' || awake;
|
|
367
|
-
return (_jsxs(_Fragment, { children: [_jsx(Dialog, { open: open, onOpenChange: onOpenChange, children: _jsx(DialogContent, { "data-parity-key": "bots.computer.dialog", width: expanded ?
|
|
368
|
-
?
|
|
384
|
+
return (_jsxs(_Fragment, { children: [_jsx(Dialog, { open: open, onOpenChange: onOpenChange, children: _jsx(DialogContent, { "data-parity-key": "bots.computer.dialog", width: "calc(100vw - 24px)", maxW: expanded ? 1480 : 1140, "$max-sm": { width: 'calc(100vw - 24px)', maxW: 'calc(100vw - 24px)', rounded: 14 }, p: 0, showCloseButton: false, bg: GROUND, borderWidth: 1, borderColor: EDGE, rounded: 18, overflow: "hidden", children: _jsxs(YStack, { height: expanded ? '92vh' : '86vh', maxH: "94vh", bg: GROUND, minW: 0, children: [_jsxs(XStack, { minH: 46, px: 14, py: 6, "$max-sm": { px: 10, py: 8, gap: 8 }, items: "center", justify: "space-between", flexWrap: "wrap", gap: 10, borderBottomWidth: 1, borderColor: LINE, bg: FLOOR, shrink: 0, children: [_jsxs(XStack, { items: "center", gap: 10, minW: 0, flex: 1, children: [_jsx(YStack, { width: 8, height: 8, rounded: 999, shrink: 0, bg: awake ? 'var(--state-online)' : DIM, opacity: awake ? 1 : 0.45, "aria-hidden": true }), _jsx(DialogTitle, { children: _jsx(Text, { ...CLIP, fontSize: "$2", lineHeight: 18, fontWeight: "500", color: INK, children: awake
|
|
385
|
+
? devMode
|
|
386
|
+
? `${displayName} · ${activeBox?.id ?? disk(bot.name)}`
|
|
387
|
+
: `${displayName} · ${t('Cloud desktop')}`
|
|
369
388
|
: phase === 'parked'
|
|
370
|
-
? `${displayName} · ${t('
|
|
371
|
-
: `${displayName} · ${t('
|
|
389
|
+
? `${displayName} · ${t('Paused')}`
|
|
390
|
+
: `${displayName} · ${t('Cloud desktop')}` }) })] }), _jsxs(XStack, { items: "center", gap: 6, flexWrap: "wrap", shrink: 0, children: [awake && activeBox?.id ? (_jsxs(_Fragment, { children: [devMode || mode === 'terminal' ? (_jsxs(XStack, { render: "button", type: 'button', "aria-label": mode === 'screen' ? t('Switch to terminal') : t('Switch to desktop'), onClick: () => {
|
|
372
391
|
setSnapDataUrl(null);
|
|
373
392
|
setMode((m) => (m === 'screen' ? 'terminal' : 'screen'));
|
|
374
|
-
}, height:
|
|
393
|
+
}, height: 28, "$max-sm": { minH: 44 }, px: 10, gap: 5, rounded: 999, items: "center", bg: RAISED, borderWidth: 1, borderColor: EDGE, cursor: "pointer", transition: "quickest", hoverStyle: { bg: PICKED }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: 'solid', outlineColor: 'var(--ring)' }, children: [mode === 'screen' ? (_jsx(Terminal, { size: 12, color: INK, "aria-hidden": true })) : (_jsx(Monitor, { size: 12, color: INK, "aria-hidden": true })), _jsx(Text, { fontSize: "$1", lineHeight: 15, color: INK, children: mode === 'screen' ? t('Terminal') : t('Desktop') })] })) : null, _jsxs(DropdownMenu, { placement: "bottom-end", offset: 6, children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsxs(XStack, { render: "button", type: 'button', "aria-label": t('Autofill login or secret'), height: 28, "$max-sm": { minH: 44 }, px: 10, gap: 5, rounded: 999, items: "center", bg: RAISED, borderWidth: 1, borderColor: EDGE, cursor: "pointer", transition: "quickest", hoverStyle: { bg: PICKED }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: 'solid', outlineColor: 'var(--ring)' }, children: [_jsx(KeyRound, { size: 12, color: INK, "aria-hidden": true }), _jsx(Text, { fontSize: 11, lineHeight: 15, color: INK, children: t('Autofill') })] }) }), _jsxs(DropdownMenuContent, { minW: 260, children: [logins.map((item) => (_jsx(DropdownMenuItem, { onSelect: () => void runAutofill(item, item.totpSecretKey ? 'login_totp' : 'login'), children: _jsxs(YStack, { gap: 1, children: [_jsx(Text, { fontSize: "$3", fontWeight: "500", color: "$ink", children: `${item.name}${item.domain ? ` (${item.domain})` : ''}` }), _jsx(Text, { fontSize: "$1", color: DIM, children: item.username
|
|
375
394
|
? item.totpSecretKey
|
|
376
395
|
? t('Fill {user} + password + 2FA via {src}', {
|
|
377
396
|
user: item.username,
|
|
@@ -380,14 +399,22 @@ export function ComputerDialog({ open, onOpenChange, bot, box, onUpdated, }) {
|
|
|
380
399
|
: t('Fill {user} + password via {src}', { user: item.username, src: item.source })
|
|
381
400
|
: t('Fill password via {src}', { src: item.source }) })] }) }, item.id))), logins
|
|
382
401
|
.filter((i) => Boolean(i.totpSecretKey))
|
|
383
|
-
.map((item) => (_jsx(DropdownMenuItem, { onSelect: () => void runAutofill(item, 'totp'), children: _jsx(Text, { fontSize: "$2", color: "$ink", children: t('2FA TOTP code only · {name}', { name: item.name }) }) }, `${item.id}-totp`))), otherSecrets.slice(0, 5).map((item) => (_jsx(DropdownMenuItem, { onSelect: () => void runAutofill(item, 'secret'), children: _jsx(Text, { fontSize: "$2", color: "$ink", children: t('Type secret · {name}', { name: item.name }) }) }, item.id))), _jsx(DropdownMenuItem, { onSelect: () => void sealStagedAppCredential(), children: _jsxs(YStack, { gap: 1, children: [_jsx(Text, { fontSize: "$2", fontWeight: "600", color: "$ink", children: t('Seal staged sandbox app login → KMS') }), _jsx(Text, { fontSize: "$1", color: DIM, children: t('Imports /dev/shm/.hanzo-credential.json & shreds RAM file') })] }) }), _jsx(DropdownMenuItem, { onSelect: () => setVaultOpen(true), children: _jsx(Text, { fontSize: "$2", fontWeight: "600", color: "$ink", children: vaultItems.length === 0
|
|
384
|
-
?
|
|
385
|
-
|
|
402
|
+
.map((item) => (_jsx(DropdownMenuItem, { onSelect: () => void runAutofill(item, 'totp'), children: _jsx(Text, { fontSize: "$2", color: "$ink", children: t('2FA TOTP code only · {name}', { name: item.name }) }) }, `${item.id}-totp`))), otherSecrets.slice(0, 5).map((item) => (_jsx(DropdownMenuItem, { onSelect: () => void runAutofill(item, 'secret'), children: _jsx(Text, { fontSize: "$2", color: "$ink", children: t('Type secret · {name}', { name: item.name }) }) }, item.id))), devMode ? (_jsx(DropdownMenuItem, { onSelect: () => void sealStagedAppCredential(), children: _jsxs(YStack, { gap: 1, children: [_jsx(Text, { fontFamily: "$body", fontSize: "$2", fontWeight: "600", color: "$ink", children: t('Seal staged sandbox app login → KMS') }), _jsx(Text, { fontFamily: "$body", fontSize: "$1", color: DIM, children: t('Imports /dev/shm/.hanzo-credential.json & shreds RAM file') })] }) })) : null, _jsx(DropdownMenuItem, { onSelect: () => setVaultOpen(true), children: _jsx(Text, { fontFamily: "$body", fontSize: "$2", fontWeight: "600", color: "$ink", children: vaultItems.length === 0
|
|
403
|
+
? devMode
|
|
404
|
+
? t('+ Add 1Password, LastPass, or KMS logins…')
|
|
405
|
+
: t('Add saved logins…')
|
|
406
|
+
: devMode
|
|
407
|
+
? t('Manage vault & password managers…')
|
|
408
|
+
: t('Manage saved logins…') }) })] })] }), _jsx(XStack, { render: "button", type: 'button', "aria-label": t('Paste clipboard to desktop'), onClick: () => void pasteClipboardToDesktop(), width: 28, height: 28, "$max-sm": { width: 44, height: 44 }, rounded: 999, items: "center", justify: "center", bg: "transparent", borderWidth: 0, cursor: "pointer", transition: "quickest", hoverStyle: { bg: PICKED }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: 'solid', outlineColor: 'var(--ring)' }, children: _jsx(ClipboardPaste, { size: 13, color: DIM, "aria-hidden": true }) }), _jsx(XStack, { render: "button", type: 'button', "aria-label": t('Capture screenshot'), onClick: () => void captureScreenshot(), width: 28, height: 28, "$max-sm": { width: 44, height: 44 }, rounded: 999, items: "center", justify: "center", bg: "transparent", borderWidth: 0, cursor: "pointer", transition: "quickest", hoverStyle: { bg: PICKED }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: 'solid', outlineColor: 'var(--ring)' }, children: _jsx(Camera, { size: 13, color: DIM, "aria-hidden": true }) }), _jsx(XStack, { render: "button", type: 'button', "aria-label": t('Reconnect stream'), onClick: () => {
|
|
386
409
|
setSnapDataUrl(null);
|
|
387
410
|
void openStream(activeBox.id, mode, control === 'watching');
|
|
388
|
-
}, width:
|
|
411
|
+
}, width: 28, height: 28, "$max-sm": { width: 44, height: 44 }, rounded: 999, items: "center", justify: "center", bg: "transparent", borderWidth: 0, cursor: "pointer", transition: "quickest", hoverStyle: { bg: PICKED }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: 'solid', outlineColor: 'var(--ring)' }, children: _jsx(RefreshCw, { size: 13, color: DIM, "aria-hidden": true }) }), frameUrl ? (_jsx(XStack, { render: "button", type: 'button', "aria-label": t('Open stream in new tab'), onClick: () => window.open(frameUrl, '_blank', 'noopener,noreferrer'), width: 28, height: 28, "$max-sm": { width: 44, height: 44 }, rounded: 999, items: "center", justify: "center", bg: "transparent", borderWidth: 0, cursor: "pointer", transition: "quickest", hoverStyle: { bg: PICKED }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: 'solid', outlineColor: 'var(--ring)' }, children: _jsx(ExternalLink, { size: 13, color: DIM, "aria-hidden": true }) })) : null, _jsxs(XStack, { render: "button", type: 'button', "aria-label": t('Park desktop'), disabled: busy, onClick: () => void handlePark(), height: 28, "$max-sm": { minH: 44 }, px: 10, gap: 4, rounded: 999, items: "center", bg: RAISED, borderWidth: 1, borderColor: EDGE, cursor: "pointer", transition: "quickest", hoverStyle: { bg: PICKED }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: 'solid', outlineColor: 'var(--ring)' }, children: [_jsx(Pause, { size: 11, color: INK, "aria-hidden": true }), _jsx(Text, { fontSize: 11, lineHeight: 15, color: INK, children: t('Park') })] })] })) : null, _jsx(XStack, { render: "button", type: 'button', "aria-label": expanded ? t('Collapse window') : t('Expand window'), onClick: () => setExpanded((v) => !v), width: 28, height: 28, "$max-sm": { display: 'none' }, rounded: 999, items: "center", justify: "center", bg: "transparent", borderWidth: 0, cursor: "pointer", transition: "quickest", hoverStyle: { bg: PICKED }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: 'solid', outlineColor: 'var(--ring)' }, children: expanded ? (_jsx(Minimize2, { size: 14, color: DIM, "aria-hidden": true })) : (_jsx(Maximize2, { size: 14, color: DIM, "aria-hidden": true })) }), _jsx(XStack, { ...ROUND, width: 30, height: 30, borderColor: EDGE, focusVisibleStyle: { outlineWidth: 2, outlineStyle: 'solid', outlineColor: 'var(--ring)' }, "$max-sm": { width: 44, height: 44 }, "aria-label": t('Close computer window'), onClick: () => onOpenChange(false), children: _jsx(X, { size: 15, color: INK, "aria-hidden": true }) })] })] }), _jsx(YStack, { flex: 1, minH: 0, px: 10, pt: 10, pb: showBottomBar ? 0 : 12, items: "center", justify: "center", children: phase === 'starting' && !frameUrl ? (_jsx(YStack, { flex: 1, width: "100%", items: "center", justify: "center", children: _jsx(PulsingCluster, { label: t('Starting desktop') }) })) : phase === 'parked' || (!awake && !busy && !frameUrl) ? (_jsxs(YStack, { flex: 1, width: "100%", rounded: 12, borderWidth: 1, borderColor: LINE, bg: FLOOR, items: "center", justify: "center", gap: 14, px: 24, children: [_jsx(Text, { fontSize: "$3", lineHeight: 22, fontWeight: "600", color: INK, text: "center", children: phase === 'parked' ? t('Desktop is paused') : t('{name}’s cloud desktop', { name: displayName }) }), _jsx(Text, { fontSize: "$2", lineHeight: 19, maxW: 440, color: DIM, text: "center", children: devMode
|
|
412
|
+
? t('Persistent home volume preserves open files, browser sessions, and tools across sleep/wake cycles.')
|
|
413
|
+
: t('Keeps open files, browser tabs, and logins ready whenever you resume.') }), error ? (_jsx(Text, { role: "alert", fontSize: 12, lineHeight: 17, color: "var(--state-error)", text: "center", children: error })) : null, _jsxs(XStack, { ...PILL, bg: INK, borderColor: INK, hoverStyle: { opacity: 0.9 }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: 'solid', outlineColor: 'var(--ring)' }, "$max-sm": { minH: 44 }, disabled: busy, onClick: () => void startOrResume(true), children: [_jsx(Play, { size: 13, color: "var(--background)", "aria-hidden": true }), _jsx(Text, { ...WORD, color: "var(--background)", children: phase === 'parked' ? t('Resume desktop') : t('Start desktop') })] })] })) : (_jsx(YStack, { flex: 1, width: "100%", rounded: 10, borderWidth: 1, borderColor: LINE, bg: FLOOR, overflow: "hidden", position: "relative", items: "center", justify: "center", children: snapDataUrl ? (_jsxs(YStack, { width: "100%", height: "100%", items: "center", justify: "center", position: "relative", children: [_jsx(YStack, { render: "img", src: snapDataUrl, alt: `${displayName} desktop screenshot`, maxW: "100%", maxH: "100%", objectFit: "contain" }), _jsx(XStack, { position: "absolute", t: 12, r: 12, children: _jsx(XStack, { ...PILL, height: 30, "$max-sm": { minH: 44 }, px: 12, bg: RAISED, borderColor: EDGE, focusVisibleStyle: { outlineWidth: 2, outlineStyle: 'solid', outlineColor: 'var(--ring)' }, onClick: () => setSnapDataUrl(null), children: _jsx(Text, { fontSize: 12, lineHeight: 16, color: INK, children: t('Back to live desktop') }) }) })] })) : frameUrl ? (_jsx(YStack, { ref: iframeRef, render: "iframe", src: frameUrl,
|
|
389
414
|
title: `${displayName} desktop ${mode}`,
|
|
390
|
-
allow: 'clipboard-read; clipboard-write; fullscreen', width: "100%", height: "100%", borderWidth: 0 })) : (_jsx(PulsingCluster, { label: t('Connecting') })) })) }), promptOpen && awake ? (_jsx(YStack, { px:
|
|
415
|
+
allow: 'clipboard-read; clipboard-write; fullscreen', width: "100%", height: "100%", borderWidth: 0 })) : (_jsx(PulsingCluster, { label: t('Connecting') })) })) }), promptOpen && awake ? (_jsx(YStack, { px: 14, "$max-sm": { px: 10 }, pt: 10, gap: 8, children: _jsxs(XStack, { render: "form", onSubmit: (e) => void submitComputerTask(e), gap: 8, items: "center", flexWrap: "wrap", children: [_jsx(Input, { unstyled: true, autoFocus: true, value: task, onChange: (e) => setTask(e.target.value), placeholder: devMode
|
|
416
|
+
? t('Tell {name} what to do on this desktop (e.g., "Log in with my GitHub vault credentials and review open PRs")…', { name: displayName })
|
|
417
|
+
: t('Tell {name} what to do on this desktop…', { name: displayName }), "aria-label": t('Co-work with {name} on desktop', { name: displayName }), flex: 1, minW: 180, height: 36, "$max-sm": { minH: 44 }, px: 14, rounded: 999, bg: RAISED, borderWidth: 1, borderColor: EDGE, focusStyle: { borderColor: 'var(--ring)' }, color: INK, fontSize: 13, placeholderTextColor: "$placeholderColor" }), _jsxs(XStack, { ...PILL, type: 'submit', height: 36, "$max-sm": { minH: 44 }, px: 14, bg: INK, borderColor: INK, hoverStyle: { opacity: 0.9 }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: 'solid', outlineColor: 'var(--ring)' }, disabled: !task.trim() || runningTask, opacity: !task.trim() || runningTask ? 0.5 : 1, children: [_jsx(Send, { size: 12, color: "var(--background)", "aria-hidden": true }), _jsx(Text, { ...WORD, fontSize: 12, color: "var(--background)", children: runningTask ? t('Working…') : t('Run on desktop') })] })] }) })) : null, showBottomBar ? (_jsxs(XStack, { minH: 58, px: 14, py: 8, "$max-sm": { px: 10, gap: 8, justify: 'center' }, items: "center", justify: "space-between", flexWrap: "wrap", gap: 10, shrink: 0, children: [_jsx(XStack, { flex: 1, items: "center", gap: 8, minW: 0, "$max-sm": { display: error || statusToast ? 'flex' : 'none', width: '100%', justify: 'center' }, children: error ? (_jsx(Text, { ...CLIP, role: "alert", fontSize: 12, lineHeight: 16, color: "var(--state-error)", children: error })) : statusToast ? (_jsx(Text, { ...CLIP, fontSize: 12, lineHeight: 16, color: DIM, children: statusToast })) : null }), _jsxs(XStack, { "data-parity-key": "bots.computer.control-pill", height: 38, "$max-sm": { minH: 44 }, pl: 14, pr: 5, gap: 12, rounded: 999, items: "center", bg: RAISED, borderWidth: 1, borderColor: EDGE, children: [_jsxs(XStack, { items: "center", gap: 7, children: [control === 'watching' ? (_jsx(Eye, { size: 14, color: DIM, "aria-hidden": true })) : (_jsx(MousePointerClick, { size: 14, color: "var(--state-online)", "aria-hidden": true })), _jsx(Text, { fontSize: 13, lineHeight: 18, fontWeight: "500", color: INK, children: control === 'watching' ? t('Watching') : t('In control') })] }), control === 'watching' ? (_jsx(XStack, { render: "button", type: 'button', onClick: () => toggleControl('controlling'), height: 28, "$max-sm": { minH: 36 }, px: 13, rounded: 999, items: "center", justify: "center", bg: INK, borderWidth: 0, cursor: "pointer", transition: "quickest", hoverStyle: { opacity: 0.9 }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: 'solid', outlineColor: 'var(--ring)' }, children: _jsx(Text, { fontSize: 12, lineHeight: 16, fontWeight: "600", color: "var(--background)", children: t('Take control') }) })) : (_jsx(XStack, { render: "button", type: 'button', onClick: () => toggleControl('watching'), height: 28, "$max-sm": { minH: 36 }, px: 13, rounded: 999, items: "center", justify: "center", bg: PICKED, borderWidth: 1, borderColor: EDGE, cursor: "pointer", transition: "quickest", hoverStyle: { bg: GROUND }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: 'solid', outlineColor: 'var(--ring)' }, children: _jsx(Text, { fontSize: 12, lineHeight: 16, fontWeight: "500", color: INK, children: t('Watch only') }) }))] }), _jsx(XStack, { flex: 1, items: "center", justify: "flex-end", gap: 8, "$max-sm": { flex: 0, justify: 'center' }, children: awake ? (_jsxs(XStack, { render: "button", type: 'button', onClick: () => setPromptOpen((v) => !v), height: 30, "$max-sm": { minH: 44 }, px: 11, gap: 6, rounded: 999, items: "center", bg: promptOpen ? PICKED : 'transparent', borderWidth: 1, borderColor: promptOpen ? EDGE : 'transparent', cursor: "pointer", transition: "quickest", hoverStyle: { bg: RAISED, borderColor: EDGE }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: 'solid', outlineColor: 'var(--ring)' }, children: [_jsx(Sparkles, { size: 12, color: DIM, "aria-hidden": true }), _jsx(Text, { fontSize: 12, lineHeight: 16, color: INK, children: runningTask ? t('{name} working…', { name: displayName }) : t('Work with {name}', { name: displayName }) })] })) : null })] })) : null] }) }) }), _jsx(VaultDialog, { open: vaultOpen, onOpenChange: (next) => {
|
|
391
418
|
setVaultOpen(next);
|
|
392
419
|
if (!next)
|
|
393
420
|
void refreshVault();
|