@hanzo/app 0.3.65 → 0.3.68

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.
@@ -0,0 +1,5 @@
1
+ import type { Agent } from '@hanzo/ai';
2
+ export declare function Make({ onDone, onCancel }: {
3
+ onDone: (a: Agent) => void | Promise<void>;
4
+ onCancel: () => void;
5
+ }): import("react").JSX.Element;
@@ -0,0 +1,60 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ // Making a bot: a name, what it does, and what it may spend a week.
4
+ //
5
+ // The platform keeps every bot on a budget and refuses one without it, so the
6
+ // budget is asked for here rather than chosen silently. Whatever the platform
7
+ // refuses — a name already taken, a model it does not serve — is shown in its
8
+ // own words.
9
+ import { useState } from 'react';
10
+ import { useI18n } from '@hanzo/i18n/react';
11
+ import { Input, Text, XStack, YStack } from '@hanzo/gui';
12
+ import { Dialog, DialogContent, DialogTitle } from '@hanzo/ui';
13
+ import { ENSO, useAi } from '../lib/ai.js';
14
+ import { plainly } from '../failure.js';
15
+ import { NAME, make } from './api.js';
16
+ import { PILL, WORD } from './kit.js';
17
+ import { DIM, INK, LINE, RAISED } from './ink.js';
18
+ const FIELD = {
19
+ unstyled: true,
20
+ width: '100%',
21
+ px: 14,
22
+ py: 10,
23
+ rounded: 12,
24
+ bg: RAISED,
25
+ borderWidth: 1,
26
+ borderColor: LINE,
27
+ color: INK,
28
+ fontSize: 15,
29
+ placeholderTextColor: '$placeholderColor',
30
+ };
31
+ export function Make({ onDone, onCancel }) {
32
+ const { t } = useI18n();
33
+ const { client } = useAi();
34
+ const [name, setName] = useState('');
35
+ const [does, setDoes] = useState('');
36
+ const [weekly, setWeekly] = useState('10');
37
+ const [busy, setBusy] = useState(false);
38
+ const [wrong, setWrong] = useState(null);
39
+ const dollars = Number(weekly);
40
+ const named = NAME.test(name.trim());
41
+ // Up to ten thousand dollars a week: a cap is a guard, and past it a typo is a fortune.
42
+ const ok = named && Number.isInteger(dollars) && dollars > 0 && dollars <= 10_000 && !busy;
43
+ const submit = async (e) => {
44
+ e.preventDefault();
45
+ if (!client || !ok)
46
+ return;
47
+ setBusy(true);
48
+ setWrong(null);
49
+ try {
50
+ await onDone(await make(client, { name: name.trim(), instructions: does.trim(), model: ENSO, weekly: dollars }));
51
+ }
52
+ catch (err) {
53
+ setWrong(plainly(err, t('this bot'), t));
54
+ }
55
+ finally {
56
+ setBusy(false);
57
+ }
58
+ };
59
+ return (_jsx(Dialog, { open: true, onOpenChange: (v) => (v ? undefined : onCancel()), children: _jsxs(DialogContent, { "data-parity-key": "bots.make", width: "calc(100vw - 32px)", maxW: 440, bg: "var(--popover)", rounded: 20, p: 20, gap: 14, borderWidth: 1, borderColor: LINE, children: [_jsx(DialogTitle, { fontSize: 18, lineHeight: 24, fontWeight: "500", color: "$ink", children: t('New bot') }), _jsxs(YStack, { render: "form", onSubmit: submit, gap: 12, children: [_jsx(Input, { ...FIELD, autoFocus: true, value: name, onChange: (e) => setName(e.target.value), placeholder: t('Name'), "aria-label": t('Bot name') }), name.trim() && !named ? (_jsx(Text, { fontSize: 13, lineHeight: 18, color: DIM, px: 4, children: t('Letters, digits, dot, dash and underscore; it starts with a letter or a digit.') })) : null, _jsx(Input, { ...FIELD, render: "textarea", rows: 4, value: does, onChange: (e) => setDoes(e.target.value), placeholder: t('What it does'), "aria-label": t('What it does') }), _jsxs(XStack, { items: "center", gap: 10, px: 4, children: [_jsx(Text, { fontSize: 15, lineHeight: 20, color: DIM, children: t('Spend up to $') }), _jsx(Input, { ...FIELD, width: 88, py: 8, inputMode: "numeric", value: weekly, onChange: (e) => setWeekly(e.target.value.replace(/[^\d]/g, '')), "aria-label": t('Weekly budget in US dollars') }), _jsx(Text, { fontSize: 15, lineHeight: 20, color: DIM, children: t('a week') })] }), wrong ? (_jsx(Text, { role: "alert", fontSize: 13, lineHeight: 18, color: DIM, px: 4, children: wrong })) : null, _jsxs(XStack, { justify: "flex-end", gap: 8, pt: 4, children: [_jsx(XStack, { ...PILL, onClick: onCancel, children: _jsx(Text, { ...WORD, children: t('Cancel') }) }), _jsx(XStack, { ...PILL, type: 'submit', disabled: !ok, opacity: ok ? 1 : 0.5, bg: INK, borderColor: INK, hoverStyle: { bg: INK, opacity: 0.9 }, children: _jsx(Text, { ...WORD, color: "var(--background)", children: t(busy ? 'Making…' : 'Make bot') }) })] })] })] }) }));
60
+ }
@@ -0,0 +1,11 @@
1
+ import type { Agent } from '@hanzo/ai';
2
+ export declare function Panel({ bot, onClose, kept, onSchedule, onDelete, focus, }: {
3
+ bot: Agent;
4
+ /** The schedule this page last saw for the bot, kept by the app across panels. */
5
+ kept: string;
6
+ onClose: () => void;
7
+ onSchedule: (on: boolean, cron: string) => Promise<void>;
8
+ onDelete: () => Promise<void>;
9
+ /** Over the thread: the close control takes the focus, so Escape and Tab start here. */
10
+ focus?: boolean;
11
+ }): import("react").JSX.Element;
@@ -0,0 +1,149 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ // What the open bot has: its face and name, then each thing the platform holds
4
+ // for it — its schedule, the networks it answers on, its computer. A section
5
+ // with nothing behind it is not drawn, so a new bot's panel is its face alone.
6
+ import { useCallback, useEffect, useState } from 'react';
7
+ import { useI18n } from '@hanzo/i18n/react';
8
+ import { Text, XStack, YStack } from '@hanzo/gui';
9
+ import { Button, Dialog, DialogContent, DialogTitle, Switch } from '@hanzo/ui';
10
+ import { Clock, X } from 'lucide-react';
11
+ import { useAi } from '../lib/ai.js';
12
+ import { say } from '../failure.js';
13
+ import { Network, of } from '../network.js';
14
+ import { Face } from './face.js';
15
+ import { ALWAYS, answering, disk, grant } from './api.js';
16
+ import { CARD, CLIP, LABEL, PILL, ROUND, WORD } from './kit.js';
17
+ import { DIM, INK, LINE } from './ink.js';
18
+ import { cron as words } from './time.js';
19
+ /** One row of a card: a mark, two lines, and whatever acts on it. */
20
+ function Row({ mark, title, line, children, last }) {
21
+ return (_jsxs(XStack, { minH: 48, px: 12, py: 8, gap: 10, items: "center", borderBottomWidth: last ? 0 : 1, borderColor: LINE, children: [mark, _jsxs(YStack, { flex: 1, minW: 0, children: [_jsx(Text, { ...CLIP, fontSize: 13, lineHeight: 18, color: INK, children: title }), line ? (_jsx(Text, { ...CLIP, fontSize: 13, lineHeight: 18, color: DIM, children: line })) : null] }), children] }));
22
+ }
23
+ /** A computer's state as a person reads it. No lease is a computer asleep. */
24
+ function state(box, t) {
25
+ if (!box)
26
+ return t('Asleep');
27
+ if (box.status === 'running')
28
+ return t('Awake');
29
+ if (box.status === 'pending')
30
+ return t('Waking');
31
+ return box.error || t('Stopped');
32
+ }
33
+ /** The computer to draw: a running one first, then one waking, then any. */
34
+ const best = (boxes) => boxes.find((b) => b.status === 'running') ?? boxes.find((b) => b.status === 'pending') ?? boxes[0] ?? null;
35
+ /** How often a waking computer is asked whether it is awake. */
36
+ const POLL = 5000;
37
+ export function Panel({ bot, onClose, kept, onSchedule, onDelete, focus = false, }) {
38
+ const { t, locale } = useI18n();
39
+ const { client } = useAi();
40
+ const [instructions, setInstructions] = useState('');
41
+ const [answers, setAnswers] = useState([]);
42
+ const [box, setBox] = useState(null);
43
+ const [boxed, setBoxed] = useState(false);
44
+ const [busy, setBusy] = useState(false);
45
+ const [saving, setSaving] = useState(false);
46
+ const [wrong, setWrong] = useState(null);
47
+ const [deleting, setDeleting] = useState(false);
48
+ // The schedule on the record, else the one this page last saw for the bot (the
49
+ // platform keeps none for a bot that runs only when asked).
50
+ const cron = bot.schedule || kept;
51
+ const survey = useCallback(async (signal) => {
52
+ if (!client)
53
+ return;
54
+ const opts = signal ? { signal } : undefined;
55
+ const [detail, nets, boxes] = await Promise.allSettled([
56
+ client.agents.get(bot.name, opts),
57
+ client.transports.list(opts),
58
+ client.sandboxes.list({ project: disk(bot.name) }, opts),
59
+ ]);
60
+ if (signal?.aborted)
61
+ return;
62
+ if (detail.status === 'fulfilled')
63
+ setInstructions(detail.value.instructions ?? '');
64
+ if (boxes.status === 'fulfilled') {
65
+ setBox(best(boxes.value));
66
+ setBoxed(true);
67
+ }
68
+ if (nets.status === 'fulfilled') {
69
+ const connected = nets.value.filter((n) => n.connected);
70
+ const bound = await Promise.allSettled(connected.map((n) => answering(client, n.id, signal)));
71
+ if (signal?.aborted)
72
+ return;
73
+ setAnswers(connected.filter((_, i) => {
74
+ const r = bound[i];
75
+ return r.status === 'fulfilled' && r.value.default === bot.name;
76
+ }).map((n) => n.id));
77
+ }
78
+ }, [client, bot.name]);
79
+ useEffect(() => {
80
+ const stop = new AbortController();
81
+ void survey(stop.signal);
82
+ return () => stop.abort();
83
+ }, [survey]);
84
+ // A waking computer is asked again until it is awake or says why it is not.
85
+ useEffect(() => {
86
+ if (!client || box?.status !== 'pending')
87
+ return;
88
+ const stop = new AbortController();
89
+ const tick = window.setInterval(() => {
90
+ client.sandboxes
91
+ .list({ project: disk(bot.name) }, { signal: stop.signal })
92
+ .then((boxes) => setBox(best(boxes)))
93
+ .catch(() => undefined);
94
+ }, POLL);
95
+ return () => {
96
+ window.clearInterval(tick);
97
+ stop.abort();
98
+ };
99
+ }, [client, box?.status, bot.name]);
100
+ /**
101
+ * Asleep, a press wakes it; awake, a press opens its screen in a new tab. The
102
+ * tab is opened inside the press, before the grant answers, because a browser
103
+ * allows a new window only from the press itself.
104
+ */
105
+ const computer = async () => {
106
+ if (!client || busy)
107
+ return;
108
+ setBusy(true);
109
+ setWrong(null);
110
+ const tab = box?.status === 'running' ? window.open('', '_blank') : null;
111
+ try {
112
+ if (box?.status === 'running') {
113
+ const g = await grant(client, box.id, box.class === 'desktop' ? 'screen' : 'terminal');
114
+ if (!tab)
115
+ return setWrong(t('The browser kept the new tab from opening.'));
116
+ if (!g.url?.startsWith('https://')) {
117
+ tab.close();
118
+ return setWrong(t('The platform opened no window onto it.'));
119
+ }
120
+ tab.opener = null;
121
+ tab.location.href = g.url;
122
+ }
123
+ else if (!box || box.status === 'error') {
124
+ await client.sandboxes.lease({ class: 'desktop', project: disk(bot.name) });
125
+ await survey();
126
+ }
127
+ }
128
+ catch (e) {
129
+ tab?.close();
130
+ setWrong(say(e, t('{name}’s computer', { name: bot.name }), 'save', t));
131
+ }
132
+ finally {
133
+ setBusy(false);
134
+ }
135
+ };
136
+ const routine = cron ? instructions.split('\n')[0].trim() || bot.description || bot.name : '';
137
+ return (_jsxs(YStack, { flex: 1, minH: 0, overflowY: "auto", overflowX: "hidden", "aria-label": bot.name, render: "aside", children: [_jsx(XStack, { height: 58, shrink: 0, px: 13, 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: 20, pt: 8, pb: 24, px: 15, children: [_jsx(Face, { bot: bot, size: 64 }), _jsx(Text, { ...CLIP, maxW: "100%", fontSize: 17, lineHeight: 22, fontWeight: "500", color: INK, children: bot.name })] }), _jsxs(YStack, { px: 15, pb: 24, gap: 20, children: [cron ? (_jsxs(YStack, { gap: 10, "data-parity-key": "bots.panel.upcoming", children: [_jsx(Text, { ...LABEL, px: 12, children: t('Upcoming') }), _jsx(YStack, { ...CARD, children: _jsx(Row, { mark: _jsx(Clock, { size: 16, color: DIM, "aria-hidden": true }), title: routine, line: words(cron, locale, t), last: true, children: _jsx(Switch, { "aria-label": t('Run {name} on its schedule', { name: bot.name }), checked: bot.executionMode === ALWAYS && Boolean(bot.schedule), disabled: saving, onCheckedChange: (on) => {
138
+ setWrong(null);
139
+ setSaving(true);
140
+ onSchedule(on, cron)
141
+ .catch((e) => setWrong(say(e, t('{name}’s schedule', { name: bot.name }), 'save', t)))
142
+ .finally(() => setSaving(false));
143
+ } }) }) })] })) : 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 }, id))) })) : null, boxed ? (_jsxs(YStack, { gap: 10, "data-parity-key": "bots.panel.computer", children: [_jsx(Text, { ...LABEL, px: 12, children: t('Computer') }), _jsx(XStack, { ...CARD, render: "button", type: 'button', onClick: computer, disabled: busy || box?.status === 'pending', "aria-label": t(box?.status === 'running' ? 'Open {name}’s computer' : 'Wake {name}’s computer', { name: bot.name }), minH: 60, px: 12, items: "center", gap: 10, cursor: "pointer", hoverStyle: { bg: 'var(--secondary)' }, children: _jsxs(YStack, { flex: 1, minW: 0, items: "flex-start", children: [_jsx(Text, { ...CLIP, fontSize: 13, lineHeight: 18, color: INK, children: t('{name}’s computer', { name: bot.name }) }), _jsx(Text, { ...CLIP, fontSize: 13, lineHeight: 18, color: DIM, children: busy ? t('Waking') : state(box, t) })] }) })] })) : null, wrong ? (_jsx(Text, { render: "p", role: "alert", px: 12, m: 0, fontSize: 13, lineHeight: 18, color: DIM, children: wrong })) : null, _jsx(XStack, { px: 12, pt: 8, 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: bot.name }) }) })] }), _jsx(Dialog, { open: deleting, onOpenChange: setDeleting, children: _jsxs(DialogContent, { maxW: 440, rounded: 20, gap: 14, children: [_jsx(DialogTitle, { children: t('Delete {name}?', { name: bot.name }) }), _jsx(Text, { fontSize: 15, lineHeight: 22, color: DIM, children: t('{name} and every message it was sent are deleted for good.', { name: bot.name }) }), _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: () => {
144
+ if (!deleting)
145
+ return;
146
+ setDeleting(false);
147
+ onDelete().catch((e) => setWrong(say(e, bot.name, 'save', t)));
148
+ }, children: _jsx(Text, { ...WORD, color: "var(--background)", children: t('Delete') }) })] })] }) })] }));
149
+ }
@@ -0,0 +1,11 @@
1
+ import type { Agent, AgentRun } from '@hanzo/ai';
2
+ export declare function Roster({ bots, last, open, unread, me, onPick, onMake, disabled, }: {
3
+ bots: Agent[] | null;
4
+ last: ReadonlyMap<string, AgentRun>;
5
+ open: string | null;
6
+ unread: string | null;
7
+ me: unknown;
8
+ onPick: (name: string) => void;
9
+ onMake: () => void;
10
+ disabled: boolean;
11
+ }): import("react").JSX.Element;
@@ -0,0 +1,50 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ // The roster: search and new at the top, the bots as a grid of faces, the rest
4
+ // as rows with the last thing each said, and the reader at the foot.
5
+ //
6
+ // The grid holds twelve, four rows of three, in the order the bots were made, so
7
+ // a face does not move once you know where it is. A bot past the twelfth is a
8
+ // row, newest conversation first, which is where a bot you are busy with is.
9
+ import { useMemo, useState } from 'react';
10
+ import { useI18n } from '@hanzo/i18n/react';
11
+ import { Input, Text, XStack, YStack } from '@hanzo/gui';
12
+ import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger, } from '@hanzo/ui';
13
+ import { BUSINESS_APPS } from '@hanzo/ui/product';
14
+ import { LayoutGrid, Plus, Search, X } from 'lucide-react';
15
+ import { useSignOut } from '../lib/signout.js';
16
+ import { Face } from './face.js';
17
+ import { CLIP, PILL, ROUND, WORD } from './kit.js';
18
+ import { DIM, INK, LINE, PICKED, RAISED } from './ink.js';
19
+ import { lastWord, split } from './grid.js';
20
+ export function Roster({ bots, last, open, unread, me, onPick, onMake, disabled, }) {
21
+ const { t } = useI18n();
22
+ const [seeking, setSeeking] = useState(false);
23
+ const [query, setQuery] = useState('');
24
+ const shown = useMemo(() => {
25
+ const q = query.trim().toLowerCase();
26
+ const all = bots ?? [];
27
+ return q ? all.filter((b) => b.name.toLowerCase().includes(q) || (b.description ?? '').toLowerCase().includes(q)) : all;
28
+ }, [bots, query]);
29
+ const { grid, rows } = useMemo(() => split(shown, last), [shown, last]);
30
+ return (_jsxs(YStack, { flex: 1, minH: 0, children: [_jsxs(XStack, { "data-parity-key": "bots.roster.bar", height: 58, shrink: 0, px: 16, items: "center", justify: "flex-end", gap: 11, children: [_jsx(XStack, { ...ROUND, "aria-label": t(seeking ? 'Close search' : 'Search bots'), "aria-pressed": seeking, onClick: () => {
31
+ setSeeking(!seeking);
32
+ setQuery('');
33
+ }, children: seeking ? _jsx(X, { size: 16, color: INK, "aria-hidden": true }) : _jsx(Search, { size: 16, color: INK, "aria-hidden": true }) }), _jsx(XStack, { ...ROUND, "aria-label": t('New bot'), onClick: onMake, disabled: disabled, opacity: disabled ? 0.5 : 1, children: _jsx(Plus, { size: 18, color: INK, "aria-hidden": true }) })] }), seeking ? (_jsx(XStack, { px: 12, pb: 10, shrink: 0, children: _jsx(Input, { unstyled: true, autoFocus: true, value: query, onChange: (e) => setQuery(e.target.value), placeholder: t('Search'), "aria-label": t('Search bots'), width: "100%", height: 36, px: 14, rounded: 999, bg: RAISED, borderWidth: 1, borderColor: LINE, color: INK, fontSize: 15, placeholderTextColor: "$placeholderColor" }) })) : null, _jsxs(YStack, { flex: 1, minH: 0, overflowY: "auto", overflowX: "hidden", children: [unread ? (_jsx(Text, { render: "p", px: 18, py: 10, fontSize: 13, lineHeight: 18, color: DIM, children: unread })) : null, bots && bots.length === 0 && !unread && !disabled ? (_jsxs(YStack, { display: "none", "$max-md": { display: 'flex' }, items: "center", gap: 16, pt: 160, px: 24, children: [_jsx(Text, { render: "h1", m: 0, fontSize: 22, lineHeight: 28, fontWeight: "500", color: INK, children: t('Make your first bot') }), _jsx(XStack, { ...PILL, onClick: onMake, children: _jsx(Text, { ...WORD, children: t('New bot') }) })] })) : null, grid.length ? (_jsx(XStack, { "data-parity-key": "bots.grid", role: "group", "aria-label": t('Bots'), flexWrap: "wrap", px: 11, pt: 11, columnGap: 3, rowGap: 13, "$max-md": { px: 12, columnGap: 0, justify: 'space-between' }, children: grid.map((b) => {
34
+ const here = b.name === open;
35
+ return (_jsxs(YStack, { render: "button", type: 'button', "data-parity-key": "bots.tile", "data-name": b.name, "aria-current": here, "aria-label": b.name, onClick: () => onPick(b.name), width: 83, height: 91, rounded: 12, items: "center", pt: 6, gap: 6, bg: here ? PICKED : 'transparent', borderWidth: 0, cursor: "pointer", hoverStyle: { bg: here ? PICKED : 'var(--muted)' }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: 'solid', outlineColor: '$outlineColor' }, "$max-md": { width: '33%' }, children: [_jsx(Face, { bot: b, size: 60 }), _jsx(Text, { ...CLIP, maxW: 77, fontSize: 13, lineHeight: 17, color: INK, children: b.name })] }, b.id || b.name));
36
+ }) })) : null, rows.length ? (_jsx(YStack, { "data-parity-key": "bots.rows", role: "group", "aria-label": t('More bots'), pt: 17, pb: 8, children: rows.map((b) => {
37
+ const here = b.name === open;
38
+ const word = lastWord(last.get(b.name)) || b.description || '';
39
+ return (_jsxs(XStack, { render: "button", type: 'button', "data-parity-key": "bots.row", "data-name": b.name, "aria-current": here, onClick: () => onPick(b.name), height: 58, mx: 6, px: 13, gap: 10, items: "center", rounded: 10, bg: here ? PICKED : 'transparent', borderWidth: 0, cursor: "pointer", hoverStyle: { bg: here ? PICKED : 'var(--muted)' }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: 'solid', outlineColor: '$outlineColor' }, children: [_jsx(Face, { bot: b, size: 36 }), _jsxs(YStack, { flex: 1, minW: 0, items: "flex-start", children: [_jsx(Text, { ...CLIP, maxW: "100%", fontSize: 15, lineHeight: 20, color: INK, children: b.name }), word ? (_jsx(Text, { ...CLIP, maxW: "100%", fontSize: 13, lineHeight: 18, color: DIM, children: word })) : null] })] }, b.id || b.name));
40
+ }) })) : null] }), _jsx(Foot, { me: me })] }));
41
+ }
42
+ /** You, at the foot: your account, and the other Hanzo apps a press away. */
43
+ function Foot({ me }) {
44
+ const { t } = useI18n();
45
+ const leave = useSignOut();
46
+ const name = me?.displayName || me?.name || '';
47
+ if (!me)
48
+ return null;
49
+ return (_jsxs(XStack, { "data-parity-key": "bots.me", height: 68, shrink: 0, px: 15, items: "center", gap: 10, children: [_jsxs(DropdownMenu, { placement: "top-start", offset: 8, children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsxs(XStack, { render: "button", type: 'button', "aria-label": t('Account: {name}', { name }), flex: 1, minW: 0, items: "center", gap: 10, bg: "transparent", borderWidth: 0, p: 0, cursor: "pointer", children: [_jsx(Face, { bot: { name, avatar: me.avatar }, size: 36 }), _jsx(Text, { ...CLIP, fontSize: 15, lineHeight: 20, color: INK, children: name })] }) }), _jsxs(DropdownMenuContent, { minW: 240, "aria-label": t('Account'), children: [_jsx(DropdownMenuLabel, { children: _jsxs(YStack, { minW: 0, gap: 2, children: [_jsx(Text, { fontSize: "$3", color: "$ink", numberOfLines: 1, children: name }), me.email ? (_jsx(Text, { fontSize: "$2", color: "$soft", numberOfLines: 1, children: me.email })) : null] }) }), _jsx(DropdownMenuSeparator, {}), _jsx(DropdownMenuItem, { onSelect: () => void leave(), children: _jsx(Text, { fontSize: "$3", color: "$ink", children: t('Log out') }) })] })] }), _jsxs(DropdownMenu, { placement: "top-end", offset: 8, children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx(XStack, { ...ROUND, "aria-label": t('Hanzo apps'), children: _jsx(LayoutGrid, { size: 16, color: INK, "aria-hidden": true }) }) }), _jsx(DropdownMenuContent, { minW: 240, maxH: 420, "aria-label": t('Hanzo apps'), children: BUSINESS_APPS.map((app) => (_jsx(DropdownMenuItem, { onSelect: () => window.location.assign(app.href), children: _jsxs(YStack, { minW: 0, children: [_jsx(Text, { fontSize: "$3", color: "$ink", numberOfLines: 1, children: app.productTitle }), _jsx(Text, { fontSize: "$1", color: "$soft", numberOfLines: 1, children: app.description })] }) }, app.id))) })] })] }));
50
+ }
@@ -0,0 +1,20 @@
1
+ import type { Agent, AgentRun } from '@hanzo/ai';
2
+ import { type Pending } from './said.js';
3
+ import type { Notice } from './refusal.js';
4
+ export declare function Thread({ bot, bots, runs, pending, notice, wrong, side, live, loaded, onSend, onDismiss, onSide, onBack, onMake, }: {
5
+ bot: Agent | null;
6
+ bots: readonly Agent[];
7
+ runs: AgentRun[] | null;
8
+ pending: Pending | null;
9
+ notice: Notice | null;
10
+ wrong: string | null;
11
+ side: boolean;
12
+ live: boolean;
13
+ /** The roster has answered, so an empty one is an empty org and not a slow one. */
14
+ loaded: boolean;
15
+ onSend: (input: string) => Promise<boolean>;
16
+ onDismiss: () => void;
17
+ onSide: () => void;
18
+ onBack: () => void;
19
+ onMake: () => void;
20
+ }): import("react").JSX.Element;
@@ -0,0 +1,148 @@
1
+ 'use client';
2
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ // The thread with the open bot: its pill and Share in the bar, what was said
4
+ // with a stamp wherever the conversation paused, and the composer.
5
+ //
6
+ // A message is a run the platform recorded: your words are its input, the bot's
7
+ // its output (or the error its model returned). A run another bot asked for is
8
+ // marked as that bot's message. Nothing here is drawn that the runs do not say.
9
+ import { useEffect, useMemo, useRef, useState } from 'react';
10
+ import { navigable } from '@hanzo/ui/product/limits';
11
+ import { useI18n } from '@hanzo/i18n/react';
12
+ import { useIamToken } from '@hanzo/iam/react';
13
+ import { Text, XStack, YStack } from '@hanzo/gui';
14
+ import { Caret } from '@hanzo/ui/chat';
15
+ import { Composer, Control, Field } from '@hanzo/composer';
16
+ import { speech, useDictation, useVoice, Voice } from '@hanzo/voice';
17
+ import { ArrowLeft, ArrowUp, Gauge, Mic, Plus, X } from 'lucide-react';
18
+ import { base } from '../lib/ai.js';
19
+ import { Prose } from '../Prose.js';
20
+ import { Face } from './face.js';
21
+ import { CLIP, PILL, ROUND, WORD } from './kit.js';
22
+ import { DIM, EDGE, INK, LINE, MINE, RAISED } from './ink.js';
23
+ import { instant } from './time.js';
24
+ import { lines } from './said.js';
25
+ import { compose, fits, MAX, texty } from './carry.js';
26
+ import { PARAM } from './api.js';
27
+ /** The widest a conversation reads, as the desktop app draws it. */
28
+ const MEASURE = 960;
29
+ /** "It resets in 3 days." from the instant a refusal lifts, in the reader's calendar days. */
30
+ function lifts(iso, now, t) {
31
+ const at = instant(iso ?? undefined);
32
+ if (at === null || at <= now)
33
+ return '';
34
+ const hours = Math.ceil((at - now) / 3_600_000);
35
+ if (hours < 24 && new Date(at).getDate() === new Date(now).getDate())
36
+ return hours === 1 ? t('It resets in an hour.') : t('It resets in {n} hours.', { n: hours });
37
+ const day = (n) => new Date(new Date(n).getFullYear(), new Date(n).getMonth(), new Date(n).getDate()).getTime();
38
+ const days = Math.round((day(at) - day(now)) / 86_400_000);
39
+ return days === 1 ? t('It resets tomorrow.') : t('It resets in {n} days.', { n: days });
40
+ }
41
+ export function Thread({ bot, bots, runs, pending, notice, wrong, side, live, loaded, onSend, onDismiss, onSide, onBack, onMake, }) {
42
+ const { t, locale } = useI18n();
43
+ const [draft, setDraft] = useState('');
44
+ const [shared, setShared] = useState(null);
45
+ const [file, setFile] = useState(null);
46
+ const [note, setNote] = useState(null);
47
+ const foot = useRef(null);
48
+ const pick = useRef(null);
49
+ // Dictation through Hanzo's own ear, as Chat's composer does: each pause is
50
+ // transcribed and lands after what the draft already held.
51
+ const { token } = useIamToken();
52
+ const ear = useMemo(() => speech({ ...base(), ...(token ? { token } : {}) }), [token]);
53
+ const voice = useVoice({ speech: ear, ...useDictation(draft, setDraft) });
54
+ const now = Date.now();
55
+ const said = useMemo(() => (bot ? lines(runs ?? [], bots, bot.name, pending, now, locale, t) : []),
56
+ // `now` moves every render; the stamps only need it when the thread does.
57
+ // eslint-disable-next-line react-hooks/exhaustive-deps
58
+ [bot, runs, bots, pending, locale, t]);
59
+ useEffect(() => {
60
+ foot.current?.scrollIntoView({ block: 'end' });
61
+ }, [said, notice]);
62
+ useEffect(() => {
63
+ setDraft('');
64
+ setFile(null);
65
+ setNote(null);
66
+ }, [bot?.name]);
67
+ /** The address of this bot's conversation, whatever the address bar says now. */
68
+ const share = async () => {
69
+ if (!bot)
70
+ return;
71
+ const url = new URL(window.location.href);
72
+ url.searchParams.set(PARAM, bot.name);
73
+ const link = url.toString();
74
+ const nav = navigator;
75
+ try {
76
+ if (nav.share && window.matchMedia('(pointer: coarse)').matches)
77
+ await nav.share({ url: link, title: bot.name });
78
+ else
79
+ await navigator.clipboard.writeText(link);
80
+ setShared(t('Link copied'));
81
+ }
82
+ catch (e) {
83
+ // A share the reader closed is not a failure; a copy the browser refused is.
84
+ if (e?.name === 'AbortError')
85
+ return;
86
+ setShared(t('Copy failed'));
87
+ }
88
+ window.setTimeout(() => setShared(null), 2000);
89
+ };
90
+ // A text file goes with the message, held beside the draft until it is sent.
91
+ const carry = async (picked) => {
92
+ setNote(null);
93
+ try {
94
+ const text = picked.size <= MAX ? await picked.text() : '';
95
+ if (!text || !texty(text))
96
+ throw new Error('not text');
97
+ setFile({ name: picked.name, text });
98
+ }
99
+ catch {
100
+ setNote(t('Only a text file under 128 KB goes with a message to a bot.'));
101
+ }
102
+ };
103
+ const submit = () => {
104
+ const words = draft;
105
+ const held = file;
106
+ const input = compose(words, held);
107
+ if (!input || !bot || !live || pending)
108
+ return;
109
+ if (!fits(input))
110
+ return setNote(t('That message is over the 128 KB a bot reads at once.'));
111
+ setDraft('');
112
+ setFile(null);
113
+ setNote(null);
114
+ void onSend(input).then((said) => {
115
+ // Not recorded: the words and the file come back, unless something new is there.
116
+ if (said)
117
+ return;
118
+ setDraft((d) => d || words);
119
+ setFile((f) => f ?? held);
120
+ });
121
+ };
122
+ return (_jsxs(YStack, { flex: 1, minH: 0, position: "relative", children: [_jsxs(XStack, { "data-parity-key": "bots.bar", height: 58, shrink: 0, px: 13, items: "center", gap: 8, children: [_jsx(XStack, { flex: 1, minW: 0, items: "center", children: _jsx(XStack, { ...ROUND, "aria-label": t('All bots'), onClick: onBack, display: "none", "$max-md": { display: 'flex' }, children: _jsx(ArrowLeft, { size: 16, color: INK, "aria-hidden": true, "data-i18n-mirror": true }) }) }), bot ? (_jsxs(XStack, { ...PILL, "data-parity-key": "bots.pill", "aria-label": t('{name}’s details', { name: bot.name }), "aria-expanded": side, onClick: onSide, height: 40, pl: 7, maxW: "60%", children: [_jsx(Face, { bot: bot, size: 24 }), _jsx(Text, { ...WORD, ...CLIP, children: bot.name })] })) : null, _jsx(XStack, { flex: 1, minW: 0, items: "center", justify: "flex-end", children: bot ? (_jsx(XStack, { ...PILL, "data-parity-key": "bots.share", px: 15, onClick: share, children: _jsx(Text, { ...WORD, children: shared ?? t('Share') }) })) : null })] }), !bot ? (_jsx(YStack, { flex: 1, items: "center", justify: "center", gap: 16, px: 24, children: live && loaded && bots.length === 0 ? (_jsxs(_Fragment, { children: [_jsx(Text, { render: "h1", m: 0, fontSize: 22, lineHeight: 28, fontWeight: "500", color: INK, children: t('Make your first bot') }), _jsx(XStack, { ...PILL, onClick: onMake, children: _jsx(Text, { ...WORD, children: t('New bot') }) })] })) : null })) : (_jsx(YStack, { "data-parity-key": "bots.thread", flex: 1, minH: 0, overflowY: "auto", overflowX: "hidden", children: _jsxs(YStack, { width: "100%", maxW: MEASURE + 48, mx: "auto", px: 24, pt: 12, pb: 16, "$max-md": { px: 12 }, children: [said.map((line, i) => {
123
+ const prev = said[i - 1];
124
+ const gap = !prev ? 0 : line.kind === prev.kind && (line.kind === 'mine' || line.kind === 'theirs') ? 3 : 16;
125
+ if (line.kind === 'stamp')
126
+ return (_jsx(Text, { self: "center", mt: i ? 22 : 8, mb: 2, fontSize: 13, lineHeight: 18, color: DIM, children: line.text }, line.key));
127
+ if (line.kind === 'from')
128
+ return (_jsxs(XStack, { self: "center", mt: gap, items: "center", gap: 6, children: [_jsx(Text, { fontSize: 13, lineHeight: 18, color: DIM, children: t('Message from') }), _jsx(Face, { bot: line.bot, size: 16 }), _jsx(Text, { fontSize: 13, lineHeight: 18, color: DIM, children: line.bot.name })] }, line.key));
129
+ if (line.kind === 'mine')
130
+ return (_jsx(YStack, { self: "flex-end", items: "flex-end", maxW: "78%", mt: gap, children: _jsx(Text, { "data-parity-key": "bots.mine", render: "div", px: 12, py: 7, rounded: 18, fontSize: 15, lineHeight: 22, color: INK, whiteSpace: "pre-wrap", "$platform-web": { overflowWrap: 'anywhere', backgroundColor: MINE }, children: line.text }) }, line.key));
131
+ if (line.kind === 'thinking')
132
+ return (_jsx(XStack, { "data-parity-key": "bots.thinking", role: "status", "aria-label": t('{name} is working', { name: bot.name }), self: "flex-start", mt: gap, px: 14, height: 38, items: "center", rounded: 16, bg: RAISED, borderWidth: 1, borderColor: LINE, children: _jsx(Caret, {}) }, line.key));
133
+ return (_jsx(YStack, { "data-parity-key": line.kind === 'other' ? 'bots.other' : 'bots.theirs', self: "flex-start", maxW: 560, mt: gap, px: 12, py: 10, rounded: 16, bg: RAISED, borderWidth: 1, borderColor: LINE, "$max-md": { maxW: '88%' }, children: line.kind === 'theirs' && line.failed ? (_jsx(Text, { fontSize: 15, lineHeight: 22, color: DIM, children: line.text })) : (_jsx(Prose, { text: line.text })) }, line.key));
134
+ }), wrong ? (_jsx(Text, { render: "p", self: "center", mt: 12, fontSize: 13, lineHeight: 18, color: DIM, children: wrong })) : null, _jsx("div", { ref: foot })] }) })), bot ? (_jsxs(YStack, { width: "100%", maxW: MEASURE + 48, mx: "auto", px: 24, pb: 15, gap: 8, shrink: 0, "$max-md": { px: 8, pb: 8 }, children: [notice ? (_jsxs(YStack, { "data-parity-key": "bots.notice", role: "alert", bg: RAISED, borderWidth: 1, borderColor: LINE, rounded: 16, pt: 12, pb: 10, px: 14, gap: 10, children: [_jsxs(XStack, { items: "flex-start", gap: 10, children: [_jsx(YStack, { pt: 3, children: _jsx(Gauge, { size: 16, color: DIM, "aria-hidden": true }) }), _jsxs(YStack, { flex: 1, minW: 0, children: [_jsx(Text, { fontSize: 15, lineHeight: 22, color: INK, children: notice.message }), lifts(notice.resets, now, t) ? (_jsx(Text, { fontSize: 15, lineHeight: 22, color: DIM, children: lifts(notice.resets, now, t) })) : null] }), _jsx(XStack, { ...ROUND, width: 28, height: 28, bg: "transparent", borderWidth: 0, "aria-label": t('Dismiss'), onClick: onDismiss, children: _jsx(X, { size: 14, color: DIM, "aria-hidden": true }) })] }), notice.actions.some(navigable) ? (_jsx(XStack, { justify: "flex-end", gap: 8, flexWrap: "wrap", children: notice.actions.filter(navigable).map((a, i, all) => (_jsx(XStack, { ...PILL, render: "a", href: a.url, height: 34, bg: i === all.length - 1 ? INK : RAISED, borderColor: i === all.length - 1 ? INK : LINE, "$platform-web": { textDecoration: 'none' }, children: _jsx(Text, { ...WORD, color: i === all.length - 1 ? 'var(--background)' : INK, children: a.label }) }, `${a.kind}-${a.label}`))) })) : null] })) : null, file ? (_jsxs(XStack, { self: "flex-start", items: "center", gap: 6, height: 30, pl: 12, pr: 4, rounded: 999, bg: RAISED, borderWidth: 1, borderColor: LINE, children: [_jsx(Text, { ...CLIP, maxW: 260, fontSize: 13, lineHeight: 18, color: INK, children: file.name }), _jsx(XStack, { ...ROUND, width: 24, height: 24, bg: "transparent", borderWidth: 0, "aria-label": t('Remove {name}', { name: file.name }), onClick: () => setFile(null), children: _jsx(X, { size: 12, color: DIM, "aria-hidden": true }) })] })) : null, note ? (_jsx(Text, { role: "alert", fontSize: 13, lineHeight: 18, color: DIM, px: 8, children: note })) : null, _jsx(Composer, { render: "form", onSubmit: (e) => {
135
+ e.preventDefault();
136
+ submit();
137
+ }, control: 32, width: "100%", children: _jsxs(XStack, { "data-parity-key": "bots.composer", height: 44, pl: 6, pr: 6, gap: 6, items: "center", rounded: 999, bg: RAISED, borderWidth: 1, borderColor: EDGE, focusWithinStyle: { borderColor: 'var(--ring)' }, children: [_jsx(Control, { type: "button", "aria-label": t('Add a text file'), onClick: () => pick.current?.click(), disabled: !live, children: _jsx(Plus, { size: 16 }) }), _jsx(Field, { value: draft, onChangeText: setDraft, onKeyDown: (e) => {
138
+ if (e.key === 'Enter' && !e.shiftKey && !e.nativeEvent?.isComposing) {
139
+ e.preventDefault();
140
+ submit();
141
+ }
142
+ }, placeholder: t('Message {name}', { name: bot.name }), "aria-label": t('Message {name}', { name: bot.name }), disabled: !live, fontSize: 15, px: 4 }), _jsx(Control, { asChild: true, children: _jsx(Voice, { voice: voice, disabled: !live, children: (state) => _jsx(Mic, { size: 15, fill: state === 'idle' ? 'none' : 'currentColor' }) }) }), _jsx(Control, { type: "submit", "aria-label": t('Send'), fill: true, disabled: !(draft.trim() || file) || !live || Boolean(pending), children: _jsx(ArrowUp, { size: 15, strokeWidth: 2.5 }) })] }) }), _jsx("input", { ref: pick, type: "file", hidden: true, accept: "text/*,.md,.txt,.csv,.json,.yaml,.yml,.tsv,.log", onChange: (e) => {
143
+ const picked = e.target.files?.[0];
144
+ e.target.value = '';
145
+ if (picked)
146
+ void carry(picked);
147
+ } })] })) : null] }));
148
+ }
@@ -1,118 +1,43 @@
1
- import type { Session, SessionDetail, SessionEvent } from '@hanzo/ai';
1
+ import type { Agent } from '@hanzo/ai';
2
2
  import type { useAi } from '../lib/ai.js';
3
3
  export type Client = NonNullable<ReturnType<typeof useAi>['client']>;
4
- /** The sandbox project that is this Bot's own disk. */
5
- export declare const disk: (name: string) => string;
6
- /** The KMS path prefix that is this Bot's own secrets. */
7
- export declare const vault: (name: string) => string;
8
- /** Long-running is the platform's word for a Bot that stays up. The set is
9
- * closed, and long-running is REFUSED without a schedule — measured, 400
10
- * "a long-running agent requires a 'schedule' (5-field cron)". */
4
+ /** The platform's word for a bot that runs on its own schedule. */
11
5
  export declare const ALWAYS = "long-running";
12
6
  export declare const ONCE = "one-shot";
7
+ /** A bot's name, as the agents route accepts one in a path. */
8
+ export declare const NAME: RegExp;
9
+ /** The address names the open bot (`?bot=`), so a reload, a link and Share all reopen it. */
10
+ export declare const PARAM = "bot";
11
+ /** One US dollar in the platform's unit of money. */
12
+ export declare const DOLLAR = 1000000;
13
+ /** What a person states to make a bot: who it is, what it does, what it may spend a week. */
14
+ export interface Draft {
15
+ name: string;
16
+ instructions: string;
17
+ model: string;
18
+ /** Whole US dollars a week. */
19
+ weekly: number;
20
+ }
13
21
  /**
14
- * The sessions opened under this Bot's name.
22
+ * Makes a bot.
15
23
  *
16
- * NARROWED HERE, BECAUSE THE ROUTE WILL NOT. Its query is root, parent,
17
- * status, project, channel and limit — there is no per-agent filter — and an
18
- * `agent=` it does not know is SILENTLY IGNORED rather than refused. Measured:
19
- * `?agent=nope` and no query at all answer the same five rows. A caller that
20
- * trusts the parameter draws the whole org's work as one bot's, which is how
21
- * this was wrong once already.
24
+ * The platform refuses an agent without a budget — `cap_micro_usd`,
25
+ * `max_task_micro_usd` and `period`, every field required — and the SDK's create
26
+ * names none of them, so the call is made here. The week's budget is also the
27
+ * ceiling for one run: a single message may use what the week allows, and the
28
+ * cap is what stops it.
22
29
  */
23
- export declare const sessions: (c: Client, agent: string, limit?: number, signal?: AbortSignal) => Promise<Session[]>;
24
- /** Opens a session under this Bot's name and answers the row. */
25
- export declare const launch: (c: Client, agent: string, title: string) => Promise<Session>;
26
- /** One session with its children and its most recent turns. */
27
- export declare const transcript: (c: Client, id: string, signal?: AbortSignal) => Promise<SessionDetail>;
28
- /** Records one turn in a session's log and answers it. */
29
- export declare const record: (c: Client, id: string, kind: string, text: string) => Promise<SessionEvent>;
30
- /** The four things you can say to a running session. Each one is recorded as a
31
- * control turn whether or not a runner is attached to hear it — the reply
32
- * carries `forwarded`, which says which of the two happened. */
33
- export declare const steer: (c: Client, id: string, command: 'pause' | 'resume' | 'stop' | 'message', message?: string) => Promise<{
34
- command?: string;
35
- event?: SessionEvent;
36
- forwarded?: boolean;
37
- }>;
38
- /** Which Bot answers on a transport: the org default and any channel bound past it. */
30
+ export declare const make: (c: Client, d: Draft) => Promise<Agent>;
31
+ /** The sandbox project that is a bot's own disk: the same name finds the same disk. */
32
+ export declare const disk: (name: string) => string;
33
+ /** Which bot answers on a transport: the org default and any channel bound past it. */
39
34
  export interface Answering {
40
35
  transport: string;
41
36
  default?: string;
42
- /** A channel id on that transport, to the agent bound to it. */
43
37
  channels?: Record<string, string>;
44
38
  }
45
39
  export declare const answering: (c: Client, transport: string, signal?: AbortSignal) => Promise<Answering>;
46
- /** Makes this Bot the one that answers on a transport. */
47
- export declare const answer: (c: Client, transport: string, agent: string) => Promise<Answering>;
48
- /**
49
- * The platform's own MCP surface — every subsystem's operations, projected as
50
- * tools, over JSON-RPC at `/v1/mcp`.
51
- *
52
- * This is where a Bot's callable names actually come from. The OTHER door,
53
- * `/v1/tools/call`, dispatches only what an org has ACTIVATED in the tool
54
- * registry, and answers 404 "unknown tool" for everything else — which is
55
- * everything, for an org that has activated none. So the registry is read for
56
- * what an org has added and this is read for what the platform already serves.
57
- *
58
- * Measured: `tools/list` answers 116 tools for a signed-in caller, and refuses
59
- * 127 more by a stated rule — a tool is not projected when its name would
60
- * disclose a bearer secret, or when a mutating verb acts on an identity.
61
- */
62
- export interface McpTool {
63
- name: string;
64
- description?: string;
65
- inputSchema?: unknown;
66
- annotations?: {
67
- readOnlyHint?: boolean;
68
- };
69
- }
70
- export declare const tools: (c: Client) => Promise<McpTool[]>;
71
- /** Runs one operation of one tool and answers the text it produced. */
72
- export declare const call: (c: Client, name: string, op: string, input?: Record<string, unknown>) => Promise<string>;
73
- /** Starts one autonomous coding run against a repo in the caller's org. */
74
- export declare const workOn: (c: Client, params: {
75
- repo: string;
76
- prompt: string;
77
- agentRef?: string;
78
- project?: string;
79
- }) => Promise<{
80
- sessionId?: string;
81
- id?: string;
82
- }>;
83
- /** A project the org has declared, with the repo behind it where there is one. */
84
- export interface Project {
85
- id: string;
86
- slug: string;
87
- name?: string;
88
- repo?: {
89
- url?: string;
90
- branch?: string;
91
- } | null;
92
- }
93
- export declare const projects: (c: Client, signal?: AbortSignal) => Promise<Project[]>;
94
- /** A secret's NAME and where it lives. The value never leaves KMS. */
95
- export interface Secret {
96
- name: string;
97
- path?: string;
98
- env?: string;
99
- scheme?: string;
100
- }
101
- export declare const secrets: (c: Client, path: string, signal?: AbortSignal) => Promise<Secret[]>;
102
- /** A connector as `/v1/connection` answers it. Held by the PERSON
103
- * who signed in to it: the contract publishes no per-agent binding. */
104
- export interface Connector {
105
- id: string;
106
- provider?: string;
107
- label?: string;
108
- account?: string;
109
- scopes?: string[];
110
- connectedAt?: string;
111
- expiresAt?: string;
112
- }
113
- export declare const connectors: (c: Client, signal?: AbortSignal) => Promise<Connector[]>;
114
- /** A short-lived grant to open a real terminal or a real screen on a sandbox.
115
- * The URL it answers is the only address either surface is ever drawn from. */
40
+ /** A short-lived grant to open a bot computer's screen or terminal. */
116
41
  export interface Grant {
117
42
  url?: string;
118
43
  ticket?: string;