@hanzo/app 0.3.87 → 0.3.89
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.js +6 -1
- package/dist/bots/ComputerDialog.js +233 -72
- package/dist/bots/ConnectorsDialog.js +1 -1
- package/dist/bots/Groups.js +6 -4
- package/dist/bots/Panel.js +228 -41
- package/dist/bots/api.d.ts +74 -4
- package/dist/bots/api.js +196 -5
- package/dist/bots/face.d.ts +1 -0
- package/dist/bots/face.js +25 -2
- package/dist/cast.js +4 -3
- package/dist/vault.d.ts +60 -0
- package/dist/vault.js +514 -0
- package/package.json +1 -1
package/dist/Account.js
CHANGED
|
@@ -130,7 +130,12 @@ function usePlan(org, enabled) {
|
|
|
130
130
|
/** The person's picture, or their initials. */
|
|
131
131
|
export function Face({ host, size = 28 }) {
|
|
132
132
|
const p = host.person;
|
|
133
|
-
|
|
133
|
+
const cleanSrc = p?.avatar && !(p.avatar.includes('gravatar.com/avatar/') && p.avatar.includes('d=identicon')) ? p.avatar : undefined;
|
|
134
|
+
const [failed, setFailed] = useState(false);
|
|
135
|
+
useEffect(() => {
|
|
136
|
+
setFailed(false);
|
|
137
|
+
}, [cleanSrc]);
|
|
138
|
+
return (_jsx(XStack, { width: size, height: size, rounded: 9999, items: "center", justify: "center", bg: "$raised", overflow: "hidden", shrink: 0, borderWidth: 1, borderColor: "$borderColor", children: cleanSrc && !failed ? (_jsx("img", { src: cleanSrc, alt: "", width: size, height: size, onError: () => setFailed(true) })) : (_jsx(SizableText, { fontSize: Math.max(10, Math.round(size * 0.39)), lineHeight: size, fontWeight: "600", color: "$ink", children: initials(p?.name || p?.email || '') })) }));
|
|
134
139
|
}
|
|
135
140
|
/** A row's face: its icon in a 20px well, its words, and what trails them. */
|
|
136
141
|
function Line({ icon, children, sub, trail }) {
|
|
@@ -1,82 +1,216 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
//
|
|
4
|
-
// -
|
|
5
|
-
// -
|
|
6
|
-
// -
|
|
7
|
-
//
|
|
8
|
-
|
|
3
|
+
// Sleek, resumable macOS-framed Desktop Sandbox Computer modal for every bot on hanzo.bot:
|
|
4
|
+
// - Auto-boots or resumes persistent per-bot desktop sandbox (`Starting desktop` -> `Connecting` -> live 60fps X11/noVNC stream)
|
|
5
|
+
// - Floating bottom-center pill: `👁 Watching` | `[Take control]` (instant live toggle via postMessage to screen/page.html)
|
|
6
|
+
// - Native Desktop GUI + Interactive Terminal modes, Clipboard paste, Screenshot, Park/Sleep & instant Resume
|
|
7
|
+
// - Zero-knowledge 1-click Login & 2FA TOTP Autofill (`action: 'autofill'`) from Unified Vault (Hanzo KMS, 1Password, LastPass)
|
|
8
|
+
// - Co-working prompt drawer so you can watch the bot click, browse, log in, and work in real time or jump in yourself.
|
|
9
|
+
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
9
10
|
import { useI18n } from '@hanzo/i18n/react';
|
|
10
11
|
import { Input, Text, XStack, YStack } from '@hanzo/gui';
|
|
11
|
-
import { Dialog, DialogContent, DialogTitle } from '@hanzo/ui';
|
|
12
|
-
import { Camera, ExternalLink, Monitor, Pause, Play, RefreshCw, Send, Terminal,
|
|
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
14
|
import { useAi } from '../lib/ai.js';
|
|
14
15
|
import { say } from '../failure.js';
|
|
15
16
|
import { called } from '../team.js';
|
|
16
|
-
import {
|
|
17
|
-
import { actComputer, disk, grant, parkComputer, updateBotMeta } from './api.js';
|
|
18
|
-
import { CLIP, PILL,
|
|
19
|
-
import { DIM, FLOOR,
|
|
17
|
+
import { VaultDialog, readVault } from '../vault.js';
|
|
18
|
+
import { actComputer, bootOrResumeComputer, disk, findBotComputer, grant, parkComputer, updateBotMeta, } from './api.js';
|
|
19
|
+
import { CLIP, PILL, WORD } from './kit.js';
|
|
20
|
+
import { DIM, FLOOR, INK, LINE, PICKED, RAISED } from './ink.js';
|
|
21
|
+
function PulsingCluster({ label }) {
|
|
22
|
+
const [step, setStep] = useState(0);
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
const id = window.setInterval(() => setStep((s) => (s + 1) % 3), 480);
|
|
25
|
+
return () => window.clearInterval(id);
|
|
26
|
+
}, []);
|
|
27
|
+
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) => {
|
|
28
|
+
const active = step === i;
|
|
29
|
+
const mid = i === 1;
|
|
30
|
+
return (_jsx(YStack, { width: mid ? 7 : 4, height: mid ? 7 : 4, rounded: 999, bg: "var(--pure-white)", opacity: active ? 1 : 0.35 }, i));
|
|
31
|
+
}) }), _jsx(Text, { fontSize: 13, lineHeight: 18, fontWeight: "500", color: "var(--pure-white)", opacity: 0.58, children: label })] }));
|
|
32
|
+
}
|
|
33
|
+
function appendViewParam(rawUrl, viewOnly) {
|
|
34
|
+
try {
|
|
35
|
+
const u = new URL(rawUrl, typeof window !== 'undefined' ? window.location.origin : 'https://api.hanzo.ai');
|
|
36
|
+
u.searchParams.set('viewOnly', viewOnly ? '1' : '0');
|
|
37
|
+
return u.toString();
|
|
38
|
+
}
|
|
39
|
+
catch {
|
|
40
|
+
const join = rawUrl.includes('?') ? '&' : '?';
|
|
41
|
+
return `${rawUrl}${join}viewOnly=${viewOnly ? '1' : '0'}`;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
20
44
|
export function ComputerDialog({ open, onOpenChange, bot, box, onUpdated, }) {
|
|
21
45
|
const { t } = useI18n();
|
|
22
46
|
const { client } = useAi();
|
|
23
47
|
const displayName = called(bot.name);
|
|
48
|
+
const iframeRef = useRef(null);
|
|
49
|
+
const autoBootedRef = useRef(false);
|
|
50
|
+
const [localBox, setLocalBox] = useState(box);
|
|
51
|
+
const [expanded, setExpanded] = useState(false);
|
|
24
52
|
const [mode, setMode] = useState('screen');
|
|
53
|
+
const [control, setControl] = useState('watching');
|
|
54
|
+
const [phase, setPhase] = useState('idle');
|
|
25
55
|
const [frameUrl, setFrameUrl] = useState(null);
|
|
26
56
|
const [snapDataUrl, setSnapDataUrl] = useState(null);
|
|
27
57
|
const [busy, setBusy] = useState(false);
|
|
58
|
+
const [promptOpen, setPromptOpen] = useState(false);
|
|
28
59
|
const [task, setTask] = useState('');
|
|
29
60
|
const [runningTask, setRunningTask] = useState(false);
|
|
30
|
-
const [
|
|
61
|
+
const [statusToast, setStatusToast] = useState(null);
|
|
31
62
|
const [error, setError] = useState(null);
|
|
32
|
-
const
|
|
33
|
-
const
|
|
34
|
-
|
|
63
|
+
const [vaultOpen, setVaultOpen] = useState(false);
|
|
64
|
+
const [vaultItems, setVaultItems] = useState([]);
|
|
65
|
+
useEffect(() => {
|
|
66
|
+
if (box)
|
|
67
|
+
setLocalBox(box);
|
|
68
|
+
}, [box]);
|
|
69
|
+
const activeBox = localBox ?? box;
|
|
70
|
+
const awake = activeBox?.status === 'running';
|
|
71
|
+
const refreshVault = useCallback(async () => {
|
|
72
|
+
const doc = await readVault();
|
|
73
|
+
setVaultItems(doc.items);
|
|
74
|
+
}, []);
|
|
75
|
+
useEffect(() => {
|
|
76
|
+
if (open)
|
|
77
|
+
void refreshVault();
|
|
78
|
+
}, [open, refreshVault]);
|
|
79
|
+
// Listen for live state handshakes from `apps/sandbox/screen/page.html`
|
|
80
|
+
useEffect(() => {
|
|
81
|
+
if (!open)
|
|
82
|
+
return;
|
|
83
|
+
const onMessage = (ev) => {
|
|
84
|
+
const data = ev.data;
|
|
85
|
+
if (!data || data.type !== 'hanzo-screen-state')
|
|
86
|
+
return;
|
|
87
|
+
if (data.state === 'connected') {
|
|
88
|
+
setPhase('live');
|
|
89
|
+
}
|
|
90
|
+
else if (data.state === 'connecting') {
|
|
91
|
+
setPhase((prev) => (prev === 'live' ? 'live' : 'connecting'));
|
|
92
|
+
}
|
|
93
|
+
if (typeof data.viewOnly === 'boolean') {
|
|
94
|
+
setControl(data.viewOnly ? 'watching' : 'controlling');
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
window.addEventListener('message', onMessage);
|
|
98
|
+
return () => window.removeEventListener('message', onMessage);
|
|
99
|
+
}, [open]);
|
|
100
|
+
const openStream = useCallback(async (targetId, kind, wantViewOnly) => {
|
|
35
101
|
if (!client)
|
|
36
102
|
return;
|
|
37
103
|
setError(null);
|
|
104
|
+
setPhase('connecting');
|
|
38
105
|
try {
|
|
39
106
|
const g = await grant(client, targetId, kind);
|
|
40
107
|
if (g.url) {
|
|
41
|
-
|
|
108
|
+
const finalUrl = kind === 'screen' ? appendViewParam(g.url, wantViewOnly) : g.url;
|
|
109
|
+
setFrameUrl(finalUrl);
|
|
110
|
+
// Terminal or older edge screen page without postMessage transitions smoothly after load
|
|
111
|
+
window.setTimeout(() => {
|
|
112
|
+
setPhase((cur) => (cur === 'connecting' ? 'live' : cur));
|
|
113
|
+
}, 1600);
|
|
42
114
|
}
|
|
43
115
|
else {
|
|
44
116
|
setError(t('Desktop stream ticket was minted without a stream URL.'));
|
|
117
|
+
setPhase('idle');
|
|
45
118
|
}
|
|
46
119
|
}
|
|
47
120
|
catch (e) {
|
|
48
121
|
setError(say(e, t('{name}’s desktop stream', { name: displayName }), 'read', t));
|
|
122
|
+
setPhase('idle');
|
|
49
123
|
}
|
|
50
124
|
}, [client, displayName, t]);
|
|
125
|
+
const startOrResume = useCallback(async (manual = false) => {
|
|
126
|
+
if (!client || busy)
|
|
127
|
+
return;
|
|
128
|
+
setBusy(true);
|
|
129
|
+
setError(null);
|
|
130
|
+
setSnapDataUrl(null);
|
|
131
|
+
setPhase('starting');
|
|
132
|
+
try {
|
|
133
|
+
const leased = await bootOrResumeComputer(client, bot, activeBox);
|
|
134
|
+
setLocalBox(leased);
|
|
135
|
+
await onUpdated();
|
|
136
|
+
if (leased.status === 'running') {
|
|
137
|
+
const effectiveMode = leased.class === 'desktop' ? mode : 'terminal';
|
|
138
|
+
await openStream(leased.id, effectiveMode, control === 'watching');
|
|
139
|
+
}
|
|
140
|
+
else {
|
|
141
|
+
// Poll up to ~25s while the sandbox container schedules & boots X11
|
|
142
|
+
for (let attempt = 0; attempt < 12; attempt++) {
|
|
143
|
+
await new Promise((r) => window.setTimeout(r, 2000));
|
|
144
|
+
const latest = await findBotComputer(client, { ...bot, computeRef: leased.id });
|
|
145
|
+
if (latest)
|
|
146
|
+
setLocalBox(latest);
|
|
147
|
+
if (latest?.status === 'running') {
|
|
148
|
+
await onUpdated();
|
|
149
|
+
await openStream(latest.id, latest.class === 'desktop' ? mode : 'terminal', control === 'watching');
|
|
150
|
+
break;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
if (manual) {
|
|
155
|
+
setStatusToast(t('Desktop ready.'));
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
catch (e) {
|
|
159
|
+
setError(say(e, t('{name}’s desktop computer', { name: displayName }), 'save', t));
|
|
160
|
+
setPhase('idle');
|
|
161
|
+
}
|
|
162
|
+
finally {
|
|
163
|
+
setBusy(false);
|
|
164
|
+
}
|
|
165
|
+
}, [client, busy, bot, activeBox, onUpdated, mode, openStream, control, displayName, t]);
|
|
166
|
+
// Auto-open live stream if running, or auto-boot/resume on open!
|
|
51
167
|
useEffect(() => {
|
|
52
168
|
if (!open) {
|
|
169
|
+
autoBootedRef.current = false;
|
|
53
170
|
setFrameUrl(null);
|
|
54
171
|
setSnapDataUrl(null);
|
|
55
172
|
setError(null);
|
|
173
|
+
setStatusToast(null);
|
|
174
|
+
setControl('watching');
|
|
175
|
+
setPhase('idle');
|
|
56
176
|
return;
|
|
57
177
|
}
|
|
58
|
-
if (
|
|
59
|
-
|
|
60
|
-
|
|
178
|
+
if (activeBox?.id && activeBox.status === 'running') {
|
|
179
|
+
autoBootedRef.current = true;
|
|
180
|
+
const effectiveMode = activeBox.class === 'desktop' ? mode : 'terminal';
|
|
181
|
+
void openStream(activeBox.id, effectiveMode, control === 'watching');
|
|
182
|
+
return;
|
|
61
183
|
}
|
|
62
|
-
|
|
63
|
-
|
|
184
|
+
if (!autoBootedRef.current && client) {
|
|
185
|
+
autoBootedRef.current = true;
|
|
186
|
+
void startOrResume(false);
|
|
64
187
|
}
|
|
65
|
-
}, [open,
|
|
66
|
-
const
|
|
67
|
-
|
|
188
|
+
}, [open, activeBox?.id, activeBox?.status, activeBox?.class, mode, client, openStream, startOrResume, control]);
|
|
189
|
+
const toggleControl = (nextControl) => {
|
|
190
|
+
setControl(nextControl);
|
|
191
|
+
const viewOnly = nextControl === 'watching';
|
|
192
|
+
try {
|
|
193
|
+
iframeRef.current?.contentWindow?.postMessage({ type: 'hanzo-screen-control', viewOnly }, '*');
|
|
194
|
+
if (!viewOnly) {
|
|
195
|
+
iframeRef.current?.focus();
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
catch {
|
|
199
|
+
// ignore cross-frame focus errors
|
|
200
|
+
}
|
|
201
|
+
};
|
|
202
|
+
const handlePark = async () => {
|
|
203
|
+
if (!client || !activeBox?.id || busy)
|
|
68
204
|
return;
|
|
69
205
|
setBusy(true);
|
|
70
206
|
setError(null);
|
|
71
207
|
try {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
208
|
+
await parkComputer(client, activeBox.id);
|
|
209
|
+
setFrameUrl(null);
|
|
210
|
+
setLocalBox((prev) => (prev ? { ...prev, status: 'stopped' } : null));
|
|
211
|
+
setPhase('parked');
|
|
212
|
+
setStatusToast(t('Desktop parked — workspace disk is preserved and resumes instantly.'));
|
|
76
213
|
await onUpdated();
|
|
77
|
-
if (leased?.id && leased.status === 'running') {
|
|
78
|
-
await openStream(leased.id, 'screen');
|
|
79
|
-
}
|
|
80
214
|
}
|
|
81
215
|
catch (e) {
|
|
82
216
|
setError(say(e, t('{name}’s desktop computer', { name: displayName }), 'save', t));
|
|
@@ -85,33 +219,56 @@ export function ComputerDialog({ open, onOpenChange, bot, box, onUpdated, }) {
|
|
|
85
219
|
setBusy(false);
|
|
86
220
|
}
|
|
87
221
|
};
|
|
88
|
-
const
|
|
89
|
-
|
|
222
|
+
const pasteClipboardToDesktop = async () => {
|
|
223
|
+
try {
|
|
224
|
+
const text = await navigator.clipboard.readText();
|
|
225
|
+
if (!text)
|
|
226
|
+
return;
|
|
227
|
+
iframeRef.current?.contentWindow?.postMessage({ type: 'hanzo-screen-clipboard', text }, '*');
|
|
228
|
+
if (client && activeBox?.id) {
|
|
229
|
+
await actComputer(client, { id: activeBox.id, action: 'type', text });
|
|
230
|
+
}
|
|
231
|
+
setStatusToast(t('Pasted clipboard to desktop.'));
|
|
232
|
+
}
|
|
233
|
+
catch {
|
|
234
|
+
setError(t('Grant browser clipboard permission or take control to paste directly.'));
|
|
235
|
+
}
|
|
236
|
+
};
|
|
237
|
+
const runAutofill = async (item, field) => {
|
|
238
|
+
if (!client || !activeBox?.id || runningTask)
|
|
90
239
|
return;
|
|
91
|
-
|
|
240
|
+
setRunningTask(true);
|
|
92
241
|
setError(null);
|
|
242
|
+
setStatusToast(null);
|
|
93
243
|
try {
|
|
94
|
-
await
|
|
95
|
-
|
|
96
|
-
|
|
244
|
+
await actComputer(client, {
|
|
245
|
+
id: activeBox.id,
|
|
246
|
+
action: 'autofill',
|
|
247
|
+
credential: item.id || item.domain || item.name,
|
|
248
|
+
field,
|
|
249
|
+
submit: field === 'login' || field === 'totp',
|
|
250
|
+
});
|
|
251
|
+
setStatusToast(field === 'totp'
|
|
252
|
+
? t('Typed 6-digit 2FA code for {name} via KMS.', { name: item.name })
|
|
253
|
+
: t('Autofilled {name} via zero-knowledge KMS.', { name: item.name }));
|
|
97
254
|
}
|
|
98
255
|
catch (e) {
|
|
99
|
-
setError(say(e, t('
|
|
256
|
+
setError(say(e, t('credential autofill'), 'save', t));
|
|
100
257
|
}
|
|
101
258
|
finally {
|
|
102
|
-
|
|
259
|
+
setRunningTask(false);
|
|
103
260
|
}
|
|
104
261
|
};
|
|
105
262
|
const captureScreenshot = async () => {
|
|
106
|
-
if (!client || !
|
|
263
|
+
if (!client || !activeBox?.id || runningTask)
|
|
107
264
|
return;
|
|
108
265
|
setRunningTask(true);
|
|
109
266
|
setError(null);
|
|
110
267
|
try {
|
|
111
|
-
const out = await actComputer(client, { id:
|
|
268
|
+
const out = await actComputer(client, { id: activeBox.id, action: 'screenshot' });
|
|
112
269
|
if (out.image) {
|
|
113
270
|
setSnapDataUrl(`data:${out.mimeType || 'image/png'};base64,${out.image}`);
|
|
114
|
-
|
|
271
|
+
setStatusToast(t('Captured {w}×{h} frame.', { w: out.width || 1280, h: out.height || 800 }));
|
|
115
272
|
}
|
|
116
273
|
}
|
|
117
274
|
catch (e) {
|
|
@@ -128,17 +285,19 @@ export function ComputerDialog({ open, onOpenChange, bot, box, onUpdated, }) {
|
|
|
128
285
|
return;
|
|
129
286
|
setRunningTask(true);
|
|
130
287
|
setError(null);
|
|
131
|
-
|
|
288
|
+
setStatusToast(null);
|
|
132
289
|
if (!preset)
|
|
133
290
|
setTask('');
|
|
291
|
+
// Automatically switch to Watching mode so the user sees the bot move the cursor live
|
|
292
|
+
if (control === 'controlling')
|
|
293
|
+
toggleControl('watching');
|
|
134
294
|
try {
|
|
135
|
-
// Ensure the bot has full tool access so `computer_in_sandbox` is active on the run.
|
|
136
295
|
if (!bot.tools?.length) {
|
|
137
|
-
await updateBotMeta(client, bot.name, { tools: ['*'], computeRef:
|
|
296
|
+
await updateBotMeta(client, bot.name, { tools: ['*'], computeRef: activeBox?.id || bot.computeRef }).catch(() => null);
|
|
138
297
|
}
|
|
139
|
-
const directive = `[Desktop Computer Use] Use your desktop sandbox computer (computer_in_sandbox — screenshot, click, move, drag, type, key, scroll, navigate, shell) to complete this task
|
|
298
|
+
const directive = `[Desktop Computer Use] Use your resumable desktop sandbox computer (computer_in_sandbox — screenshot, click, move, drag, type, key, scroll, navigate, autofill for KMS/1Password/LastPass logins, and shell) to complete this task while I watch live:\n\n${prompt}`;
|
|
140
299
|
const ran = await client.agents.run(bot.name, directive);
|
|
141
|
-
|
|
300
|
+
setStatusToast(ran.output || ran.error || t('Task completed on desktop computer.'));
|
|
142
301
|
await onUpdated();
|
|
143
302
|
}
|
|
144
303
|
catch (err) {
|
|
@@ -148,28 +307,30 @@ export function ComputerDialog({ open, onOpenChange, bot, box, onUpdated, }) {
|
|
|
148
307
|
setRunningTask(false);
|
|
149
308
|
}
|
|
150
309
|
};
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
{ label: t('
|
|
173
|
-
|
|
174
|
-
|
|
310
|
+
const logins = vaultItems.filter((i) => i.kind === 'login');
|
|
311
|
+
const otherSecrets = vaultItems.filter((i) => i.kind !== 'login');
|
|
312
|
+
const showBottomBar = phase === 'connecting' || phase === 'live' || awake;
|
|
313
|
+
return (_jsxs(_Fragment, { children: [_jsx(Dialog, { open: open, onOpenChange: onOpenChange, children: _jsx(DialogContent, { "data-parity-key": "bots.computer.dialog", width: expanded ? '98vw' : '95vw', maxW: expanded ? 1480 : 1140, p: 0, showCloseButton: false, bg: "var(--pure-black)", borderWidth: 1, borderColor: LINE, rounded: 18, overflow: "hidden", children: _jsxs(YStack, { height: expanded ? '94vh' : '86vh', maxH: "95vh", bg: "var(--pure-black)", children: [_jsxs(XStack, { height: 44, px: 16, items: "center", justify: "space-between", gap: 12, shrink: 0, children: [_jsxs(XStack, { items: "center", gap: 12, minW: 0, children: [_jsxs(XStack, { items: "center", gap: 8, shrink: 0, children: [_jsx(YStack, { render: "button", type: 'button', "aria-label": t('Close computer window'), onClick: () => onOpenChange(false), width: 12, height: 12, rounded: 999, bg: "var(--chrome-dot-red)", borderWidth: 0, p: 0, cursor: "pointer" }), _jsx(YStack, { render: "button", type: 'button', "aria-label": t('Park desktop computer'), onClick: () => (awake ? void handlePark() : onOpenChange(false)), width: 12, height: 12, rounded: 999, bg: "var(--chrome-dot-yellow)", borderWidth: 0, p: 0, cursor: "pointer" }), _jsx(YStack, { render: "button", type: 'button', "aria-label": expanded ? t('Exit fullscreen size') : t('Expand computer window'), onClick: () => setExpanded((v) => !v), width: 12, height: 12, rounded: 999, bg: "var(--chrome-dot-green)", borderWidth: 0, p: 0, cursor: "pointer" })] }), _jsx(DialogTitle, { children: _jsx(Text, { ...CLIP, fontSize: 12, lineHeight: 16, fontWeight: "500", color: "var(--pure-white)", opacity: 0.55, children: awake
|
|
314
|
+
? `${displayName} · ${activeBox?.id ?? disk(bot.name)}`
|
|
315
|
+
: phase === 'parked'
|
|
316
|
+
? `${displayName} · ${t('Parked (resumable)')}`
|
|
317
|
+
: `${displayName} · ${t('Desktop')}` }) })] }), _jsxs(XStack, { items: "center", gap: 6, children: [awake && activeBox?.id ? (_jsxs(_Fragment, { children: [_jsxs(XStack, { render: "button", type: 'button', "aria-label": mode === 'screen' ? t('Switch to Terminal') : t('Switch to Desktop GUI'), onClick: () => {
|
|
318
|
+
setSnapDataUrl(null);
|
|
319
|
+
setMode((m) => (m === 'screen' ? 'terminal' : 'screen'));
|
|
320
|
+
}, height: 26, px: 9, gap: 5, rounded: 999, items: "center", bg: RAISED, borderWidth: 1, borderColor: LINE, cursor: "pointer", children: [mode === 'screen' ? (_jsx(Terminal, { size: 12, color: "var(--pure-white)", "aria-hidden": true })) : (_jsx(Monitor, { size: 12, color: "var(--pure-white)", "aria-hidden": true })), _jsx(Text, { fontSize: 11, lineHeight: 15, color: "var(--pure-white)", opacity: 0.85, children: mode === 'screen' ? t('Terminal') : t('Desktop') })] }), _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: 26, px: 9, gap: 5, rounded: 999, items: "center", bg: RAISED, borderWidth: 1, borderColor: LINE, cursor: "pointer", children: [_jsx(KeyRound, { size: 12, color: "var(--pure-white)", "aria-hidden": true }), _jsx(Text, { fontSize: 11, lineHeight: 15, color: "var(--pure-white)", opacity: 0.85, children: t('Autofill') })] }) }), _jsxs(DropdownMenuContent, { minW: 240, children: [logins.map((item) => (_jsx(DropdownMenuItem, { onSelect: () => void runAutofill(item, '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
|
|
321
|
+
? t('Fill {user} + password via {src}', { user: item.username, src: item.source })
|
|
322
|
+
: t('Fill password via {src}', { src: item.source }) })] }) }, item.id))), logins
|
|
323
|
+
.filter((i) => Boolean(i.totpSecretKey))
|
|
324
|
+
.map((item) => (_jsx(DropdownMenuItem, { onSelect: () => void runAutofill(item, 'totp'), children: _jsx(Text, { fontSize: "$2", color: "$ink", children: t('2FA TOTP code · {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: () => setVaultOpen(true), children: _jsx(Text, { fontSize: "$2", fontWeight: "600", color: "$ink", children: vaultItems.length === 0
|
|
325
|
+
? t('+ Add 1Password, LastPass, or KMS logins…')
|
|
326
|
+
: t('Manage Vault & Password Managers…') }) })] })] }), _jsx(XStack, { render: "button", type: 'button', "aria-label": t('Paste clipboard to desktop'), onClick: () => void pasteClipboardToDesktop(), width: 26, height: 26, rounded: 999, items: "center", justify: "center", bg: "transparent", borderWidth: 0, cursor: "pointer", hoverStyle: { bg: RAISED }, children: _jsx(ClipboardPaste, { size: 13, color: "var(--pure-white)", opacity: 0.7, "aria-hidden": true }) }), _jsx(XStack, { render: "button", type: 'button', "aria-label": t('Capture screenshot'), onClick: () => void captureScreenshot(), width: 26, height: 26, rounded: 999, items: "center", justify: "center", bg: "transparent", borderWidth: 0, cursor: "pointer", hoverStyle: { bg: RAISED }, children: _jsx(Camera, { size: 13, color: "var(--pure-white)", opacity: 0.7, "aria-hidden": true }) }), _jsx(XStack, { render: "button", type: 'button', "aria-label": t('Reconnect stream'), onClick: () => {
|
|
327
|
+
setSnapDataUrl(null);
|
|
328
|
+
void openStream(activeBox.id, mode, control === 'watching');
|
|
329
|
+
}, width: 26, height: 26, rounded: 999, items: "center", justify: "center", bg: "transparent", borderWidth: 0, cursor: "pointer", hoverStyle: { bg: RAISED }, children: _jsx(RefreshCw, { size: 13, color: "var(--pure-white)", opacity: 0.7, "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: 26, height: 26, rounded: 999, items: "center", justify: "center", bg: "transparent", borderWidth: 0, cursor: "pointer", hoverStyle: { bg: RAISED }, children: _jsx(ExternalLink, { size: 13, color: "var(--pure-white)", opacity: 0.7, "aria-hidden": true }) })) : null, _jsxs(XStack, { render: "button", type: 'button', "aria-label": t('Park desktop'), disabled: busy, onClick: () => void handlePark(), height: 26, px: 9, gap: 4, rounded: 999, items: "center", bg: RAISED, borderWidth: 1, borderColor: LINE, cursor: "pointer", children: [_jsx(Pause, { size: 11, color: "var(--pure-white)", "aria-hidden": true }), _jsx(Text, { fontSize: 11, lineHeight: 15, color: "var(--pure-white)", opacity: 0.85, 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, rounded: 8, items: "center", justify: "center", bg: "transparent", borderWidth: 0, cursor: "pointer", hoverStyle: { bg: RAISED }, children: expanded ? (_jsx(Minimize2, { size: 14, color: "var(--pure-white)", opacity: 0.65, "aria-hidden": true })) : (_jsx(Maximize2, { size: 14, color: "var(--pure-white)", opacity: 0.65, "aria-hidden": true })) })] })] }), _jsx(YStack, { flex: 1, minH: 0, px: 10, pt: 4, 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: 16, lineHeight: 22, fontWeight: "600", color: "var(--pure-white)", text: "center", children: phase === 'parked' ? t('Desktop is parked') : t('{name}’s resumable desktop', { name: displayName }) }), _jsx(Text, { fontSize: 13, lineHeight: 19, maxW: 440, color: "var(--pure-white)", opacity: 0.62, text: "center", children: t('Persistent home volume preserves open files, browser sessions, and tools across sleep/wake cycles.') }), error ? (_jsx(Text, { role: "alert", fontSize: 12, lineHeight: 17, color: "var(--pure-white)", opacity: 0.75, text: "center", children: error })) : null, _jsxs(XStack, { ...PILL, bg: "var(--pure-white)", borderColor: "var(--pure-white)", disabled: busy, onClick: () => void startOrResume(true), children: [_jsx(Play, { size: 13, color: "var(--pure-black)", "aria-hidden": true }), _jsx(Text, { ...WORD, color: "var(--pure-black)", 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, px: 12, 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,
|
|
330
|
+
title: `${displayName} desktop ${mode}`,
|
|
331
|
+
allow: 'clipboard-read; clipboard-write; fullscreen', width: "100%", height: "100%", borderWidth: 0 })) : (_jsx(PulsingCluster, { label: t('Connecting') })) })) }), promptOpen && awake ? (_jsx(YStack, { px: 16, pt: 10, gap: 8, children: _jsxs(XStack, { render: "form", onSubmit: (e) => void submitComputerTask(e), gap: 8, items: "center", children: [_jsx(Input, { unstyled: true, autoFocus: true, value: task, onChange: (e) => setTask(e.target.value), placeholder: t('Tell {name} what to do on this desktop (e.g., "Log in with my GitHub vault credentials and review open PRs")…', { name: displayName }), "aria-label": t('Co-work with {name} on desktop', { name: displayName }), flex: 1, height: 36, px: 14, rounded: 999, bg: RAISED, borderWidth: 1, borderColor: LINE, color: INK, fontSize: 13, placeholderTextColor: "$placeholderColor" }), _jsxs(XStack, { ...PILL, type: 'submit', height: 36, px: 14, bg: "var(--pure-white)", borderColor: "var(--pure-white)", disabled: !task.trim() || runningTask, opacity: !task.trim() || runningTask ? 0.5 : 1, children: [_jsx(Send, { size: 12, color: "var(--pure-black)", "aria-hidden": true }), _jsx(Text, { ...WORD, fontSize: 12, color: "var(--pure-black)", children: runningTask ? t('Working…') : t('Run on desktop') })] })] }) })) : null, showBottomBar ? (_jsxs(XStack, { height: 58, px: 16, items: "center", justify: "space-between", gap: 12, shrink: 0, children: [_jsx(XStack, { flex: 1, items: "center", gap: 8, minW: 0, children: error ? (_jsx(Text, { ...CLIP, role: "alert", fontSize: 12, lineHeight: 16, color: "var(--pure-white)", opacity: 0.75, children: error })) : statusToast ? (_jsx(Text, { ...CLIP, fontSize: 12, lineHeight: 16, color: "var(--pure-white)", opacity: 0.68, children: statusToast })) : null }), _jsxs(XStack, { "data-parity-key": "bots.computer.control-pill", height: 38, pl: 14, pr: 5, gap: 12, rounded: 999, items: "center", bg: RAISED, borderWidth: 1, borderColor: LINE, children: [_jsxs(XStack, { items: "center", gap: 7, children: [control === 'watching' ? (_jsx(Eye, { size: 14, color: "var(--pure-white)", opacity: 0.75, "aria-hidden": true })) : (_jsx(MousePointerClick, { size: 14, color: "var(--state-online)", "aria-hidden": true })), _jsx(Text, { fontSize: 13, lineHeight: 18, fontWeight: "500", color: "var(--pure-white)", opacity: 0.88, children: control === 'watching' ? t('Watching') : t('In control') })] }), control === 'watching' ? (_jsx(XStack, { render: "button", type: 'button', onClick: () => toggleControl('controlling'), height: 28, px: 13, rounded: 999, items: "center", justify: "center", bg: "var(--pure-white)", borderWidth: 0, cursor: "pointer", children: _jsx(Text, { fontSize: 12, lineHeight: 16, fontWeight: "600", color: "var(--pure-black)", children: t('Take control') }) })) : (_jsx(XStack, { render: "button", type: 'button', onClick: () => toggleControl('watching'), height: 28, px: 13, rounded: 999, items: "center", justify: "center", bg: PICKED, borderWidth: 1, borderColor: LINE, cursor: "pointer", children: _jsx(Text, { fontSize: 12, lineHeight: 16, fontWeight: "500", color: "var(--pure-white)", children: t('Watch only') }) }))] }), _jsx(XStack, { flex: 1, items: "center", justify: "flex-end", gap: 8, children: awake ? (_jsxs(XStack, { render: "button", type: 'button', onClick: () => setPromptOpen((v) => !v), height: 30, px: 11, gap: 6, rounded: 999, items: "center", bg: promptOpen ? PICKED : 'transparent', borderWidth: 1, borderColor: promptOpen ? LINE : 'transparent', cursor: "pointer", hoverStyle: { bg: RAISED }, children: [_jsx(Sparkles, { size: 12, color: "var(--pure-white)", opacity: 0.78, "aria-hidden": true }), _jsx(Text, { fontSize: 12, lineHeight: 16, color: "var(--pure-white)", opacity: 0.78, children: runningTask ? t('{name} working…', { name: displayName }) : t('Work with {name}', { name: displayName }) })] })) : null })] })) : null] }) }) }), _jsx(VaultDialog, { open: vaultOpen, onOpenChange: (next) => {
|
|
332
|
+
setVaultOpen(next);
|
|
333
|
+
if (!next)
|
|
334
|
+
void refreshVault();
|
|
335
|
+
}, onAutofill: awake ? (item, field) => void runAutofill(item, field ?? 'login') : undefined, onChanged: (doc) => setVaultItems(doc.items) })] }));
|
|
175
336
|
}
|
|
@@ -349,5 +349,5 @@ export function ConnectorsCatalog({ defaultFilter = 'all', embedded = false, onC
|
|
|
349
349
|
: t('No connectors match “{query}”.', { query }) }) })) : null] })] }));
|
|
350
350
|
}
|
|
351
351
|
export function ConnectorsDialog({ open, onOpenChange, defaultFilter = 'all', onConnected, }) {
|
|
352
|
-
return (_jsx(Dialog, { open: open, onOpenChange: onOpenChange, children: _jsx(DialogContent, { width: "94vw", maxW: 880, p: 0, showCloseButton: false, bg: GROUND, borderWidth: 1, borderColor: LINE, rounded: 16, overflow: "hidden", children: _jsx(YStack, { maxH: "86vh", bg: GROUND, children: _jsx(ConnectorsCatalog, { defaultFilter: defaultFilter, onClose: () => onOpenChange(false), onConnected: onConnected }) }) }) }));
|
|
352
|
+
return (_jsx(Dialog, { open: open, onOpenChange: onOpenChange, children: _jsx(DialogContent, { width: "94vw", maxW: 880, p: 0, showCloseButton: false, bg: GROUND, borderWidth: 1, borderColor: LINE, rounded: 16, overflow: "hidden", children: _jsx(YStack, { height: "82vh", maxH: "86vh", bg: GROUND, children: _jsx(ConnectorsCatalog, { defaultFilter: defaultFilter, onClose: () => onOpenChange(false), onConnected: onConnected }) }) }) }));
|
|
353
353
|
}
|
package/dist/bots/Groups.js
CHANGED
|
@@ -220,10 +220,12 @@ export function GroupThread({ group, bots, side, onSide, onBack, onEdit, onPickB
|
|
|
220
220
|
? t('Lux Quasar Finalized · {profile}', { profile: quasar.profile.toUpperCase() })
|
|
221
221
|
: t('Lux Quasar Escalated to Primary ({to})', { to: res.escalatedTo || PRIMARY_BOT }) })] }), _jsx(Text, { fontSize: 11, lineHeight: 15, color: DIM, children: `Support ${Math.round((quasar.support || 0) * 100)}% · Rounds ${quasar.rounds}/${quasar.beta} · k=${quasar.sampleK}` })] }), _jsx(Text, { ...CLIP, fontSize: 11, lineHeight: 15, color: DIM, children: `SHA3-384 Cert: ${quasar.checkpointDigest.slice(0, 24)}… · Threshold: ${quasar.thresholdCommitment.slice(0, 20)}…` })] })) : null, _jsxs(YStack, { "data-parity-key": "bots.theirs", px: 16, py: 13, rounded: 16, bg: RAISED, borderWidth: 1, borderColor: LINE, gap: 8, children: [_jsx(Text, { fontSize: 14, lineHeight: 21, color: INK, whiteSpace: "pre-wrap", children: res.output }), res.proposals?.length ? (_jsxs(YStack, { pt: 6, borderTopWidth: 1, borderColor: LINE, gap: 8, children: [_jsxs(XStack, { render: "button", type: 'button', onClick: () => setExpanded((prev) => ({ ...prev, [turn.id]: !showProps })), items: "center", gap: 5, bg: "transparent", borderWidth: 0, p: 0, cursor: "pointer", children: [_jsx(ChevronRight, { size: 13, color: DIM, "aria-hidden": true }), _jsx(Text, { fontSize: 12, lineHeight: 16, color: DIM, children: showProps
|
|
222
222
|
? t('Hide {n} bot proposals', { n: res.proposals.length })
|
|
223
|
-
:
|
|
224
|
-
n
|
|
225
|
-
|
|
226
|
-
|
|
223
|
+
: res.durationMs
|
|
224
|
+
? t('Inspect {n} bot proposals & verdicts ({ms}ms)', {
|
|
225
|
+
n: res.proposals.length,
|
|
226
|
+
ms: res.durationMs,
|
|
227
|
+
})
|
|
228
|
+
: t('Inspect {n} bot proposals & verdicts', { n: res.proposals.length }) })] }), showProps ? (_jsx(YStack, { gap: 6, children: res.proposals.map((p) => (_jsxs(YStack, { p: 10, rounded: 10, bg: GROUND, borderWidth: 1, borderColor: LINE, gap: 4, children: [_jsxs(XStack, { items: "center", justify: "space-between", children: [_jsx(Text, { fontSize: 12, lineHeight: 16, fontWeight: "600", color: INK, children: `${called(p.agent)} (Layer ${p.layer})` }), _jsx(Text, { fontSize: 11, lineHeight: 15, color: DIM, children: `Verdict: ${p.verdict || 'propose'} · Conf ${Math.round((p.confidence || 0) * 100)}%` })] }), _jsx(Text, { fontSize: 12, lineHeight: 17, color: DIM, whiteSpace: "pre-wrap", children: p.output || p.error || '' })] }, p.agent))) })) : null] })) : null] })] })) : null] }, turn.id));
|
|
227
229
|
})] }), _jsx(YStack, { "data-parity-key": "bots.composer", px: 16, pb: 16, pt: 8, borderTopWidth: 1, borderColor: LINE, children: _jsxs(XStack, { render: "form", onSubmit: (e) => void send(e), maxW: 760, width: "100%", self: "center", gap: 8, items: "center", children: [_jsx(Input, { unstyled: true, value: input, onChange: (e) => setInput(e.target.value), placeholder: t('Direct {group} ({policy})…', { group: group.name, policy: policyBadge(group.policy) }), "aria-label": t('Message {group}', { group: group.name }), flex: 1, height: 42, px: 16, rounded: 999, bg: RAISED, borderWidth: 1, borderColor: LINE, color: INK, fontSize: 14, placeholderTextColor: "$placeholderColor" }), _jsxs(XStack, { ...PILL, type: 'submit', height: 42, px: 16, bg: INK, borderColor: INK, disabled: !input.trim() || running, opacity: !input.trim() || running ? 0.45 : 1, children: [_jsx(Send, { size: 14, color: "var(--background)", "aria-hidden": true }), _jsx(Text, { ...WORD, color: "var(--background)", children: running ? t('Coordinating…') : t('Run Group') })] })] }) })] }));
|
|
228
230
|
}
|
|
229
231
|
export function GroupPanel({ group, groups, bots, onClose, onEdit, onDelete, onPickBot, }) {
|