@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.
@@ -1,53 +1,94 @@
1
1
  'use client';
2
- import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  // The open bot's right inspector panel:
4
4
  // - Avatar, Primary Bot ("hanzo" · Layer 0) status, [Activity | Library] segmented tabs
5
+ // - Sleek Desktop Sandbox Computer card (`Awake` / `Parked` / `Asleep` dark screen preview — no heart icon!)
6
+ // - Scheduled & Event-Driven Automations (`/v1/auto/automations` + agent cron schedule, live toggle & Run now)
7
+ // - Unified Secrets & Login Autofill (`1Password`, `LastPass`, `Hanzo KMS` synced with platform.hanzo.ai & hanzo.app)
5
8
  // - Hierarchy & Layer role card (Primary Bot promotion, Bot Group assignment, Layer 0..3)
6
9
  // - Slack Sync & Channel Routing card (one-click Add to Slack, Sync Channels, default @hanzo responder, #channel bindings)
7
- // - Upcoming routines & connected networks
8
- // - Connectors launcher
9
- // - Dedicated Desktop Sandbox Computer card opening ComputerDialog (live GUI + Terminal + Computer Use)
10
- // - Voice chat preferences
10
+ // - Connectors launcher & Voice chat preferences
11
11
  import { useCallback, useEffect, useMemo, useState } from 'react';
12
12
  import { useI18n } from '@hanzo/i18n/react';
13
- import { Text, XStack, YStack } from '@hanzo/gui';
13
+ import { Input, Text, XStack, YStack } from '@hanzo/gui';
14
14
  import { Button, Dialog, DialogContent, DialogTitle, DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger, Switch, } from '@hanzo/ui';
15
- import { ChevronDown, ChevronRight, Clock, ExternalLink, FileText, Image as ImageIcon, Layers, Plus, RefreshCw, Star, X, } from 'lucide-react';
15
+ import { ChevronDown, ChevronRight, Clock, ExternalLink, FileText, Image as ImageIcon, KeyRound, Layers, Play, Plus, RefreshCw, Star, Trash2, X, Zap, } from 'lucide-react';
16
16
  import { useKept } from '../kept.js';
17
+ import { api } from '../lib/api.js';
17
18
  import { useAi } from '../lib/ai.js';
18
19
  import { say } from '../failure.js';
19
20
  import { Network, of } from '../network.js';
20
21
  import { called } from '../team.js';
22
+ import { VaultDialog, readVault } from '../vault.js';
21
23
  import { ComputerDialog } from './ComputerDialog.js';
22
24
  import { ConnectorsDialog } from './ConnectorsDialog.js';
23
25
  import { Face } from './face.js';
24
- import { ALWAYS, PRIMARY_BOT, answering, disk, setAnswering, setPrimaryBot, slackAuthorizeUrl, slackChannels, slackStatus, slackSyncChannels, toGroupRef, updateBotMeta, } from './api.js';
26
+ import { ALWAYS, PRIMARY_BOT, answering, createBotAutomation, deleteBotAutomation, findBotComputer, listBotAutomations, parseAutomationWhen, runBotAutomation, setAnswering, setPrimaryBot, slackAuthorizeUrl, slackChannels, slackStatus, slackSyncChannels, toGroupRef, toggleBotAutomation, updateBotMeta, } from './api.js';
25
27
  import { CARD, CLIP, LABEL, PILL, ROUND, WORD } from './kit.js';
26
- import { DIM, GROUND, INK, LINE, PICKED, RAISED } from './ink.js';
28
+ import { DIM, FLOOR, GROUND, INK, LINE, PICKED, RAISED } from './ink.js';
27
29
  import { partsOf } from './said.js';
28
30
  import { cron as words } from './time.js';
29
31
  const VOICES = ['Liora', 'Aria', 'Sol', 'Koe', 'Nova', 'Echo'];
30
32
  const SPEEDS = ['0.9x', '1x', '1.25x', '1.5x', '2x'];
31
33
  const LANGUAGES = ['Auto-detect', 'English', 'Spanish', 'French', 'German', 'Japanese', 'Chinese'];
34
+ const EVENT_TRIGGERS = [
35
+ { id: 'slack:mention', source: 'slack', name: 'mention', label: 'Slack · @mention', hint: 'Runs when @hanzo is mentioned in Slack' },
36
+ { id: 'slack:message', source: 'slack', name: 'message', label: 'Slack · Channel message', hint: 'Runs on new messages in bound channels' },
37
+ { id: 'github:push', source: 'github', name: 'push', label: 'GitHub · Push', hint: 'Runs when commits are pushed to a repository' },
38
+ { id: 'github:pull_request', source: 'github', name: 'pull_request', label: 'GitHub · Pull Request', hint: 'Runs when a PR opens or updates' },
39
+ { id: 'stripe:charge', source: 'stripe', name: 'charge', label: 'Stripe · Payment / Charge', hint: 'Runs when a customer payment settles' },
40
+ { id: 'webhook:inbound', source: 'webhook', name: 'inbound', label: 'Webhook · Inbound HTTP', hint: 'Runs whenever your webhook URL receives a POST' },
41
+ ];
42
+ const SCHEDULE_PRESETS = [
43
+ { id: 'daily', label: 'Daily · 9:00 AM', schedule: { kind: 'daily', at: '09:00' } },
44
+ { id: 'weekdays', label: 'Weekdays · 9:00 AM', schedule: { kind: 'weekdays', at: '09:00' } },
45
+ { id: 'hourly', label: 'Every hour', schedule: { kind: 'hourly' } },
46
+ { id: 'weekly', label: 'Mondays · 9:00 AM', schedule: { kind: 'weekly', day: 'mon', at: '09:00' } },
47
+ ];
32
48
  function Row({ mark, title, line, children, last, }) {
33
- return (_jsxs(XStack, { minH: 52, px: 13, py: 9, gap: 11, items: "center", borderBottomWidth: last ? 0 : 1, borderColor: LINE, children: [mark, _jsxs(YStack, { flex: 1, minW: 0, children: [_jsx(Text, { ...CLIP, fontSize: 14, lineHeight: 19, color: INK, children: title }), line ? (_jsx(Text, { ...CLIP, fontSize: 13, lineHeight: 18, color: DIM, children: line })) : null] }), children] }));
49
+ return (_jsxs(XStack, { minH: 52, px: 13, py: 9, gap: 11, items: "center", borderBottomWidth: last ? 0 : 1, borderColor: LINE, children: [mark, _jsxs(YStack, { flex: 1, minW: 0, children: [_jsx(Text, { ...CLIP, fontSize: 14, lineHeight: 19, color: INK, children: title }), line ? (_jsx(Text, { ...CLIP, fontSize: 12, lineHeight: 17, color: DIM, children: line })) : null] }), children] }));
34
50
  }
35
51
  function VoiceRow({ label, value, options, onSelect, last, }) {
36
52
  return (_jsxs(XStack, { minH: 44, px: 14, items: "center", justify: "space-between", borderBottomWidth: last ? 0 : 1, borderColor: LINE, children: [_jsx(Text, { fontSize: 14, lineHeight: 19, color: INK, children: label }), _jsxs(DropdownMenu, { placement: "bottom-end", offset: 6, children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsxs(XStack, { render: "button", type: 'button', items: "center", gap: 5, px: 6, py: 4, rounded: 6, bg: "transparent", borderWidth: 0, cursor: "pointer", hoverStyle: { bg: PICKED }, children: [_jsx(Text, { fontSize: 14, lineHeight: 19, color: INK, children: value }), _jsx(ChevronDown, { size: 14, color: DIM, "aria-hidden": true })] }) }), _jsx(DropdownMenuContent, { minW: 160, "aria-label": label, children: options.map((opt) => (_jsx(DropdownMenuItem, { onSelect: () => onSelect(opt), children: _jsx(Text, { fontSize: "$3", color: "$ink", fontWeight: opt === value ? '600' : '400', children: opt }) }, opt))) })] })] }));
37
53
  }
38
- function ComputerScreen({ awake }) {
39
- return (_jsx(YStack, { "aria-hidden": true, width: 56, height: 36, rounded: 9, shrink: 0, items: "center", justify: "center", position: "relative", overflow: "hidden", bg: PICKED, borderWidth: 1, borderColor: LINE, children: awake ? (_jsx(YStack, { width: 10, height: 10, rounded: 999, bg: "var(--state-online)" })) : (_jsxs(_Fragment, { children: [_jsx(Text, { position: "absolute", t: 2, r: 6, fontSize: 9, lineHeight: 10, fontWeight: "600", color: DIM, children: "z" }), _jsxs("svg", { width: "20", height: "18", viewBox: "0 0 20 18", fill: "none", "aria-hidden": "true", children: [_jsx("path", { d: "M10 16.2C10 16.2 2.5 11.4 2.5 6.3C2.5 3.8 4.4 2 6.7 2C8.1 2 9.3 2.7 10 3.8C10.7 2.7 11.9 2 13.3 2C15.6 2 17.5 3.8 17.5 6.3C17.5 11.4 10 16.2 10 16.2Z", fill: "currentColor", opacity: "0.34" }), _jsx("circle", { cx: "8.1", cy: "7.9", r: "0.9", fill: "var(--pane-fill, var(--card))" }), _jsx("circle", { cx: "11.9", cy: "7.9", r: "0.9", fill: "var(--pane-fill, var(--card))" })] })] })) }));
54
+ /**
55
+ * Sleek miniature desktop screen preview (matching reference `uploaded_media_1` — zero hearts!).
56
+ * Shows an illuminated dark violet/indigo screen preview when `Awake`, and a clean dark charcoal
57
+ * monitor surface when `Parked` or `Asleep`.
58
+ */
59
+ function ComputerScreen({ awake, parked }) {
60
+ return (_jsxs(YStack, { "aria-hidden": true, width: 56, height: 36, rounded: 8, shrink: 0, justify: "flex-end", items: "center", pb: 3, position: "relative", overflow: "hidden", bg: awake ? 'var(--secondary)' : FLOOR, borderWidth: 1, borderColor: awake ? 'var(--primary)' : LINE, children: [_jsx(YStack, { position: "absolute", t: 0, l: 0, r: 0, b: 0, bg: awake ? 'var(--primary)' : PICKED, opacity: awake ? 0.24 : parked ? 0.45 : 0.2 }), _jsx(XStack, { width: 22, height: 3, rounded: 999, bg: awake ? 'var(--pure-white)' : DIM, opacity: awake ? 0.65 : 0.28 })] }));
40
61
  }
41
- function stateLabel(box, t) {
42
- if (!box)
43
- return t('Asleep · click for Desktop GUI');
44
- if (box.status === 'running')
45
- return t('Awake · Desktop GUI & Shell');
46
- if (box.status === 'pending')
47
- return t('Waking desktop…');
48
- return box.error || t('Parked · click to wake');
62
+ function stateLabel(box, hasRef, t) {
63
+ if (box?.status === 'running')
64
+ return t('Awake');
65
+ if (box?.status === 'pending')
66
+ return t('Starting desktop…');
67
+ if (box || hasRef)
68
+ return t('Parked · click to resume');
69
+ return t('Ready · click to open');
70
+ }
71
+ function describeAutomation(a, t) {
72
+ if (a.event?.source && a.event?.name) {
73
+ return `${t('On event')}: ${a.event.source}.${a.event.name}`;
74
+ }
75
+ const s = a.schedule;
76
+ if (!s || s.kind === 'manual')
77
+ return a.enabled ? t('On demand') : t('Paused');
78
+ if (!a.enabled)
79
+ return `${t('Paused')} · ${s.kind}${s.at ? ` ${s.at}` : ''}`;
80
+ if (s.kind === 'hourly')
81
+ return t('Every hour');
82
+ if (s.kind === 'daily')
83
+ return t('Daily at {at}', { at: s.at || '09:00' });
84
+ if (s.kind === 'weekdays')
85
+ return t('Weekdays at {at}', { at: s.at || '09:00' });
86
+ if (s.kind === 'weekly')
87
+ return t('Weekly ({day}) at {at}', { day: s.day || 'mon', at: s.at || '09:00' });
88
+ if (s.kind === 'cron' && s.cron)
89
+ return `Cron · ${s.cron}`;
90
+ return s.kind;
49
91
  }
50
- const best = (boxes) => boxes.find((b) => b.status === 'running') ?? boxes.find((b) => b.status === 'pending') ?? boxes[0] ?? null;
51
92
  const POLL = 5000;
52
93
  export function Panel({ bot, groups = [], runs = [], onClose, kept, onSchedule, onDelete, onBotChanged, onPickGroup, focus = false, }) {
53
94
  const { t, locale } = useI18n();
@@ -64,6 +105,18 @@ export function Panel({ bot, groups = [], runs = [], onClose, kept, onSchedule,
64
105
  const [wrong, setWrong] = useState(null);
65
106
  const [deleting, setDeleting] = useState(false);
66
107
  const [connectorsOpen, setConnectorsOpen] = useState(false);
108
+ const [vaultOpen, setVaultOpen] = useState(false);
109
+ const [vaultDoc, setVaultDoc] = useState({ items: [], providers: {}, secretKeys: [] });
110
+ // Scheduled + Event-driven Automations state
111
+ const [automations, setAutomations] = useState([]);
112
+ const [autoModalOpen, setAutoModalOpen] = useState(false);
113
+ const [autoMode, setAutoMode] = useState('schedule');
114
+ const [autoName, setAutoName] = useState('');
115
+ const [autoInstructions, setAutoInstructions] = useState('');
116
+ const [autoPreset, setAutoPreset] = useState('weekdays');
117
+ const [autoCustomWhen, setAutoCustomWhen] = useState('');
118
+ const [autoEventId, setAutoEventId] = useState('slack:mention');
119
+ const [autoBusy, setAutoBusy] = useState(false);
67
120
  // Slack workspace + channel routing state
68
121
  const [slackConn, setSlackConn] = useState({ connected: false });
69
122
  const [slackDefault, setSlackDefault] = useState(PRIMARY_BOT);
@@ -82,19 +135,24 @@ export function Panel({ bot, groups = [], runs = [], onClose, kept, onSchedule,
82
135
  if (!client)
83
136
  return;
84
137
  const opts = signal ? { signal } : undefined;
85
- const [detail, nets, boxes, slk] = await Promise.allSettled([
138
+ const [detail, nets, foundBox, slk, autos, vdoc] = await Promise.allSettled([
86
139
  client.agents.get(bot.name, opts),
87
140
  client.transports.list(opts),
88
- client.sandboxes.list({ project: disk(bot.name) }, opts),
141
+ findBotComputer(client, ext, signal),
89
142
  slackStatus(signal),
143
+ listBotAutomations(client, bot.name, signal),
144
+ readVault(signal),
90
145
  ]);
91
146
  if (signal?.aborted)
92
147
  return;
93
148
  if (detail.status === 'fulfilled')
94
149
  setInstructions(detail.value.instructions ?? '');
95
- if (boxes.status === 'fulfilled') {
96
- setBox(best(boxes.value));
97
- }
150
+ if (foundBox.status === 'fulfilled')
151
+ setBox(foundBox.value);
152
+ if (autos.status === 'fulfilled')
153
+ setAutomations(autos.value);
154
+ if (vdoc.status === 'fulfilled')
155
+ setVaultDoc(vdoc.value);
98
156
  if (slk.status === 'fulfilled') {
99
157
  setSlackConn(slk.value);
100
158
  if (slk.value.connected) {
@@ -123,7 +181,7 @@ export function Panel({ bot, groups = [], runs = [], onClose, kept, onSchedule,
123
181
  })
124
182
  .map((n) => n.id));
125
183
  }
126
- }, [client, bot.name]);
184
+ }, [client, bot.name, ext]);
127
185
  useEffect(() => {
128
186
  const stop = new AbortController();
129
187
  void survey(stop.signal);
@@ -134,16 +192,15 @@ export function Panel({ bot, groups = [], runs = [], onClose, kept, onSchedule,
134
192
  return;
135
193
  const stop = new AbortController();
136
194
  const tick = window.setInterval(() => {
137
- client.sandboxes
138
- .list({ project: disk(bot.name) }, { signal: stop.signal })
139
- .then((boxes) => setBox(best(boxes)))
195
+ findBotComputer(client, ext, stop.signal)
196
+ .then((b) => setBox(b))
140
197
  .catch(() => undefined);
141
198
  }, POLL);
142
199
  return () => {
143
200
  window.clearInterval(tick);
144
201
  stop.abort();
145
202
  };
146
- }, [client, box?.status, bot.name]);
203
+ }, [client, box?.status, ext]);
147
204
  const promotePrimary = async () => {
148
205
  if (!client || saving)
149
206
  return;
@@ -262,6 +319,92 @@ export function Panel({ bot, groups = [], runs = [], onClose, kept, onSchedule,
262
319
  setSlackBusy(false);
263
320
  }
264
321
  };
322
+ const submitAutomation = async (e) => {
323
+ e.preventDefault();
324
+ if (!client || autoBusy || !autoName.trim() || !autoInstructions.trim())
325
+ return;
326
+ setAutoBusy(true);
327
+ setWrong(null);
328
+ try {
329
+ const zone = Intl.DateTimeFormat().resolvedOptions().timeZone || 'UTC';
330
+ let sched;
331
+ if (autoMode === 'schedule') {
332
+ if (autoCustomWhen.trim()) {
333
+ sched = (await parseAutomationWhen(client, autoCustomWhen.trim(), zone)) ?? undefined;
334
+ }
335
+ if (!sched) {
336
+ const found = SCHEDULE_PRESETS.find((p) => p.id === autoPreset) ?? SCHEDULE_PRESETS[0];
337
+ sched = { ...found.schedule, tz: zone };
338
+ }
339
+ }
340
+ const evDef = EVENT_TRIGGERS.find((ev) => ev.id === autoEventId) ?? EVENT_TRIGGERS[0];
341
+ await createBotAutomation(client, {
342
+ botName: bot.name,
343
+ name: autoName.trim(),
344
+ instructions: autoInstructions.trim(),
345
+ mode: autoMode,
346
+ schedule: sched,
347
+ event: autoMode === 'event' ? { source: evDef.source, name: evDef.name } : undefined,
348
+ model: bot.model,
349
+ });
350
+ setAutoName('');
351
+ setAutoInstructions('');
352
+ setAutoCustomWhen('');
353
+ setAutoModalOpen(false);
354
+ await survey();
355
+ }
356
+ catch (err) {
357
+ setWrong(say(err, t('automation'), 'save', t));
358
+ }
359
+ finally {
360
+ setAutoBusy(false);
361
+ }
362
+ };
363
+ const handleToggleAuto = async (a, enabled) => {
364
+ if (!client || autoBusy)
365
+ return;
366
+ setAutoBusy(true);
367
+ try {
368
+ await toggleBotAutomation(client, a.id, enabled);
369
+ setAutomations((list) => list.map((x) => (x.id === a.id ? { ...x, enabled } : x)));
370
+ }
371
+ catch (err) {
372
+ setWrong(say(err, a.name, 'save', t));
373
+ }
374
+ finally {
375
+ setAutoBusy(false);
376
+ }
377
+ };
378
+ const handleRunAutoNow = async (a) => {
379
+ if (!client || autoBusy)
380
+ return;
381
+ setAutoBusy(true);
382
+ try {
383
+ await runBotAutomation(client, a.id);
384
+ await survey();
385
+ }
386
+ catch (err) {
387
+ setWrong(say(err, a.name, 'save', t));
388
+ }
389
+ finally {
390
+ setAutoBusy(false);
391
+ }
392
+ };
393
+ const handleDeleteAuto = async (a) => {
394
+ if (!client || autoBusy)
395
+ return;
396
+ setAutoBusy(true);
397
+ try {
398
+ await deleteBotAutomation(client, a.id);
399
+ setAutomations((list) => list.filter((x) => x.id !== a.id));
400
+ }
401
+ catch (err) {
402
+ setWrong(say(err, a.name, 'save', t));
403
+ }
404
+ finally {
405
+ setAutoBusy(false);
406
+ }
407
+ };
265
408
  const routine = cron ? bot.description || instructions.split('\n')[0].trim() || displayName : '';
266
409
  const scheduleLine = cron
267
410
  ? activeSchedule
@@ -270,6 +413,25 @@ export function Panel({ bot, groups = [], runs = [], onClose, kept, onSchedule,
270
413
  ? t('Paused')
271
414
  : `${t('Paused')} · ${words(cron, locale, t)}`
272
415
  : '';
416
+ const vaultSummary = useMemo(() => {
417
+ const logins = vaultDoc.items.filter((i) => i.kind === 'login').length;
418
+ const keys = vaultDoc.items.filter((i) => i.kind !== 'login').length;
419
+ const linked = [];
420
+ if (vaultDoc.providers.onepassword?.connected)
421
+ linked.push('1Password');
422
+ if (vaultDoc.providers.lastpass?.connected)
423
+ linked.push('LastPass');
424
+ linked.push('KMS');
425
+ if (logins + keys === 0) {
426
+ return t('1Password, LastPass & KMS autofill');
427
+ }
428
+ return t('{logins} logins · {keys} keys ({srcs})', {
429
+ logins,
430
+ keys,
431
+ srcs: linked.join(', '),
432
+ });
433
+ }, [vaultDoc, t]);
434
+ const selectedEventDef = EVENT_TRIGGERS.find((e) => e.id === autoEventId) ?? EVENT_TRIGGERS[0];
273
435
  const libraryItems = useMemo(() => {
274
436
  const items = [];
275
437
  for (const r of runs) {
@@ -291,22 +453,47 @@ export function Panel({ bot, groups = [], runs = [], onClose, kept, onSchedule,
291
453
  return (_jsxs(YStack, { flex: 1, minH: 0, overflowY: "auto", overflowX: "hidden", "aria-label": displayName, render: "aside", children: [_jsx(XStack, { height: 46, shrink: 0, px: 12, items: "center", justify: "flex-end", children: _jsx(XStack, { ...ROUND, "aria-label": t('Close'), onClick: onClose, autoFocus: focus, children: _jsx(X, { size: 16, color: INK, "aria-hidden": true }) }) }), _jsxs(YStack, { items: "center", gap: 8, pt: 2, pb: 18, px: 14, children: [_jsx(Face, { bot: bot, size: 68, starred: isPrimary }), _jsx(Text, { ...CLIP, maxW: "100%", fontSize: 18, lineHeight: 23, fontWeight: "600", color: INK, children: displayName }), _jsx(Text, { fontSize: 12, lineHeight: 16, color: DIM, children: isPrimary ? t('Primary Bot · Layer 0 (Directs all bots)') : t('Layer {lv} Bot', { lv: currentLayer }) }), _jsx(XStack, { "data-parity-key": "bots.panel.tabs", role: "tablist", p: 3, rounded: 999, bg: RAISED, borderWidth: 1, borderColor: LINE, gap: 2, children: ['activity', 'library'].map((id) => {
292
454
  const selected = tab === id;
293
455
  return (_jsx(XStack, { render: "button", type: 'button', role: 'tab', 'aria-selected': selected, onClick: () => setTab(id), height: 28, px: 14, rounded: 999, items: "center", justify: "center", bg: selected ? PICKED : 'transparent', borderWidth: 0, cursor: "pointer", children: _jsx(Text, { fontSize: 13, lineHeight: 18, fontWeight: selected ? '500' : '400', color: selected ? INK : DIM, children: id === 'activity' ? t('Activity') : t('Library') }) }, id));
294
- }) })] }), tab === 'activity' ? (_jsxs(YStack, { px: 15, pb: 24, gap: 18, children: [_jsxs(YStack, { gap: 8, "data-parity-key": "bots.panel.hierarchy", children: [_jsx(Text, { ...LABEL, px: 4, children: t('Hierarchy & Coordination') }), _jsxs(YStack, { ...CARD, children: [_jsx(Row, { mark: isPrimary ? _jsx(Star, { size: 16, color: INK, "aria-hidden": true }) : _jsx(Layers, { size: 16, color: DIM, "aria-hidden": true }), title: isPrimary ? t('Primary Bot (Max 1)') : t('Subordinate Bot'), line: isPrimary
456
+ }) })] }), tab === 'activity' ? (_jsxs(YStack, { px: 15, pb: 24, gap: 18, children: [_jsxs(YStack, { gap: 8, "data-parity-key": "bots.panel.computer", children: [_jsx(Text, { ...LABEL, px: 4, children: t('Computer') }), _jsxs(XStack, { ...CARD, render: "button", type: 'button', onClick: () => setComputerOpen(true), "aria-label": t('Open {name}’s desktop computer', { name: displayName }), minH: 60, px: 13, py: 10, items: "center", gap: 12, cursor: "pointer", hoverStyle: { bg: PICKED }, children: [_jsxs(YStack, { flex: 1, minW: 0, items: "flex-start", children: [_jsx(Text, { ...CLIP, fontSize: 14, lineHeight: 19, color: INK, children: t("Bot's computer") }), _jsx(Text, { ...CLIP, fontSize: 12, lineHeight: 17, color: DIM, children: stateLabel(box, Boolean(ext.computeRef), t) })] }), _jsx(ComputerScreen, { awake: box?.status === 'running', parked: Boolean(box || ext.computeRef) })] })] }), _jsxs(YStack, { gap: 8, "data-parity-key": "bots.panel.automations", children: [_jsxs(XStack, { items: "center", justify: "space-between", px: 4, children: [_jsx(Text, { ...LABEL, children: t('Automations') }), _jsxs(XStack, { render: "button", type: 'button', onClick: () => setAutoModalOpen(true), items: "center", gap: 3, px: 6, py: 2, rounded: 6, bg: "transparent", borderWidth: 0, cursor: "pointer", hoverStyle: { bg: PICKED }, children: [_jsx(Plus, { size: 12, color: DIM, "aria-hidden": true }), _jsx(Text, { fontSize: 12, lineHeight: 16, color: DIM, children: t('Add') })] })] }), _jsxs(YStack, { ...CARD, children: [cron ? (_jsx(Row, { mark: _jsx(Clock, { size: 16, color: DIM, "aria-hidden": true }), title: routine, line: scheduleLine, last: automations.length === 0, children: _jsx(Switch, { "aria-label": t('Run {name} on its schedule', { name: displayName }), checked: activeSchedule, disabled: saving, onCheckedChange: (on) => {
457
+ setWrong(null);
458
+ setSaving(true);
459
+ onSchedule(on, cron === 'paused' ? '0 9 * * *' : cron)
460
+ .catch((e) => setWrong(say(e, t('{name}’s schedule', { name: displayName }), 'save', t)))
461
+ .finally(() => setSaving(false));
462
+ } }) })) : null, automations.map((a, idx) => {
463
+ const isEvent = Boolean(a.event?.source);
464
+ const isLast = idx === automations.length - 1;
465
+ return (_jsx(Row, { mark: isEvent ? _jsx(Zap, { size: 16, color: INK, "aria-hidden": true }) : _jsx(Clock, { size: 16, color: DIM, "aria-hidden": true }), title: a.name, line: describeAutomation(a, t), last: isLast, children: _jsxs(XStack, { items: "center", gap: 6, children: [_jsx(XStack, { render: "button", type: 'button', "aria-label": t('Run {name} now', { name: a.name }), disabled: autoBusy, onClick: () => void handleRunAutoNow(a), width: 26, height: 26, rounded: 999, items: "center", justify: "center", bg: "transparent", borderWidth: 0, cursor: "pointer", hoverStyle: { bg: PICKED }, children: _jsx(Play, { size: 12, color: DIM, "aria-hidden": true }) }), _jsx(Switch, { "aria-label": t('Toggle {name}', { name: a.name }), checked: a.enabled, disabled: autoBusy, onCheckedChange: (on) => void handleToggleAuto(a, on) }), _jsx(XStack, { render: "button", type: 'button', "aria-label": t('Delete {name}', { name: a.name }), disabled: autoBusy, onClick: () => void handleDeleteAuto(a), width: 24, height: 24, rounded: 999, items: "center", justify: "center", bg: "transparent", borderWidth: 0, cursor: "pointer", hoverStyle: { bg: PICKED }, children: _jsx(Trash2, { size: 12, color: DIM, "aria-hidden": true }) })] }) }, a.id));
466
+ }), !cron && automations.length === 0 ? (_jsxs(XStack, { render: "button", type: 'button', onClick: () => setAutoModalOpen(true), minH: 50, px: 13, py: 9, items: "center", justify: "space-between", gap: 10, bg: "transparent", borderWidth: 0, cursor: "pointer", hoverStyle: { bg: PICKED }, children: [_jsxs(YStack, { flex: 1, minW: 0, items: "flex-start", children: [_jsx(Text, { ...CLIP, fontSize: 14, lineHeight: 19, color: INK, children: t('Scheduled & event-driven work') }), _jsx(Text, { ...CLIP, fontSize: 12, lineHeight: 17, color: DIM, children: t('Run on cron schedules, Slack mentions, GitHub PRs, or webhooks') })] }), _jsx(ChevronRight, { size: 15, color: DIM, "aria-hidden": true })] })) : null] })] }), _jsxs(YStack, { gap: 8, "data-parity-key": "bots.panel.vault", children: [_jsx(Text, { ...LABEL, px: 4, children: t('Secrets & Login Autofill') }), _jsxs(XStack, { ...CARD, render: "button", type: 'button', onClick: () => setVaultOpen(true), minH: 52, px: 13, py: 9, items: "center", gap: 11, cursor: "pointer", hoverStyle: { bg: PICKED }, children: [_jsx(KeyRound, { size: 17, color: INK, "aria-hidden": true }), _jsxs(YStack, { flex: 1, minW: 0, items: "flex-start", children: [_jsx(Text, { ...CLIP, fontSize: 14, lineHeight: 19, color: INK, children: t('Unified Vault & Password Autofill') }), _jsx(Text, { ...CLIP, fontSize: 12, lineHeight: 17, color: DIM, children: vaultSummary })] }), _jsx(ChevronRight, { size: 15, color: DIM, "aria-hidden": true })] })] }), _jsxs(YStack, { gap: 8, "data-parity-key": "bots.panel.hierarchy", children: [_jsx(Text, { ...LABEL, px: 4, children: t('Hierarchy & Coordination') }), _jsxs(YStack, { ...CARD, children: [_jsx(Row, { mark: isPrimary ? _jsx(Star, { size: 16, color: INK, "aria-hidden": true }) : _jsx(Layers, { size: 16, color: DIM, "aria-hidden": true }), title: isPrimary ? t('Primary Bot (Max 1)') : t('Subordinate Bot'), line: isPrimary
295
467
  ? t('Directs worker bots & layered Bot Groups')
296
- : t('Directed by Primary Bot ({primary})', { primary: PRIMARY_BOT }), last: isPrimary && groups.length === 0, children: !isPrimary ? (_jsx(XStack, { render: "button", type: 'button', disabled: saving, onClick: () => void promotePrimary(), height: 26, px: 9, rounded: 999, items: "center", bg: GROUND, borderWidth: 1, borderColor: LINE, cursor: "pointer", hoverStyle: { bg: PICKED }, children: _jsx(Text, { fontSize: 11, lineHeight: 15, fontWeight: "500", color: INK, children: t('Make Primary') }) })) : null }), !isPrimary ? (_jsx(VoiceRow, { label: t('Layer'), value: `Layer ${currentLayer}`, options: ['Layer 1', 'Layer 2', 'Layer 3'], onSelect: (opt) => void assignLayer(Number(opt.replace('Layer ', '')) || 1), last: groups.length === 0 })) : null, groups.length > 0 ? (_jsxs(XStack, { minH: 44, px: 14, items: "center", justify: "space-between", children: [_jsx(Text, { fontSize: 14, lineHeight: 19, color: INK, children: t('Group') }), _jsxs(XStack, { items: "center", gap: 6, children: [assignedGroup && onPickGroup ? (_jsx(XStack, { render: "button", type: 'button', onClick: () => onPickGroup(toGroupRef(assignedGroup.name)), px: 8, py: 3, rounded: 999, bg: PICKED, borderWidth: 1, borderColor: LINE, cursor: "pointer", children: _jsx(Text, { fontSize: 11, lineHeight: 15, color: INK, children: t('Open') }) })) : null, _jsxs(DropdownMenu, { placement: "bottom-end", offset: 6, children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsxs(XStack, { render: "button", type: 'button', items: "center", gap: 5, px: 6, py: 4, rounded: 6, bg: "transparent", borderWidth: 0, cursor: "pointer", hoverStyle: { bg: PICKED }, children: [_jsx(Text, { fontSize: 13, lineHeight: 18, color: INK, children: assignedGroup ? assignedGroup.name : t('None') }), _jsx(ChevronDown, { size: 14, color: DIM, "aria-hidden": true })] }) }), _jsxs(DropdownMenuContent, { minW: 170, children: [_jsx(DropdownMenuItem, { onSelect: () => void assignGroup(''), children: _jsx(Text, { fontSize: "$3", color: "$ink", children: t('None') }) }), groups.map((g) => (_jsx(DropdownMenuItem, { onSelect: () => void assignGroup(g.id), children: _jsx(Text, { fontSize: "$3", color: "$ink", children: `${g.name} (L${g.layer || 1})` }) }, g.id)))] })] })] })] })) : null] })] }), _jsxs(YStack, { gap: 8, "data-parity-key": "bots.panel.slack", children: [_jsxs(XStack, { items: "center", justify: "space-between", px: 4, children: [_jsx(Text, { ...LABEL, children: t('Slack Agent Sync') }), slackConn.connected ? (_jsxs(XStack, { render: "button", type: 'button', disabled: slackBusy, onClick: () => void syncSlack(), items: "center", gap: 4, px: 6, py: 2, rounded: 6, bg: "transparent", borderWidth: 0, cursor: "pointer", hoverStyle: { bg: PICKED }, children: [_jsx(RefreshCw, { size: 11, color: DIM, "aria-hidden": true }), _jsx(Text, { fontSize: 11, lineHeight: 15, color: DIM, children: t('Sync channels') })] })) : null] }), _jsxs(YStack, { ...CARD, children: [_jsx(Row, { mark: _jsx(Network, { transport: "slack", size: 20 }), title: slackConn.connected ? (slackConn.account ? `Slack · ${slackConn.account}` : t('Slack Connected')) : t('Add @hanzo to Slack'), line: slackConn.connected
468
+ : t('Directed by Primary Bot ({primary})', { primary: PRIMARY_BOT }), last: isPrimary && groups.length === 0, children: !isPrimary ? (_jsx(XStack, { render: "button", type: 'button', disabled: saving, onClick: () => void promotePrimary(), height: 26, px: 9, rounded: 999, items: "center", bg: GROUND, borderWidth: 1, borderColor: LINE, cursor: "pointer", hoverStyle: { bg: PICKED }, children: _jsx(Text, { fontSize: 11, lineHeight: 15, fontWeight: "500", color: INK, children: t('Make Primary') }) })) : null }), !isPrimary ? (_jsx(VoiceRow, { label: t('Layer'), value: `Layer ${currentLayer}`, options: ['Layer 1', 'Layer 2', 'Layer 3'], onSelect: (opt) => void assignLayer(Number(opt.replace('Layer ', '')) || 1), last: groups.length === 0 })) : null, groups.length > 0 ? (_jsxs(XStack, { minH: 44, px: 14, items: "center", justify: "space-between", children: [_jsx(Text, { fontSize: 14, lineHeight: 19, color: INK, children: t('Group') }), _jsxs(XStack, { items: "center", gap: 6, children: [assignedGroup && onPickGroup ? (_jsx(XStack, { render: "button", type: 'button', onClick: () => onPickGroup(toGroupRef(assignedGroup.name)), px: 8, py: 3, rounded: 999, bg: PICKED, borderWidth: 1, borderColor: LINE, cursor: "pointer", children: _jsx(Text, { fontSize: 11, lineHeight: 15, color: INK, children: t('Open') }) })) : null, _jsxs(DropdownMenu, { placement: "bottom-end", offset: 6, children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsxs(XStack, { render: "button", type: 'button', items: "center", gap: 5, px: 6, py: 4, rounded: 6, bg: "transparent", borderWidth: 0, cursor: "pointer", hoverStyle: { bg: PICKED }, children: [_jsx(Text, { fontSize: 13, lineHeight: 18, color: INK, children: assignedGroup ? assignedGroup.name : t('None') }), _jsx(ChevronDown, { size: 14, color: DIM, "aria-hidden": true })] }) }), _jsxs(DropdownMenuContent, { minW: 170, children: [_jsx(DropdownMenuItem, { onSelect: () => void assignGroup(''), children: _jsx(Text, { fontSize: "$3", color: "$ink", children: t('None') }) }), groups.map((g) => (_jsx(DropdownMenuItem, { onSelect: () => void assignGroup(g.id), children: _jsx(Text, { fontSize: "$3", color: "$ink", children: `${g.name} (L${g.layer || 1})` }) }, g.id)))] })] })] })] })) : null] })] }), _jsxs(YStack, { gap: 8, "data-parity-key": "bots.panel.slack", children: [_jsxs(XStack, { items: "center", justify: "space-between", px: 4, children: [_jsx(Text, { ...LABEL, children: t('Slack Agent Sync') }), slackConn.connected ? (_jsxs(XStack, { render: "button", type: 'button', disabled: slackBusy, onClick: () => void syncSlack(), items: "center", gap: 4, px: 6, py: 2, rounded: 6, bg: "transparent", borderWidth: 0, cursor: "pointer", hoverStyle: { bg: PICKED }, children: [_jsx(RefreshCw, { size: 11, color: DIM, "aria-hidden": true }), _jsx(Text, { fontSize: 11, lineHeight: 15, color: DIM, children: t('Sync channels') })] })) : null] }), _jsxs(YStack, { ...CARD, children: [_jsx(Row, { mark: _jsx(Network, { transport: "slack", size: 20 }), title: slackConn.connected
469
+ ? slackConn.account
470
+ ? `Slack · ${slackConn.account}`
471
+ : t('Slack Connected')
472
+ : t('Add @hanzo to Slack'), line: slackConn.connected
297
473
  ? slackDefault === bot.name
298
474
  ? t('Answers @hanzo in Slack by default')
299
475
  : t('Default responder: {def}', { def: slackDefault })
300
476
  : t('Sync channels, threads, and DMs like @hanzo'), last: !slackConn.connected, children: slackConn.connected ? (_jsx(Switch, { "aria-label": t('Answer @hanzo in Slack with {name}', { name: displayName }), checked: slackDefault === bot.name, disabled: slackBusy, onCheckedChange: (on) => void toggleSlackDefault(on) })) : (_jsxs(XStack, { render: "button", type: 'button', disabled: slackBusy, onClick: () => void connectSlack(), height: 28, px: 10, rounded: 999, items: "center", gap: 5, bg: INK, borderWidth: 1, borderColor: INK, cursor: "pointer", children: [_jsx(ExternalLink, { size: 11, color: "var(--background)", "aria-hidden": true }), _jsx(Text, { fontSize: 11, lineHeight: 15, fontWeight: "500", color: "var(--background)", children: t('Add to Slack') })] })) }), slackConn.connected && slackChans.length > 0 ? (_jsxs(YStack, { px: 13, py: 9, gap: 6, children: [_jsx(Text, { fontSize: 11, lineHeight: 15, color: DIM, children: t('Bind channels directly to {name}:', { name: displayName }) }), _jsx(XStack, { flexWrap: "wrap", gap: 5, children: slackChans.slice(0, 8).map((ch) => {
301
477
  const mine = slackBound[ch.id] === bot.name;
302
478
  return (_jsx(XStack, { render: "button", type: 'button', disabled: slackBusy, onClick: () => void toggleSlackChannel(ch.id), height: 24, px: 8, rounded: 999, items: "center", bg: mine ? INK : GROUND, borderWidth: 1, borderColor: mine ? INK : LINE, cursor: "pointer", children: _jsx(Text, { fontSize: 11, lineHeight: 15, color: mine ? 'var(--background)' : INK, children: `#${ch.name}` }) }, ch.id));
303
- }) })] })) : null] }), slackNote ? (_jsx(Text, { fontSize: 11, lineHeight: 16, color: DIM, px: 4, children: slackNote })) : null] }), _jsxs(YStack, { gap: 8, "data-parity-key": "bots.panel.computer", children: [_jsx(Text, { ...LABEL, px: 4, children: t('Desktop Computer') }), _jsxs(XStack, { ...CARD, render: "button", type: 'button', onClick: () => setComputerOpen(true), "aria-label": t('Open {name}’s desktop computer', { name: displayName }), minH: 60, px: 13, py: 10, items: "center", gap: 12, cursor: "pointer", hoverStyle: { bg: PICKED }, children: [_jsxs(YStack, { flex: 1, minW: 0, items: "flex-start", children: [_jsx(Text, { ...CLIP, fontSize: 14, lineHeight: 19, color: INK, children: t("Bot's computer") }), _jsx(Text, { ...CLIP, fontSize: 12, lineHeight: 17, color: DIM, children: stateLabel(box, t) })] }), _jsx(ComputerScreen, { awake: box?.status === 'running' })] })] }), cron || answers.length ? (_jsxs(YStack, { gap: 8, "data-parity-key": "bots.panel.upcoming", children: [_jsx(Text, { ...LABEL, px: 4, children: t('Upcoming') }), cron ? (_jsx(YStack, { ...CARD, children: _jsx(Row, { mark: _jsx(Clock, { size: 16, color: DIM, "aria-hidden": true }), title: routine, line: scheduleLine, last: true, children: _jsx(Switch, { "aria-label": t('Run {name} on its schedule', { name: displayName }), checked: activeSchedule, disabled: saving, onCheckedChange: (on) => {
304
- setWrong(null);
305
- setSaving(true);
306
- onSchedule(on, cron === 'paused' ? '0 9 * * *' : cron)
307
- .catch((e) => setWrong(say(e, t('{name}’s schedule', { name: displayName }), 'save', t)))
308
- .finally(() => setSaving(false));
309
- } }) }) })) : null, answers.length ? (_jsx(YStack, { ...CARD, "data-parity-key": "bots.panel.networks", children: answers.map((id, i) => (_jsx(Row, { mark: _jsx(Network, { transport: id, size: 18 }), title: of(id).name, line: t('Connected'), last: i === answers.length - 1, children: _jsx(ChevronRight, { size: 15, color: DIM, "aria-hidden": true }) }, id))) })) : null] })) : null, _jsxs(YStack, { gap: 8, "data-parity-key": "bots.panel.connectors", children: [_jsxs(XStack, { items: "center", justify: "space-between", px: 4, children: [_jsx(Text, { ...LABEL, children: t('Connectors') }), _jsxs(XStack, { render: "button", type: 'button', onClick: () => setConnectorsOpen(true), items: "center", gap: 3, px: 6, py: 2, rounded: 6, bg: "transparent", borderWidth: 0, cursor: "pointer", hoverStyle: { bg: PICKED }, children: [_jsx(Plus, { size: 12, color: DIM, "aria-hidden": true }), _jsx(Text, { fontSize: 12, lineHeight: 16, color: DIM, children: t('Add') })] })] }), _jsxs(XStack, { ...CARD, render: "button", type: 'button', onClick: () => setConnectorsOpen(true), minH: 50, px: 13, py: 9, items: "center", justify: "space-between", gap: 10, cursor: "pointer", hoverStyle: { bg: PICKED }, children: [_jsxs(YStack, { flex: 1, minW: 0, items: "flex-start", children: [_jsx(Text, { ...CLIP, fontSize: 14, lineHeight: 19, color: INK, children: answers.length ? t('{n} channels connected', { n: answers.length }) : t('Connect Slack, GitHub, Linear, Stripe…') }), _jsx(Text, { ...CLIP, fontSize: 12, lineHeight: 17, color: DIM, children: t('External apps, socials & MCP tools') })] }), _jsx(ChevronRight, { size: 15, color: DIM, "aria-hidden": true })] })] }), _jsxs(YStack, { gap: 8, "data-parity-key": "bots.panel.voice", children: [_jsx(Text, { ...LABEL, px: 4, children: t('Voice chat') }), _jsxs(YStack, { ...CARD, children: [_jsx(VoiceRow, { label: t('Voice'), value: voiceName, options: VOICES, onSelect: setVoiceName }), _jsx(VoiceRow, { label: t('Speed'), value: voiceSpeed, options: SPEEDS, onSelect: setVoiceSpeed }), _jsx(VoiceRow, { label: t('Language'), value: voiceLang, options: LANGUAGES, onSelect: setVoiceLang, last: true })] })] }), wrong ? (_jsx(Text, { render: "p", role: "alert", px: 8, m: 0, fontSize: 13, lineHeight: 18, color: DIM, children: wrong })) : null, !isPrimary ? (_jsx(XStack, { px: 8, pt: 4, children: _jsx(Text, { render: "button", type: 'button', onClick: () => setDeleting(true), bg: "transparent", borderWidth: 0, p: 0, cursor: "pointer", fontSize: 13, lineHeight: 18, color: DIM, hoverStyle: { color: INK }, children: t('Delete {name}', { name: displayName }) }) })) : null] })) : (_jsx(YStack, { px: 15, pb: 24, gap: 12, "data-parity-key": "bots.panel.library", children: libraryItems.length ? (_jsx(YStack, { ...CARD, children: libraryItems.map((item, i) => (_jsx(Row, { mark: item.kind === 'doc' ? _jsx(FileText, { size: 16, color: DIM, "aria-hidden": true }) : _jsx(ImageIcon, { size: 16, color: DIM, "aria-hidden": true }), title: item.label, line: item.sub, last: i === libraryItems.length - 1, children: item.href ? _jsx(ChevronRight, { size: 15, color: DIM, "aria-hidden": true }) : null }, item.key))) })) : (_jsx(YStack, { ...CARD, px: 14, py: 16, items: "center", children: _jsx(Text, { fontSize: 13, lineHeight: 19, color: DIM, text: "center", children: t('Files, documents, and images shared with {name} appear here.', { name: displayName }) }) })) })), _jsx(Dialog, { open: deleting, onOpenChange: setDeleting, children: _jsxs(DialogContent, { maxW: 440, rounded: 20, gap: 14, children: [_jsx(DialogTitle, { children: t('Delete {name}?', { name: displayName }) }), _jsx(Text, { fontSize: 15, lineHeight: 22, color: DIM, children: t('{name} and every message it was sent are deleted for good.', { name: displayName }) }), _jsxs(XStack, { gap: 8, justify: "flex-end", children: [_jsx(Button, { size: "sm", variant: "outline", rounded: 999, onPress: () => setDeleting(false), children: t('Cancel') }), _jsx(XStack, { ...PILL, height: 34, bg: INK, borderColor: INK, hoverStyle: { bg: INK, opacity: 0.9 }, onClick: () => {
479
+ }) })] })) : null] }), slackNote ? (_jsx(Text, { fontSize: 11, lineHeight: 16, color: DIM, px: 4, children: slackNote })) : null] }), answers.length ? (_jsxs(YStack, { gap: 8, "data-parity-key": "bots.panel.networks", children: [_jsx(Text, { ...LABEL, px: 4, children: t('Connected Channels') }), _jsx(YStack, { ...CARD, children: answers.map((id, i) => (_jsx(Row, { mark: _jsx(Network, { transport: id, size: 18 }), title: of(id).name, line: t('Connected'), last: i === answers.length - 1, children: _jsx(ChevronRight, { size: 15, color: DIM, "aria-hidden": true }) }, id))) })] })) : null, _jsxs(YStack, { gap: 8, "data-parity-key": "bots.panel.connectors", children: [_jsxs(XStack, { items: "center", justify: "space-between", px: 4, children: [_jsx(Text, { ...LABEL, children: t('Connectors') }), _jsxs(XStack, { render: "button", type: 'button', onClick: () => setConnectorsOpen(true), items: "center", gap: 3, px: 6, py: 2, rounded: 6, bg: "transparent", borderWidth: 0, cursor: "pointer", hoverStyle: { bg: PICKED }, children: [_jsx(Plus, { size: 12, color: DIM, "aria-hidden": true }), _jsx(Text, { fontSize: 12, lineHeight: 16, color: DIM, children: t('Add') })] })] }), _jsxs(XStack, { ...CARD, render: "button", type: 'button', onClick: () => setConnectorsOpen(true), minH: 50, px: 13, py: 9, items: "center", justify: "space-between", gap: 10, cursor: "pointer", hoverStyle: { bg: PICKED }, children: [_jsxs(YStack, { flex: 1, minW: 0, items: "flex-start", children: [_jsx(Text, { ...CLIP, fontSize: 14, lineHeight: 19, color: INK, children: answers.length ? t('{n} channels connected', { n: answers.length }) : t('Connect Slack, GitHub, Linear, Stripe…') }), _jsx(Text, { ...CLIP, fontSize: 12, lineHeight: 17, color: DIM, children: t('External apps, socials & MCP tools') })] }), _jsx(ChevronRight, { size: 15, color: DIM, "aria-hidden": true })] })] }), _jsxs(YStack, { gap: 8, "data-parity-key": "bots.panel.voice", children: [_jsx(Text, { ...LABEL, px: 4, children: t('Voice chat') }), _jsxs(YStack, { ...CARD, children: [_jsx(VoiceRow, { label: t('Voice'), value: voiceName, options: VOICES, onSelect: setVoiceName }), _jsx(VoiceRow, { label: t('Speed'), value: voiceSpeed, options: SPEEDS, onSelect: setVoiceSpeed }), _jsx(VoiceRow, { label: t('Language'), value: voiceLang, options: LANGUAGES, onSelect: setVoiceLang, last: true })] })] }), wrong ? (_jsx(Text, { render: "p", role: "alert", px: 8, m: 0, fontSize: 13, lineHeight: 18, color: DIM, children: wrong })) : null, !isPrimary ? (_jsx(XStack, { px: 8, pt: 4, children: _jsx(Text, { render: "button", type: 'button', onClick: () => setDeleting(true), bg: "transparent", borderWidth: 0, p: 0, cursor: "pointer", fontSize: 13, lineHeight: 18, color: DIM, hoverStyle: { color: INK }, children: t('Delete {name}', { name: displayName }) }) })) : null] })) : (_jsx(YStack, { px: 15, pb: 24, gap: 12, "data-parity-key": "bots.panel.library", children: libraryItems.length ? (_jsx(YStack, { ...CARD, children: libraryItems.map((item, i) => (_jsx(Row, { mark: item.kind === 'doc' ? _jsx(FileText, { size: 16, color: DIM, "aria-hidden": true }) : _jsx(ImageIcon, { size: 16, color: DIM, "aria-hidden": true }), title: item.label, line: item.sub, last: i === libraryItems.length - 1, children: item.href ? _jsx(ChevronRight, { size: 15, color: DIM, "aria-hidden": true }) : null }, item.key))) })) : (_jsx(YStack, { ...CARD, px: 14, py: 16, items: "center", children: _jsx(Text, { fontSize: 13, lineHeight: 19, color: DIM, text: "center", children: t('Files, documents, and images shared with {name} appear here.', { name: displayName }) }) })) })), _jsx(Dialog, { open: autoModalOpen, onOpenChange: setAutoModalOpen, children: _jsx(DialogContent, { "data-parity-key": "bots.automations.dialog", width: "calc(100vw - 32px)", maxW: 540, p: 0, showCloseButton: false, bg: GROUND, borderWidth: 1, borderColor: LINE, rounded: 18, overflow: "hidden", children: _jsxs(YStack, { p: 20, gap: 14, bg: GROUND, children: [_jsxs(XStack, { items: "center", justify: "space-between", gap: 10, children: [_jsx(DialogTitle, { children: _jsx(Text, { fontSize: 18, lineHeight: 24, fontWeight: "600", color: INK, children: t('New Automation for {name}', { name: displayName }) }) }), _jsx(XStack, { ...ROUND, width: 30, height: 30, "aria-label": t('Close'), onClick: () => setAutoModalOpen(false), children: _jsx(X, { size: 15, color: INK, "aria-hidden": true }) })] }), _jsx(XStack, { p: 3, rounded: 999, bg: RAISED, borderWidth: 1, borderColor: LINE, gap: 2, children: [
480
+ { id: 'schedule', label: t('Scheduled (Cron / Time)'), Icon: Clock },
481
+ { id: 'event', label: t('Event-Driven (Webhook / App)'), Icon: Zap },
482
+ ].map(({ id, label, Icon }) => {
483
+ const active = autoMode === id;
484
+ return (_jsxs(XStack, { render: "button", type: 'button', onClick: () => setAutoMode(id), flex: 1, height: 32, gap: 6, rounded: 999, items: "center", justify: "center", bg: active ? PICKED : 'transparent', borderWidth: 0, cursor: "pointer", children: [_jsx(Icon, { size: 13, color: active ? INK : DIM, "aria-hidden": true }), _jsx(Text, { fontSize: 12, lineHeight: 16, fontWeight: active ? '600' : '400', color: active ? INK : DIM, children: label })] }, id));
485
+ }) }), _jsxs(YStack, { render: "form", onSubmit: submitAutomation, gap: 12, children: [_jsx(Input, { unstyled: true, value: autoName, onChange: (e) => setAutoName(e.target.value), placeholder: autoMode === 'schedule'
486
+ ? t('Name (e.g., Daily Hanzo leadership update)')
487
+ : t('Name (e.g., Triage new GitHub pull requests)'), "aria-label": t('Automation name'), width: "100%", px: 13, py: 10, rounded: 10, bg: RAISED, borderWidth: 1, borderColor: LINE, color: INK, fontSize: 14, placeholderTextColor: "$placeholderColor" }), autoMode === 'schedule' ? (_jsxs(YStack, { gap: 8, children: [_jsx(XStack, { flexWrap: "wrap", gap: 6, children: SCHEDULE_PRESETS.map((p) => {
488
+ const active = autoPreset === p.id && !autoCustomWhen.trim();
489
+ return (_jsx(XStack, { render: "button", type: 'button', onClick: () => {
490
+ setAutoPreset(p.id);
491
+ setAutoCustomWhen('');
492
+ }, height: 28, px: 11, rounded: 999, items: "center", bg: active ? INK : RAISED, borderWidth: 1, borderColor: active ? INK : LINE, cursor: "pointer", children: _jsx(Text, { fontSize: 12, lineHeight: 16, color: active ? 'var(--background)' : INK, children: t(p.label) }) }, p.id));
493
+ }) }), _jsx(Input, { unstyled: true, value: autoCustomWhen, onChange: (e) => setAutoCustomWhen(e.target.value), placeholder: t('Or type any schedule in plain English (e.g., "Fridays at 4pm" or "every 2 hours")'), "aria-label": t('Natural language schedule'), width: "100%", px: 13, py: 9, rounded: 10, bg: RAISED, borderWidth: 1, borderColor: LINE, color: INK, fontSize: 13, placeholderTextColor: "$placeholderColor" })] })) : (_jsxs(YStack, { gap: 8, children: [_jsx(XStack, { flexWrap: "wrap", gap: 6, children: EVENT_TRIGGERS.map((ev) => {
494
+ const active = autoEventId === ev.id;
495
+ return (_jsx(XStack, { render: "button", type: 'button', onClick: () => setAutoEventId(ev.id), height: 28, px: 11, rounded: 999, items: "center", bg: active ? INK : RAISED, borderWidth: 1, borderColor: active ? INK : LINE, cursor: "pointer", children: _jsx(Text, { fontSize: 12, lineHeight: 16, color: active ? 'var(--background)' : INK, children: t(ev.label) }) }, ev.id));
496
+ }) }), _jsxs(YStack, { px: 12, py: 8, rounded: 10, bg: FLOOR, borderWidth: 1, borderColor: LINE, gap: 3, children: [_jsx(Text, { fontSize: 12, lineHeight: 16, color: INK, children: t(selectedEventDef.hint) }), _jsx(Text, { fontSize: 11, lineHeight: 15, color: DIM, children: `POST ${api()}/v1/auto/hooks/${selectedEventDef.source}/${selectedEventDef.name}` })] })] })), _jsx(Input, { unstyled: true, render: "textarea", rows: 4, value: autoInstructions, onChange: (e) => setAutoInstructions(e.target.value), placeholder: t('Instructions for {name}: what to check, which tools or desktop browser logins to use, and where to post the result…', { name: displayName }), "aria-label": t('Automation instructions'), width: "100%", px: 13, py: 10, rounded: 10, bg: RAISED, borderWidth: 1, borderColor: LINE, color: INK, fontSize: 14, placeholderTextColor: "$placeholderColor" }), _jsxs(XStack, { justify: "flex-end", gap: 8, pt: 4, children: [_jsx(XStack, { ...PILL, onClick: () => setAutoModalOpen(false), children: _jsx(Text, { ...WORD, children: t('Cancel') }) }), _jsx(XStack, { ...PILL, type: 'submit', bg: INK, borderColor: INK, disabled: autoBusy || !autoName.trim() || !autoInstructions.trim(), opacity: autoBusy || !autoName.trim() || !autoInstructions.trim() ? 0.5 : 1, children: _jsx(Text, { ...WORD, color: "var(--background)", children: autoBusy ? t('Saving…') : t('Create Automation') }) })] })] })] }) }) }), _jsx(Dialog, { open: deleting, onOpenChange: setDeleting, children: _jsxs(DialogContent, { maxW: 440, rounded: 20, gap: 14, children: [_jsx(DialogTitle, { children: t('Delete {name}?', { name: displayName }) }), _jsx(Text, { fontSize: 15, lineHeight: 22, color: DIM, children: t('{name} and every message it was sent are deleted for good.', { name: displayName }) }), _jsxs(XStack, { gap: 8, justify: "flex-end", children: [_jsx(Button, { size: "sm", variant: "outline", rounded: 999, onPress: () => setDeleting(false), children: t('Cancel') }), _jsx(XStack, { ...PILL, height: 34, bg: INK, borderColor: INK, hoverStyle: { bg: INK, opacity: 0.9 }, onClick: () => {
310
497
  if (!deleting)
311
498
  return;
312
499
  setDeleting(false);
@@ -314,5 +501,5 @@ export function Panel({ bot, groups = [], runs = [], onClose, kept, onSchedule,
314
501
  }, children: _jsx(Text, { ...WORD, color: "var(--background)", children: t('Delete') }) })] })] }) }), _jsx(ComputerDialog, { open: computerOpen, onOpenChange: setComputerOpen, bot: ext, box: box, onUpdated: async () => {
315
502
  await survey();
316
503
  await onBotChanged?.();
317
- } }), _jsx(ConnectorsDialog, { open: connectorsOpen, onOpenChange: setConnectorsOpen, defaultFilter: "all", onConnected: () => void survey() })] }));
504
+ } }), _jsx(ConnectorsDialog, { open: connectorsOpen, onOpenChange: setConnectorsOpen, defaultFilter: "all", onConnected: () => void survey() }), _jsx(VaultDialog, { open: vaultOpen, onOpenChange: setVaultOpen, onChanged: (doc) => setVaultDoc(doc) })] }));
318
505
  }
@@ -1,4 +1,4 @@
1
- import type { Agent } from '@hanzo/ai';
1
+ import type { Agent, Sandbox } from '@hanzo/ai';
2
2
  import type { useAi } from '../lib/ai.js';
3
3
  export type Client = NonNullable<ReturnType<typeof useAi>['client']>;
4
4
  /** The platform's word for a bot that runs on its own schedule. */
@@ -101,7 +101,7 @@ export interface Draft {
101
101
  }
102
102
  /**
103
103
  * Makes a bot with full tool access (`tools: ['*']`) — including Desktop Sandbox
104
- * Computer Use (`computer_in_sandbox`), bash/files, Connectors, and Bot Coordination.
104
+ * Computer Use (`computer_in_sandbox`), bash/files, Connectors, KMS Autofill, and Bot Coordination.
105
105
  */
106
106
  export declare const make: (c: Client, d: Draft) => Promise<BotAgent>;
107
107
  /**
@@ -178,10 +178,25 @@ export interface Grant {
178
178
  expiresIn?: number;
179
179
  }
180
180
  export declare const grant: (c: Client, id: string, kind: 'terminal' | 'screen') => Promise<Grant>;
181
- export declare const parkComputer: (c: Client, id: string) => Promise<unknown>;
181
+ /**
182
+ * Finds the bot's existing desktop sandbox across both named project disks (`bot-<name>`)
183
+ * and Free-tier persistent `disk: true` sandboxes bound via `bot.computeRef`.
184
+ */
185
+ export declare function findBotComputer(c: Client, bot: BotAgent, signal?: AbortSignal): Promise<Sandbox | null>;
186
+ /**
187
+ * Boots or resumes the bot's persistent Desktop Sandbox Computer:
188
+ * 1. If a parked/existing sandbox id is known (`existing?.id` or `bot.computeRef`), resumes it in place.
189
+ * 2. Otherwise leases `{ class: 'desktop', project: 'bot-<name>', disk: true }`.
190
+ * 3. On `402` or `409` (e.g., Free-tier $0 account where named project volumes require balance),
191
+ * seamlessly falls back to `{ class: 'desktop', disk: true }` (admitted on the Free daily allowance
192
+ * with a persistent 2 GiB resumable disk!).
193
+ */
194
+ export declare function bootOrResumeComputer(c: Client, bot: BotAgent, existing?: Sandbox | null): Promise<Sandbox>;
195
+ /** Parks a running desktop sandbox while preserving its persistent home volume (`disk: true`). */
196
+ export declare function parkComputer(c: Client, id: string): Promise<void>;
182
197
  export interface ComputerActionIn {
183
198
  id: string;
184
- action: 'screenshot' | 'click' | 'double_click' | 'right_click' | 'middle_click' | 'move' | 'drag' | 'scroll' | 'type' | 'key' | 'navigate' | 'wait' | 'shell';
199
+ action: 'screenshot' | 'click' | 'double_click' | 'right_click' | 'middle_click' | 'move' | 'drag' | 'scroll' | 'type' | 'key' | 'navigate' | 'wait' | 'shell' | 'autofill';
185
200
  x?: number;
186
201
  y?: number;
187
202
  toX?: number;
@@ -193,6 +208,9 @@ export interface ComputerActionIn {
193
208
  url?: string;
194
209
  command?: string;
195
210
  ms?: number;
211
+ credential?: string;
212
+ field?: 'login' | 'username' | 'password' | 'totp' | 'secret';
213
+ submit?: boolean;
196
214
  }
197
215
  export interface ComputerActionOut {
198
216
  action: string;
@@ -205,3 +223,55 @@ export interface ComputerActionOut {
205
223
  height?: number;
206
224
  }
207
225
  export declare const actComputer: (c: Client, body: ComputerActionIn) => Promise<ComputerActionOut>;
226
+ export interface AutomationSchedule {
227
+ kind: 'manual' | 'hourly' | 'daily' | 'weekdays' | 'weekly' | 'cron' | 'once';
228
+ at?: string;
229
+ day?: string;
230
+ cron?: string;
231
+ tz?: string;
232
+ }
233
+ export interface AutomationEventTrigger {
234
+ source: string;
235
+ name: string;
236
+ }
237
+ export interface BotAutomation {
238
+ id: string;
239
+ name: string;
240
+ instructions: string;
241
+ schedule: AutomationSchedule;
242
+ event?: AutomationEventTrigger | null;
243
+ permissions: 'auto' | 'ask';
244
+ notify: boolean;
245
+ enabled: boolean;
246
+ source: string;
247
+ next?: string | null;
248
+ last?: {
249
+ id: string;
250
+ status: string;
251
+ at: string;
252
+ summary: string;
253
+ } | null;
254
+ created: string;
255
+ updated: string;
256
+ }
257
+ export declare function listBotAutomations(c: Client, botName?: string, signal?: AbortSignal): Promise<BotAutomation[]>;
258
+ export declare function parseAutomationWhen(c: Client, phrase: string, tz?: string): Promise<AutomationSchedule | null>;
259
+ export interface CreateBotAutomationIn {
260
+ botName: string;
261
+ name: string;
262
+ instructions: string;
263
+ mode: 'schedule' | 'event';
264
+ schedule?: AutomationSchedule;
265
+ event?: AutomationEventTrigger;
266
+ model?: string;
267
+ notify?: boolean;
268
+ }
269
+ export declare function createBotAutomation(c: Client, input: CreateBotAutomationIn): Promise<BotAutomation>;
270
+ export declare const toggleBotAutomation: (c: Client, id: string, enabled: boolean) => Promise<BotAutomation>;
271
+ export declare const runBotAutomation: (c: Client, id: string) => Promise<{
272
+ run: {
273
+ id: string;
274
+ status: string;
275
+ };
276
+ }>;
277
+ export declare const deleteBotAutomation: (c: Client, id: string) => Promise<unknown>;