@hanzo/app 0.2.55 → 0.2.57
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Board.js +121 -37
- package/dist/Boxes.js +16 -12
- package/dist/CalScheduler.js +81 -40
- package/dist/Chat.js +1 -2
- package/dist/Chrome.d.ts +4 -3
- package/dist/Chrome.js +7 -6
- package/dist/Contents.d.ts +1 -1
- package/dist/Contents.js +1 -2
- package/dist/Drive.js +121 -100
- package/dist/Inbox.js +7 -7
- package/dist/Market.js +15 -10
- package/dist/Meet.js +78 -48
- package/dist/Orgs.js +9 -10
- package/dist/Palette.d.ts +1 -1
- package/dist/Palette.js +1 -2
- package/dist/Schedule.js +15 -11
- package/dist/Settings.d.ts +1 -1
- package/dist/SettingsPane.js +2 -2
- package/dist/Shared.js +16 -11
- package/dist/Talk.js +4 -4
- package/dist/Terminals.js +3 -1
- package/dist/Usage.js +3 -3
- package/dist/WindowControls.js +5 -3
- package/dist/Work.js +51 -28
- package/dist/bots/Bots.js +129 -73
- package/dist/bots/runtime.js +103 -41
- package/dist/cast.d.ts +1 -1
- package/dist/cast.js +1 -1
- package/dist/failure.d.ts +1 -1
- package/dist/failure.js +1 -1
- package/dist/lib/limits.d.ts +1 -1
- package/dist/lib/limits.js +1 -1
- package/dist/lib/org.d.ts +3 -3
- package/dist/lib/org.js +4 -5
- package/dist/lib/orgname.d.ts +1 -1
- package/dist/lib/orgname.js +1 -1
- package/dist/lib/pay.d.ts +6 -2
- package/dist/lib/pay.js +15 -2
- package/dist/lib/plans.d.ts +1 -1
- package/dist/lib/plans.js +1 -1
- package/dist/lib/tier.d.ts +2 -2
- package/dist/lib/tier.js +6 -6
- package/dist/look.js +10 -8
- package/dist/recent.d.ts +1 -1
- package/dist/recent.js +1 -2
- package/dist/thread.js +1 -1
- package/package.json +3 -3
- package/dist/say.d.ts +0 -4
- package/dist/say.js +0 -7
package/dist/Schedule.js
CHANGED
|
@@ -9,6 +9,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
9
9
|
// the list of them is Scheduled tasks.
|
|
10
10
|
import { useEffect, useRef, useState } from 'react';
|
|
11
11
|
import { useAi } from '@hanzo/ai/react';
|
|
12
|
+
import { useI18n } from '@hanzo/i18n/react';
|
|
12
13
|
import { Anchor, Button, Dialog, DialogContent, DialogTitle, Input, Select, SelectContent, SelectItem, SelectTrigger, SelectValue, SizableText, Text, Textarea, XStack, YStack } from '@hanzo/ui';
|
|
13
14
|
import { cron, schedule, zone } from './lib/auto.js';
|
|
14
15
|
import { app } from './lib/host.js';
|
|
@@ -16,14 +17,15 @@ import { site } from './where.js';
|
|
|
16
17
|
import { BAD } from './lib/mix.js';
|
|
17
18
|
/** How long the "When" field rests before it is read. */
|
|
18
19
|
const REST = 400;
|
|
19
|
-
/** A moment as the reader's clock says it. */
|
|
20
|
-
function local(at) {
|
|
20
|
+
/** A moment as the reader's clock says it, in the language they chose. */
|
|
21
|
+
function local(at, locale) {
|
|
21
22
|
const d = new Date(at);
|
|
22
23
|
if (Number.isNaN(d.getTime()))
|
|
23
24
|
return '';
|
|
24
|
-
return d.toLocaleString(
|
|
25
|
+
return d.toLocaleString(locale, { weekday: 'short', month: 'short', day: 'numeric', hour: 'numeric', minute: '2-digit' });
|
|
25
26
|
}
|
|
26
27
|
export function Schedule({ open, onOpenChange, prompt, model, models, }) {
|
|
28
|
+
const { t, locale } = useI18n();
|
|
27
29
|
const ai = useAi();
|
|
28
30
|
const [words, setWords] = useState('');
|
|
29
31
|
const [said, setSaid] = useState('');
|
|
@@ -56,7 +58,7 @@ export function Schedule({ open, onOpenChange, prompt, model, models, }) {
|
|
|
56
58
|
const n = ++asked.current;
|
|
57
59
|
const stop = new AbortController();
|
|
58
60
|
setReading(true);
|
|
59
|
-
const
|
|
61
|
+
const timer = setTimeout(() => {
|
|
60
62
|
cron(ai, text, zone(), stop.signal).then((got) => {
|
|
61
63
|
if (n !== asked.current)
|
|
62
64
|
return;
|
|
@@ -67,12 +69,12 @@ export function Schedule({ open, onOpenChange, prompt, model, models, }) {
|
|
|
67
69
|
if (n !== asked.current || stop.signal.aborted)
|
|
68
70
|
return;
|
|
69
71
|
setRead(null);
|
|
70
|
-
setWrong(e?.message || 'That is not a time the scheduler can read.');
|
|
72
|
+
setWrong(e?.message || t('That is not a time the scheduler can read.'));
|
|
71
73
|
setReading(false);
|
|
72
74
|
});
|
|
73
75
|
}, REST);
|
|
74
76
|
return () => {
|
|
75
|
-
clearTimeout(
|
|
77
|
+
clearTimeout(timer);
|
|
76
78
|
stop.abort();
|
|
77
79
|
};
|
|
78
80
|
}, [said, open, ai]);
|
|
@@ -87,21 +89,23 @@ export function Schedule({ open, onOpenChange, prompt, model, models, }) {
|
|
|
87
89
|
setMade(true);
|
|
88
90
|
}
|
|
89
91
|
catch (e) {
|
|
90
|
-
setWrong(e?.message || 'The task was not scheduled.');
|
|
92
|
+
setWrong(e?.message || t('The task was not scheduled.'));
|
|
91
93
|
}
|
|
92
94
|
finally {
|
|
93
95
|
setBusy(false);
|
|
94
96
|
}
|
|
95
97
|
};
|
|
96
98
|
const options = models.some((m) => m.id === chose) || !chose ? models : [{ id: chose, name: chose }, ...models];
|
|
97
|
-
return (_jsx(Dialog, { open: open, onOpenChange: onOpenChange, children: _jsxs(DialogContent, { maxW: 520, rounded: "$6", gap: "$3", "data-slot": "schedule", children: [_jsx(DialogTitle, { children:
|
|
99
|
+
return (_jsx(Dialog, { open: open, onOpenChange: onOpenChange, children: _jsxs(DialogContent, { maxW: 520, rounded: "$6", gap: "$3", "data-slot": "schedule", children: [_jsx(DialogTitle, { children: t('Schedule this') }), made ? (_jsxs(YStack, { gap: "$3", children: [_jsx(SizableText, { size: "$3", color: "$ink", role: "status", children: t('Scheduled. {link}', {
|
|
100
|
+
link: (_jsx(Anchor, { href: site(app('-/automations')), color: "$ink", textDecorationLine: "underline", children: t('See it in Scheduled tasks.') })),
|
|
101
|
+
}) }), _jsx(XStack, { justify: "flex-end", children: _jsx(Button, { size: "sm", rounded: 999, onPress: () => onOpenChange(false), children: t('Done') }) })] })) : (_jsxs(YStack, { gap: "$3", children: [_jsxs(YStack, { gap: "$1", children: [_jsx(Text, { fontSize: "$1", color: "$soft", children: t('Prompt') }), _jsx(Textarea, { value: words, onChangeText: setWords, rows: 4, "aria-label": t('Prompt') })] }), _jsxs(YStack, { gap: "$1", children: [_jsx(Text, { fontSize: "$1", color: "$soft", children: t('When') }), _jsx(Input, { autoFocus: true, value: said, onChangeText: setSaid, placeholder: t('Every Monday at 9am'), "aria-label": t('When it runs'), "aria-describedby": "schedule-when", onKeyDown: (e) => {
|
|
98
102
|
if (e.key === 'Enter' && !e.nativeEvent?.isComposing)
|
|
99
103
|
void create();
|
|
100
104
|
} }), _jsx(Text, { id: "schedule-when", fontSize: "$1", color: wrong ? BAD : '$soft', role: "status", minH: 18, children: wrong
|
|
101
105
|
? wrong
|
|
102
106
|
: reading
|
|
103
|
-
? 'Reading.'
|
|
107
|
+
? t('Reading.')
|
|
104
108
|
: read
|
|
105
|
-
? [read.says, read.next ?
|
|
106
|
-
: 'Say it the way you would: every weekday at 8, every 5 minutes, tomorrow at noon.' })] }), options.length ? (_jsxs(YStack, { gap: "$1", children: [_jsx(Text, { fontSize: "$1", color: "$soft", children:
|
|
109
|
+
? [read.says, read.next ? t('next {when}', { when: local(read.next, locale) }) : t('when you run it')].filter(Boolean).join(' · ')
|
|
110
|
+
: t('Say it the way you would: every weekday at 8, every 5 minutes, tomorrow at noon.') })] }), options.length ? (_jsxs(YStack, { gap: "$1", children: [_jsx(Text, { fontSize: "$1", color: "$soft", children: t('Model') }), _jsxs(Select, { value: chose, onValueChange: setChose, children: [_jsx(SelectTrigger, { "aria-label": t('Model'), width: "100%", children: _jsx(SelectValue, {}) }), _jsx(SelectContent, { children: options.map((m) => (_jsx(SelectItem, { value: m.id, children: m.name }, m.id))) })] })] })) : null, _jsxs(XStack, { gap: "$2", justify: "flex-end", children: [_jsx(Button, { size: "sm", variant: "outline", rounded: 999, onPress: () => onOpenChange(false), children: t('Cancel') }), _jsx(Button, { size: "sm", rounded: 999, disabled: !ready, onPress: () => void create(), children: busy ? t('Scheduling…') : t('Create') })] })] }))] }) }));
|
|
107
111
|
}
|
package/dist/Settings.d.ts
CHANGED
package/dist/SettingsPane.js
CHANGED
|
@@ -246,7 +246,7 @@ function useTarget() {
|
|
|
246
246
|
* the payment host, so adding funds and a card both open it.
|
|
247
247
|
*/
|
|
248
248
|
function Billing() {
|
|
249
|
-
const { t } = useI18n();
|
|
249
|
+
const { t, locale } = useI18n();
|
|
250
250
|
const { isAuthenticated } = useIam();
|
|
251
251
|
const target = useTarget();
|
|
252
252
|
const { tier } = useTier(isAuthenticated, org());
|
|
@@ -255,7 +255,7 @@ function Billing() {
|
|
|
255
255
|
return _jsx(Text, { fontSize: "$3", color: "$soft", children: t('Sign in to see billing.') });
|
|
256
256
|
// WHAT THE CUSTOMER BOUGHT, by its family: `Max` with `20x` beside it.
|
|
257
257
|
const plan = tier ? label(tier.plan, tier.tier.name) ?? { name: 'Free', tag: '' } : null;
|
|
258
|
-
return (_jsxs(YStack, { gap: "$5", children: [plan ? (_jsxs(YStack, { gap: "$1", "data-slot": "billing-plan", children: [_jsx(Title, { label: plan, size: "$5" }), _jsx(Text, { fontSize: "$2", color: "$soft", children: sub ? renewal(sub, t) : tier?.plan ? t('Your plan.') : t('No paid plan. Usage is paid from credits.') })] })) : (_jsx(Text, { fontSize: "$3", color: "$soft", children: t('Reading your plan…') })), _jsx(Credits, { target: target, admin: administers(bearer(), org()), add: payPage() }), _jsx(Separator, {}), _jsxs(YStack, { gap: "$2", children: [_jsx(Text, { fontSize: "$2", color: "$soft", children: t('Payment') }), _jsx(Text, { fontSize: "$3", color: "$soft", children: t('A card is entered on the payment host and nowhere else, so this is the one control here that opens another surface.') }), _jsx(XStack, { children: _jsx(Box, { render: _jsx("a", { href: payPage(), target: "_blank", rel: "noreferrer" }), ...tap, children: _jsxs(XStack, { items: "center", gap: "$2", py: "$2", children: [_jsx(Text, { fontSize: "$3", color: "$ink", children: t('Manage plan, payment method and invoices') }), _jsx(ExternalLink, { size: 13, "aria-hidden": true })] }) }) })] })] }));
|
|
258
|
+
return (_jsxs(YStack, { gap: "$5", children: [plan ? (_jsxs(YStack, { gap: "$1", "data-slot": "billing-plan", children: [_jsx(Title, { label: plan, size: "$5" }), _jsx(Text, { fontSize: "$2", color: "$soft", children: sub ? renewal(sub, t, locale) : tier?.plan ? t('Your plan.') : t('No paid plan. Usage is paid from credits.') })] })) : (_jsx(Text, { fontSize: "$3", color: "$soft", children: t('Reading your plan…') })), _jsx(Credits, { target: target, admin: administers(bearer(), org()), add: payPage() }), _jsx(Separator, {}), _jsxs(YStack, { gap: "$2", children: [_jsx(Text, { fontSize: "$2", color: "$soft", children: t('Payment') }), _jsx(Text, { fontSize: "$3", color: "$soft", children: t('A card is entered on the payment host and nowhere else, so this is the one control here that opens another surface.') }), _jsx(XStack, { children: _jsx(Box, { render: _jsx("a", { href: payPage(), target: "_blank", rel: "noreferrer" }), ...tap, children: _jsxs(XStack, { items: "center", gap: "$2", py: "$2", children: [_jsx(Text, { fontSize: "$3", color: "$ink", children: t('Manage plan, payment method and invoices') }), _jsx(ExternalLink, { size: 13, "aria-hidden": true })] }) }) })] })] }));
|
|
259
259
|
}
|
|
260
260
|
/**
|
|
261
261
|
* Usage: @hanzo/build's `Plan`, the one view every Usage page draws — the plan's
|
package/dist/Shared.js
CHANGED
|
@@ -15,6 +15,7 @@ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-run
|
|
|
15
15
|
// link that opens nothing says so.
|
|
16
16
|
import { useEffect, useState } from 'react';
|
|
17
17
|
import { useIam } from '@hanzo/iam/react';
|
|
18
|
+
import { useI18n } from '@hanzo/i18n/react';
|
|
18
19
|
import { Anchor, Button, Text, XStack, YStack } from '@hanzo/ui';
|
|
19
20
|
import { brand } from './where.js';
|
|
20
21
|
import { useHydrated } from './lib/hydrated.js';
|
|
@@ -30,6 +31,7 @@ function target() {
|
|
|
30
31
|
}
|
|
31
32
|
const MEASURE = 'var(--container-prose, 48rem)';
|
|
32
33
|
export function Shared() {
|
|
34
|
+
const { t } = useI18n();
|
|
33
35
|
const hydrated = useHydrated();
|
|
34
36
|
const { isLoading, isAuthenticated, accessToken } = useIam();
|
|
35
37
|
const [aim, setAim] = useState(undefined);
|
|
@@ -67,7 +69,7 @@ export function Shared() {
|
|
|
67
69
|
}
|
|
68
70
|
setState(shared ? { kind: 'read', shared } : { kind: 'gone' });
|
|
69
71
|
})
|
|
70
|
-
.catch((e) => on && setState({ kind: 'wrong', said: e instanceof Error ? e.message : 'This chat could not be read. Try again.' }));
|
|
72
|
+
.catch((e) => on && setState({ kind: 'wrong', said: e instanceof Error ? e.message : t('This chat could not be read. Try again.') }));
|
|
71
73
|
return () => {
|
|
72
74
|
on = false;
|
|
73
75
|
};
|
|
@@ -77,27 +79,30 @@ export function Shared() {
|
|
|
77
79
|
: hydrated && !isLoading && aim && !('token' in aim) && !isAuthenticated
|
|
78
80
|
? { kind: 'ask' }
|
|
79
81
|
: state;
|
|
80
|
-
return (_jsxs(YStack, { role: "main", height: "100dvh", overflowY: "auto", bg: "$background", children: [_jsxs(XStack, { height: 48, px: "$4", items: "center", justify: "space-between", borderBottomWidth: 1, borderColor: "$borderColor", shrink: 0, children: [_jsx(Anchor, { href: "/", "aria-label": brand(), children: _jsx(Text, { fontSize: "$4", fontWeight: "600", color: "$ink", children: brand() }) }), shown.kind === 'read' && shown.shared.full ? (_jsx(Text, { fontSize: "$1", color: "$soft", children:
|
|
82
|
+
return (_jsxs(YStack, { role: "main", height: "100dvh", overflowY: "auto", bg: "$background", children: [_jsxs(XStack, { height: 48, px: "$4", items: "center", justify: "space-between", borderBottomWidth: 1, borderColor: "$borderColor", shrink: 0, children: [_jsx(Anchor, { href: "/", "aria-label": brand(), children: _jsx(Text, { fontSize: "$4", fontWeight: "600", color: "$ink", children: brand() }) }), shown.kind === 'read' && shown.shared.full ? (_jsx(Text, { fontSize: "$1", color: "$soft", children: t('Shared with you · Read only') })) : null] }), _jsx(YStack, { width: "100%", maxW: MEASURE, mx: "auto", px: "$4", py: "$6", gap: "$4", children: _jsx(Body, { state: shown, signedIn: Boolean(isAuthenticated), onOpen: () => setAgreed(true) }) })] }));
|
|
81
83
|
}
|
|
82
84
|
function Body({ state, signedIn, onOpen }) {
|
|
85
|
+
const { t } = useI18n();
|
|
83
86
|
if (state.kind === 'reading') {
|
|
84
|
-
return (_jsx(Text, { fontSize: "$3", color: "$soft", "aria-live": "polite", children:
|
|
87
|
+
return (_jsx(Text, { fontSize: "$3", color: "$soft", "aria-live": "polite", children: t('Opening the chat.') }));
|
|
85
88
|
}
|
|
86
89
|
if (state.kind === 'missing' || state.kind === 'gone') {
|
|
87
|
-
return (_jsxs(YStack, { gap: "$3", items: "flex-start", children: [_jsx(Text, { render: "h1", fontSize: "$7", fontWeight: "600", color: "$ink", children:
|
|
90
|
+
return (_jsxs(YStack, { gap: "$3", items: "flex-start", children: [_jsx(Text, { render: "h1", fontSize: "$7", fontWeight: "600", color: "$ink", children: t('This chat is no longer shared.') }), _jsx(Text, { fontSize: "$3", color: "$soft", children: state.kind === 'missing' ? t('The link is incomplete. Ask for it again.') : t('The link was turned off, or it was never a link to a chat.') }), _jsx(Anchor, { href: "/", children: _jsx(Button, { size: "sm", variant: "outline", children: t('Go to {brand}', { brand: brand() }) }) })] }));
|
|
88
91
|
}
|
|
89
92
|
if (state.kind === 'ask') {
|
|
90
93
|
return _jsx(Ask, { signedIn: signedIn });
|
|
91
94
|
}
|
|
92
95
|
if (state.kind === 'wrong') {
|
|
93
|
-
return (_jsxs(YStack, { gap: "$3", items: "flex-start", children: [_jsx(Text, { render: "h1", fontSize: "$6", fontWeight: "600", color: "$ink", children:
|
|
96
|
+
return (_jsxs(YStack, { gap: "$3", items: "flex-start", children: [_jsx(Text, { render: "h1", fontSize: "$6", fontWeight: "600", color: "$ink", children: t('This chat could not be opened.') }), _jsx(Text, { role: "alert", fontSize: "$3", color: "$soft", children: state.said }), _jsx(Button, { size: "sm", onClick: () => window.location.reload(), children: t('Try again') })] }));
|
|
94
97
|
}
|
|
95
98
|
const { shared } = state;
|
|
96
|
-
const by = shared.by || 'The person who shared it';
|
|
99
|
+
const by = shared.by || t('The person who shared it');
|
|
97
100
|
if (!shared.full) {
|
|
98
|
-
return (_jsxs(_Fragment, { children: [_jsx(Text, { render: "h1", fontSize: "$7", lineHeight: "$7", fontWeight: "600", color: "$ink", children: shared.title }), shared.confirm ? (_jsxs(YStack, { gap: "$3", p: "$4", rounded: "$4", borderWidth: 1, borderColor: "$borderColor", bg: "$backgroundHover", role: "region", "aria-label":
|
|
101
|
+
return (_jsxs(_Fragment, { children: [_jsx(Text, { render: "h1", fontSize: "$7", lineHeight: "$7", fontWeight: "600", color: "$ink", children: shared.title }), shared.confirm ? (_jsxs(YStack, { gap: "$3", p: "$4", rounded: "$4", borderWidth: 1, borderColor: "$borderColor", bg: "$backgroundHover", role: "region", "aria-label": t('Open the chat'), children: [_jsx(Text, { fontSize: "$4", fontWeight: "600", color: "$ink", children: shared.by ? t('{name} shared this chat with you', { name: shared.by }) : t('This chat was shared with you') }), _jsx(Text, { fontSize: "$2", color: "$soft", children: shared.by
|
|
102
|
+
? t('Opening it shows {name} the name you signed in with, and keeps it under Shared with you.', { name: shared.by })
|
|
103
|
+
: t('Opening it shows them the name you signed in with, and keeps it under Shared with you.') }), _jsx(XStack, { children: _jsx(Button, { size: "sm", onClick: onOpen, children: t('Open — {name} will see your name', { name: by }) }) })] })) : (_jsx(Ask, { signedIn: signedIn }))] }));
|
|
99
104
|
}
|
|
100
|
-
return (_jsxs(_Fragment, { children: [_jsx(Text, { render: "h1", fontSize: "$7", lineHeight: "$7", fontWeight: "600", color: "$ink", children: shared.title }), shared.by ? (
|
|
105
|
+
return (_jsxs(_Fragment, { children: [_jsx(Text, { render: "h1", fontSize: "$7", lineHeight: "$7", fontWeight: "600", color: "$ink", children: shared.title }), shared.by ? (_jsx(Text, { fontSize: "$2", color: "$soft", children: t('Shared by {name}', { name: shared.by }) })) : null, _jsx(YStack, { gap: "$4", render: "ol", m: 0, p: 0, "aria-label": t('Messages'), children: shared.messages.map((turn, i) => (_jsxs(YStack, { render: "li", gap: "$1", children: [_jsx(Text, { fontSize: "$1", color: "$soft", textTransform: "uppercase", children: turn.role === 'user' ? t('Asked') : turn.model ? t('Answered · {model}', { model: turn.model }) : t('Recorded by the person who shared this') }), turn.role === 'assistant' && turn.model ? (_jsx(Prose, { text: turn.content })) : (_jsx(Text, { fontSize: "$3", color: "$ink", whiteSpace: "pre-wrap", children: turn.content }))] }, i))) })] }));
|
|
101
106
|
}
|
|
102
107
|
/**
|
|
103
108
|
* What a reader who is not signed in is shown under the title: sign up or sign
|
|
@@ -106,9 +111,9 @@ function Body({ state, signedIn, onOpen }) {
|
|
|
106
111
|
* in again.
|
|
107
112
|
*/
|
|
108
113
|
function Ask({ signedIn }) {
|
|
109
|
-
const
|
|
114
|
+
const { t } = useI18n();
|
|
110
115
|
if (signedIn) {
|
|
111
|
-
return (_jsxs(YStack, { gap: "$3", p: "$4", rounded: "$4", borderWidth: 1, borderColor: "$borderColor", bg: "$backgroundHover", role: "region", "aria-label":
|
|
116
|
+
return (_jsxs(YStack, { gap: "$3", p: "$4", rounded: "$4", borderWidth: 1, borderColor: "$borderColor", bg: "$backgroundHover", role: "region", "aria-label": t('Sign in to read the chat'), children: [_jsx(Text, { fontSize: "$4", fontWeight: "600", color: "$ink", children: t('Sign in again to read this chat') }), _jsx(Text, { fontSize: "$2", color: "$soft", children: t('Your session has ended; signing in brings you straight back here. The person who shared it will see that you opened it.') }), _jsx(XStack, { gap: "$2", children: _jsx(Button, { size: "sm", onClick: () => enter(LOGIN), children: t('Sign in') }) })] }));
|
|
112
117
|
}
|
|
113
|
-
return (_jsxs(YStack, { gap: "$3", p: "$4", rounded: "$4", borderWidth: 1, borderColor: "$borderColor", bg: "$backgroundHover", role: "region", "aria-label":
|
|
118
|
+
return (_jsxs(YStack, { gap: "$3", p: "$4", rounded: "$4", borderWidth: 1, borderColor: "$borderColor", bg: "$backgroundHover", role: "region", "aria-label": t('Sign in to read the chat'), children: [_jsx(Text, { fontSize: "$4", fontWeight: "600", color: "$ink", children: t('Sign in to read this chat') }), _jsx(Text, { fontSize: "$2", color: "$soft", children: t('A free Hanzo account opens it, and you come straight back here. The person who shared it will see that you opened it.') }), _jsxs(XStack, { gap: "$2", flexWrap: "wrap", children: [_jsx(Button, { size: "sm", onClick: () => enter(signUp()), children: t('Sign up to view') }), _jsx(Button, { size: "sm", variant: "outline", onClick: () => enter(LOGIN), children: t('Sign in') })] })] }));
|
|
114
119
|
}
|
package/dist/Talk.js
CHANGED
|
@@ -34,10 +34,10 @@ import { memberOf, useMe, useRoster } from './roster.js';
|
|
|
34
34
|
import { useRoomMessages } from './rooms.js';
|
|
35
35
|
import { BAD } from './lib/mix.js';
|
|
36
36
|
/** The clock a transcript reads by: the time for today, the date before that. */
|
|
37
|
-
function when(ms) {
|
|
37
|
+
function when(ms, locale) {
|
|
38
38
|
const then = new Date(ms);
|
|
39
39
|
const sameDay = new Date().toDateString() === then.toDateString();
|
|
40
|
-
return then.toLocaleString(
|
|
40
|
+
return then.toLocaleString(locale, sameDay ? { hour: 'numeric', minute: '2-digit' } : { month: 'short', day: 'numeric' });
|
|
41
41
|
}
|
|
42
42
|
/**
|
|
43
43
|
* WHAT A ROOM IS CALLED. A channel carries a name; a direct message does not —
|
|
@@ -49,7 +49,7 @@ const titleOf = (room, t) => room.name ? `#${room.name}` : room.direct ? t('Dire
|
|
|
49
49
|
/** Adds `@name ` to a draft, after a space where the draft needs one. */
|
|
50
50
|
const mention = (draft, name) => `${draft && !/\s$/.test(draft) ? `${draft} ` : draft}@${name} `;
|
|
51
51
|
export function Talk({ room }) {
|
|
52
|
-
const { t, dir } = useI18n();
|
|
52
|
+
const { t, dir, locale } = useI18n();
|
|
53
53
|
const { messages, failed, send } = useRoomMessages(room.id, room.space);
|
|
54
54
|
const { members, wrong } = useRoster();
|
|
55
55
|
const me = useMe();
|
|
@@ -81,7 +81,7 @@ export function Talk({ room }) {
|
|
|
81
81
|
}
|
|
82
82
|
};
|
|
83
83
|
const name = (of) => setDraft((held) => mention(held, of));
|
|
84
|
-
return (_jsxs(YStack, { flex: 1, minH: 0, children: [_jsxs(ChannelHeader, { name: dir === 'rtl' ? isolate(title) : title, children: [room.topic ? (_jsx(Text, { fontSize: "$2", color: "$soft", numberOfLines: 1, children: room.topic })) : null, _jsx(Box, { render: "button", "aria-label": t(aside === 'roster' ? 'Hide directory & roster' : 'Show directory & roster'), "aria-pressed": aside === 'roster', onClick: () => showAside(aside === 'roster' ? null : 'roster'), marginInlineStart: "auto", p: "$2", rounded: "$3", hoverStyle: { bg: '$hover' }, children: _jsx(Users, { size: 16, "aria-hidden": true }) })] }), _jsxs(YStack, { flex: 1, minH: 0, overflowY: "auto", overflowX: "hidden", p: "$4", gap: "$3", children: [failed ? (_jsx(Text, { fontSize: "$3", color: "$soft", children: say(failed, t('this channel'), 'read', t) })) : messages === null ? (_jsx(Text, { fontSize: "$3", color: "$soft", children: t('Reading the room.') })) : messages.length === 0 && pending.length === 0 ? (_jsx(Text, { fontSize: "$3", color: "$soft", children: t('Nothing has been said here yet.') })) : (messages.map((one) => (_jsx(Line, { member: memberOf(members, one.author), fallback: one.author, stamp: when(one.createdOn), text: one.text }, one.id)))), pending
|
|
84
|
+
return (_jsxs(YStack, { flex: 1, minH: 0, children: [_jsxs(ChannelHeader, { name: dir === 'rtl' ? isolate(title) : title, children: [room.topic ? (_jsx(Text, { fontSize: "$2", color: "$soft", numberOfLines: 1, children: room.topic })) : null, _jsx(Box, { render: "button", "aria-label": t(aside === 'roster' ? 'Hide directory & roster' : 'Show directory & roster'), "aria-pressed": aside === 'roster', onClick: () => showAside(aside === 'roster' ? null : 'roster'), marginInlineStart: "auto", p: "$2", rounded: "$3", hoverStyle: { bg: '$hover' }, children: _jsx(Users, { size: 16, "aria-hidden": true }) })] }), _jsxs(YStack, { flex: 1, minH: 0, overflowY: "auto", overflowX: "hidden", p: "$4", gap: "$3", children: [failed ? (_jsx(Text, { fontSize: "$3", color: "$soft", children: say(failed, t('this channel'), 'read', t) })) : messages === null ? (_jsx(Text, { fontSize: "$3", color: "$soft", children: t('Reading the room.') })) : messages.length === 0 && pending.length === 0 ? (_jsx(Text, { fontSize: "$3", color: "$soft", children: t('Nothing has been said here yet.') })) : (messages.map((one) => (_jsx(Line, { member: memberOf(members, one.author), fallback: one.author, stamp: when(one.createdOn, locale), text: one.text }, one.id)))), pending
|
|
85
85
|
.filter((one) => !messages?.some((said) => said.author === me && said.text === one.text))
|
|
86
86
|
.map((one) => (_jsx(Line, { member: mine, fallback: t('You'), text: one.text, soft: true }, `pending-${one.key}`)))] }), _jsxs(YStack, { p: "$3", gap: "$2", borderTopWidth: 1, borderColor: "$borderColor", children: [_jsx(Composer, { value: draft, onChange: setDraft, onSend: () => void speak(), placeholder: t('Message {room}', { room: title }), label: t('Message {room}', { room: title }), hint: agents.length ? t('Mention an agent with @name and it answers.') : undefined, children: agents.length ? (_jsx(XStack, { gap: "$1", flexWrap: "wrap", shrink: 1, minW: 0, children: agents.map((one) => (_jsx(Box, { render: "button", "aria-label": t('Mention {name}', { name: one.name }), onClick: () => name(one.name), px: "$2", py: "$1", rounded: "$10", hoverStyle: { bg: '$hover' }, children: _jsxs(Text, { "data-i18n-ltr": true, fontSize: "$2", color: "$soft", children: ["@", one.name] }) }, one.id))) })) : null }), refused ? (_jsx(Text, { fontSize: "$2", color: BAD, children: refused })) : null] }), _jsx(Beside, { children: aside === 'roster' ? _jsx(Roster, { members: members, wrong: wrong, onMention: name }) : null })] }));
|
|
87
87
|
}
|
package/dist/Terminals.js
CHANGED
|
@@ -7,9 +7,11 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
7
7
|
// way /studio draws Studio.
|
|
8
8
|
import { Text, YStack } from '@hanzo/gui';
|
|
9
9
|
import { useFleet, Workspace } from '@hanzo/tabs';
|
|
10
|
+
import { useI18n } from '@hanzo/i18n/react';
|
|
10
11
|
import { api } from './lib/api.js';
|
|
11
12
|
import { bearer } from './lib/session.js';
|
|
12
13
|
export default function Terminals() {
|
|
14
|
+
const { t } = useI18n();
|
|
13
15
|
const fleet = useFleet(bearer(), api());
|
|
14
|
-
return (_jsxs(YStack, { "data-slot": "terminals", flex: 1, minH: 0, minW: 0, children: [fleet.error ? (_jsx(Text, { role: "alert", px: "$4", py: "$2", fontSize: "$2", color: "$soft", children:
|
|
16
|
+
return (_jsxs(YStack, { "data-slot": "terminals", flex: 1, minH: 0, minW: 0, children: [fleet.error ? (_jsx(Text, { role: "alert", px: "$4", py: "$2", fontSize: "$2", color: "$soft", children: t('The machines could not be read: {error}', { error: fleet.error }) })) : null, _jsx(Workspace, { hosts: fleet.hosts, mint: fleet.mint, onLaunch: fleet.launch })] }));
|
|
15
17
|
}
|
package/dist/Usage.js
CHANGED
|
@@ -16,10 +16,9 @@ import { tokensOf } from './lib/tokens.js';
|
|
|
16
16
|
import { payPage } from './lib/pay.js';
|
|
17
17
|
import { useLimits } from './lib/limits.js';
|
|
18
18
|
import { contextOf, readTokens, subscribeTokens, tokenKey } from './lib/tokens.js';
|
|
19
|
-
const integer = (n) => n.toLocaleString(undefined, { maximumFractionDigits: 0 });
|
|
20
19
|
/** The account control, shared by Chat, Dev and Studio through the composer slot. */
|
|
21
20
|
export function UsageControl({ context, read }) {
|
|
22
|
-
const { t } = useI18n();
|
|
21
|
+
const { t, format } = useI18n();
|
|
23
22
|
const [open, setOpen] = useState(false);
|
|
24
23
|
const currentOrg = org();
|
|
25
24
|
const identity = `${currentOrg}:${subject()}`;
|
|
@@ -86,7 +85,8 @@ export function UsageControl({ context, read }) {
|
|
|
86
85
|
const title = plan ? `${plan.name}${plan.tag ? ` ${plan.tag}` : ''}` : t('Plan usage');
|
|
87
86
|
const toggle = (on) => { setOpen(on); if (on && read)
|
|
88
87
|
read.reload(); };
|
|
89
|
-
const
|
|
88
|
+
const integer = (n) => format.number(n, { maximumFractionDigits: 0 });
|
|
89
|
+
const metric = (name, n) => _jsxs(XStack, { justify: "space-between", gap: "$3", children: [_jsx(Text, { fontSize: "$2", color: "$soft", children: name }), _jsx(Text, { fontSize: "$2", color: "$ink", fontVariant: ['tabular-nums'], children: _jsx("bdi", { children: integer(n) }) })] }, name);
|
|
90
90
|
return (_jsxs(Popover, { open: open, onOpenChange: toggle, placement: "top-end", children: [_jsx(PopoverTrigger, { asChild: true, children: _jsxs(Button, { type: "button", variant: "ghost", size: "sm", px: "$2", minW: 32, height: 32, hitSlop: 6, "aria-label": t('Context, tokens and plan usage'), "data-slot": "composer-usage", children: [_jsx(Activity, { size: 15, "aria-hidden": true }), _jsx(Text, { fontSize: "$1", color: highest !== null && highest >= 95 ? '$bad' : '$soft', children: percent !== null ? `${percent}%` : highest !== null ? `${Math.round(highest)}%` : t('Usage') })] }) }), _jsx(PopoverContent, { solid: true, width: 360, maxW: "calc(100vw - 24px)", maxH: "min(680px, calc(100dvh - 100px))", overflowY: "auto", "aria-label": t('Context, tokens and plan usage'), "data-slot": "composer-usage-panel", children: _jsxs(YStack, { gap: "$4", minW: 0, children: [_jsxs(XStack, { justify: "space-between", items: "center", gap: "$3", children: [_jsx(Text, { fontSize: "$3", fontWeight: "600", color: "$ink", children: t('Usage') }), _jsxs(Button, { type: "button", size: "sm", variant: "link", onClick: () => { setOpen(false); showSettings('usage'); }, "data-slot": "composer-see-usage", children: [t('See all usage'), " ", _jsx(ArrowUpRight, { size: 13 })] })] }), context && estimate ? (_jsxs(YStack, { gap: "$2", "data-slot": "composer-context", children: [_jsxs(XStack, { justify: "space-between", gap: "$2", children: [_jsx(Text, { fontSize: "$2", fontWeight: "600", children: t('Context · estimated') }), _jsx(Text, { fontSize: "$1", color: "$soft", children: capacity ? t('{used} / {max} tokens', { used: integer(estimate.total), max: integer(capacity) }) : t('{used} tokens', { used: integer(estimate.total) }) })] }), percent !== null ? _jsx(Progress, { value: Math.min(100, percent), height: 5, "aria-label": t('Estimated context used'), indicatorColor: percent >= 90 ? '$bad' : '$good' }) : null, estimate.rows.filter((r) => r.tokens > 0).map((r) => metric(t(r.name), r.tokens)), _jsx(Text, { fontSize: "$1", color: "$soft", children: t('Text estimate; model tokenization and attachments can change the total.') }), !capacity ? _jsx(Text, { fontSize: "$1", color: "$soft", children: t('This model does not report a context capacity.') }) : null] })) : null, _jsxs(YStack, { gap: "$2", "data-slot": "composer-reported-tokens", children: [_jsx(Text, { fontSize: "$2", fontWeight: "600", children: t('Last response · reported tokens') }), tokens ? _jsxs(_Fragment, { children: [metric(t('Input'), tokens.input), metric(t('Output'), tokens.output), tokens.cached !== undefined ? metric(t('Cached input'), tokens.cached) : null, tokens.reasoning !== undefined ? metric(t('Reasoning'), tokens.reasoning) : null, metric(t('Total'), tokens.total)] }) : _jsx(Text, { fontSize: "$2", color: "$soft", children: t('No token counts reported for this conversation yet. See all usage for account totals.') })] }), _jsxs(YStack, { gap: "$2", "data-slot": "composer-account-usage", children: [_jsx(Text, { fontSize: "$2", fontWeight: "600", children: t('Account · last 30 days') }), aggregate?.data ? _jsxs(_Fragment, { children: [metric(t('Tokens'), aggregate.data.totals.tokens), metric(t('Input'), aggregate.data.totals.promptTokens), metric(t('Output'), aggregate.data.totals.completionTokens), metric(t('Requests'), aggregate.data.totals.requests)] }) : _jsx(Text, { fontSize: "$2", color: "$soft", children: aggregate?.error ?? t('Reading account usage…') })] }), _jsxs(YStack, { gap: "$2", "data-slot": "composer-plan-usage", children: [_jsx(Text, { fontSize: "$2", fontWeight: "600", children: title }), limits ? _jsx(UsageMeter, { limits: limits, size: "sm" }) : _jsx(Text, { fontSize: "$2", color: "$soft", children: t(answered ? 'Plan usage is unavailable. Try again.' : 'Reading plan usage…') }), answered && !limits ? _jsx(Button, { type: "button", size: "sm", variant: "link", onClick: usage.reload, children: t('Retry') }) : null] }), _jsxs(XStack, { gap: "$3", justify: "space-between", flexWrap: "wrap", children: [_jsx(Button, { asChild: true, size: "sm", children: _jsx(Anchor, { href: payPage('/cart'), "data-slot": "composer-upgrade", children: t('Upgrade plan') }) }), _jsx(Button, { asChild: true, size: "sm", variant: "outline", children: _jsx(Anchor, { href: payPage('/amount/card'), "data-slot": "composer-buy-credits", children: t('Buy credits') }) })] })] }) })] }));
|
|
91
91
|
}
|
|
92
92
|
/** Every shared composer in the app gets the same account usage entry. */
|
package/dist/WindowControls.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useEffect, useState } from 'react';
|
|
4
4
|
import { View, XStack } from '@hanzo/ui';
|
|
5
|
+
import { useI18n } from '@hanzo/i18n/react';
|
|
5
6
|
function getWindow() {
|
|
6
7
|
if (typeof window === 'undefined')
|
|
7
8
|
return null;
|
|
@@ -124,6 +125,7 @@ export function toggleWindowMaximize(e) {
|
|
|
124
125
|
invokeTauri('plugin:window|toggle_maximize');
|
|
125
126
|
}
|
|
126
127
|
export function WindowControls() {
|
|
128
|
+
const { t } = useI18n();
|
|
127
129
|
const [isDesktop, setIsDesktop] = useState(false);
|
|
128
130
|
const [isMaximized, setIsMaximized] = useState(false);
|
|
129
131
|
useEffect(() => {
|
|
@@ -198,15 +200,15 @@ export function WindowControls() {
|
|
|
198
200
|
marginInlineStart: 'auto',
|
|
199
201
|
userSelect: 'none',
|
|
200
202
|
zIndex: 'var(--z-dropdown)',
|
|
201
|
-
}, children: [_jsx(View, { render: _jsx("button", { type: "button" }), "data-tauri-drag-region": "false", onClick: handleMinimize, onMouseDown: (e) => e.stopPropagation?.(), "aria-label":
|
|
203
|
+
}, children: [_jsx(View, { render: _jsx("button", { type: "button" }), "data-tauri-drag-region": "false", onClick: handleMinimize, onMouseDown: (e) => e.stopPropagation?.(), "aria-label": t('Minimize'), width: 28, height: 28, rounded: 6, items: "center", justify: "center", bg: "transparent", borderWidth: 0, cursor: "pointer", hoverStyle: { bg: 'var(--white-08)' }, "$platform-web": {
|
|
202
204
|
color: 'var(--muted-foreground)',
|
|
203
205
|
borderRadius: '6px',
|
|
204
206
|
transition: 'all 0.15s ease',
|
|
205
|
-
}, children: _jsx("svg", { width: "12", height: "12", viewBox: "0 0 12 12", fill: "none", stroke: "currentColor", strokeWidth: "1.5", children: _jsx("line", { x1: "2", y1: "6", x2: "10", y2: "6", strokeLinecap: "round" }) }) }), _jsx(View, { render: _jsx("button", { type: "button" }), "data-tauri-drag-region": "false", onClick: handleToggleMaximize, onMouseDown: (e) => e.stopPropagation?.(), "aria-label": isMaximized ? 'Restore' : 'Maximize', width: 28, height: 28, rounded: 6, items: "center", justify: "center", bg: "transparent", borderWidth: 0, cursor: "pointer", hoverStyle: { bg: 'var(--white-08)' }, "$platform-web": {
|
|
207
|
+
}, children: _jsx("svg", { width: "12", height: "12", viewBox: "0 0 12 12", fill: "none", stroke: "currentColor", strokeWidth: "1.5", children: _jsx("line", { x1: "2", y1: "6", x2: "10", y2: "6", strokeLinecap: "round" }) }) }), _jsx(View, { render: _jsx("button", { type: "button" }), "data-tauri-drag-region": "false", onClick: handleToggleMaximize, onMouseDown: (e) => e.stopPropagation?.(), "aria-label": isMaximized ? t('Restore') : t('Maximize'), width: 28, height: 28, rounded: 6, items: "center", justify: "center", bg: "transparent", borderWidth: 0, cursor: "pointer", hoverStyle: { bg: 'var(--white-08)' }, "$platform-web": {
|
|
206
208
|
color: 'var(--muted-foreground)',
|
|
207
209
|
borderRadius: '6px',
|
|
208
210
|
transition: 'all 0.15s ease',
|
|
209
|
-
}, children: isMaximized ? (_jsxs("svg", { width: "12", height: "12", viewBox: "0 0 12 12", fill: "none", stroke: "currentColor", strokeWidth: "1.2", children: [_jsx("rect", { x: "3.5", y: "1.5", width: "6.5", height: "6.5", rx: "1" }), _jsx("path", { d: "M1.5 4.5v5a1 1 0 0 0 1 1h5", strokeLinecap: "round" })] })) : (_jsx("svg", { width: "12", height: "12", viewBox: "0 0 12 12", fill: "none", stroke: "currentColor", strokeWidth: "1.2", children: _jsx("rect", { x: "2", y: "2", width: "8", height: "8", rx: "1.5" }) })) }), _jsx(View, { render: _jsx("button", { type: "button" }), "data-tauri-drag-region": "false", onClick: handleClose, onMouseDown: (e) => e.stopPropagation?.(), "aria-label":
|
|
211
|
+
}, children: isMaximized ? (_jsxs("svg", { width: "12", height: "12", viewBox: "0 0 12 12", fill: "none", stroke: "currentColor", strokeWidth: "1.2", children: [_jsx("rect", { x: "3.5", y: "1.5", width: "6.5", height: "6.5", rx: "1" }), _jsx("path", { d: "M1.5 4.5v5a1 1 0 0 0 1 1h5", strokeLinecap: "round" })] })) : (_jsx("svg", { width: "12", height: "12", viewBox: "0 0 12 12", fill: "none", stroke: "currentColor", strokeWidth: "1.2", children: _jsx("rect", { x: "2", y: "2", width: "8", height: "8", rx: "1.5" }) })) }), _jsx(View, { render: _jsx("button", { type: "button" }), "data-tauri-drag-region": "false", onClick: handleClose, onMouseDown: (e) => e.stopPropagation?.(), "aria-label": t('Close'), width: 28, height: 28, rounded: 6, items: "center", justify: "center", bg: "transparent", borderWidth: 0, cursor: "pointer", hoverStyle: { bg: 'var(--state-error)' }, "$platform-web": {
|
|
210
212
|
color: 'var(--muted-foreground)',
|
|
211
213
|
borderRadius: '6px',
|
|
212
214
|
transition: 'all 0.15s ease',
|
package/dist/Work.js
CHANGED
|
@@ -18,6 +18,7 @@ import { useOpen } from './open.js';
|
|
|
18
18
|
import { AgentBoard, ChannelHeader, Pane, ProgressBlock, Steer, steps, } from '@hanzo/ui/agents';
|
|
19
19
|
import { Text, XStack, YStack } from '@hanzo/ui';
|
|
20
20
|
import { useIam } from '@hanzo/iam/react';
|
|
21
|
+
import { useI18n } from '@hanzo/i18n/react';
|
|
21
22
|
import { Composer } from '@hanzo/ui/chat';
|
|
22
23
|
import { Start } from './Start.js';
|
|
23
24
|
import { Bar } from './progress.js';
|
|
@@ -44,7 +45,7 @@ const STATUS = (s) => s === 'running' || s === 'paused' || s === 'done' || s ===
|
|
|
44
45
|
* and says it. Anything that does not look like a payload is human text already
|
|
45
46
|
* and passes through untouched.
|
|
46
47
|
*/
|
|
47
|
-
const
|
|
48
|
+
const previewOf = (preview, t) => {
|
|
48
49
|
if (!preview)
|
|
49
50
|
return undefined;
|
|
50
51
|
const raw = preview.trim();
|
|
@@ -52,31 +53,32 @@ const say = (preview) => {
|
|
|
52
53
|
return preview;
|
|
53
54
|
const kind = /"type"\s*:\s*\\?"([a-z_]+)/i.exec(raw)?.[1];
|
|
54
55
|
switch (kind) {
|
|
55
|
-
case 'done': return 'Finished';
|
|
56
|
-
case 'error': return 'Failed';
|
|
57
|
-
case 'start': return 'Starting';
|
|
56
|
+
case 'done': return t('Finished');
|
|
57
|
+
case 'error': return t('Failed');
|
|
58
|
+
case 'start': return t('Starting');
|
|
58
59
|
case 'tool':
|
|
59
|
-
case 'tool_call': return 'Using a tool';
|
|
60
|
+
case 'tool_call': return t('Using a tool');
|
|
60
61
|
case 'text':
|
|
61
|
-
case 'delta': return 'Writing';
|
|
62
|
+
case 'delta': return t('Writing');
|
|
62
63
|
case undefined: return undefined;
|
|
63
64
|
default: return kind.replace(/_/g, ' ');
|
|
64
65
|
}
|
|
65
66
|
};
|
|
66
|
-
const toRun = (s, children = []) => ({
|
|
67
|
+
const toRun = (s, t, children = []) => ({
|
|
67
68
|
id: s.id,
|
|
68
69
|
agent: s.agent || s.title || s.id,
|
|
69
70
|
status: STATUS(s.status),
|
|
70
|
-
doing:
|
|
71
|
+
doing: previewOf(s.lastEvent?.preview, t),
|
|
71
72
|
target: s.target,
|
|
72
73
|
project: s.project,
|
|
73
74
|
children,
|
|
74
75
|
});
|
|
75
76
|
/** Flatten the server's tree into the board's, dropping the node we asked for. */
|
|
76
|
-
const kidsOf = (node) =>
|
|
77
|
+
const kidsOf = (node, t) =>
|
|
77
78
|
// `children` is NULL on a leaf, not `[]` — the guard is load-bearing.
|
|
78
|
-
(node?.children ?? []).map((child) => child.session ? toRun(child.session, kidsOf(child)) : null).filter((r) => r !== null);
|
|
79
|
+
(node?.children ?? []).map((child) => child.session ? toRun(child.session, t, kidsOf(child, t)) : null).filter((r) => r !== null);
|
|
79
80
|
function Watching({ idle }) {
|
|
81
|
+
const { t } = useI18n();
|
|
80
82
|
const ai = useAi();
|
|
81
83
|
const { sessions, loading, reload } = useSessions({ limit: 100 });
|
|
82
84
|
// THE OPEN RUN IS THE SHELL'S, not this pane's. `Start` announces a new run by
|
|
@@ -100,14 +102,14 @@ function Watching({ idle }) {
|
|
|
100
102
|
const stop = new AbortController();
|
|
101
103
|
void Promise.all(swarms.map((s) => ai.sessions
|
|
102
104
|
.tree(s.id, { signal: stop.signal })
|
|
103
|
-
.then((node) => [s.id, kidsOf(node)])
|
|
105
|
+
.then((node) => [s.id, kidsOf(node, t)])
|
|
104
106
|
.catch(() => [s.id, []]))).then((pairs) => {
|
|
105
107
|
if (!stop.signal.aborted)
|
|
106
108
|
setTrees(Object.fromEntries(pairs));
|
|
107
109
|
});
|
|
108
110
|
return () => stop.abort();
|
|
109
|
-
}, [ai, sessions]);
|
|
110
|
-
const runs = useMemo(() => sessions.map((s) => toRun(s, trees[s.id] ?? [])), [sessions, trees]);
|
|
111
|
+
}, [ai, sessions, t]);
|
|
112
|
+
const runs = useMemo(() => sessions.map((s) => toRun(s, t, trees[s.id] ?? [])), [sessions, trees, t]);
|
|
111
113
|
return (_jsxs(YStack, { flex: 1, minH: 0, width: "100%", $lg: { flexDirection: 'row' }, children: [_jsx(YStack
|
|
112
114
|
// AN EMPTY BOARD DRAWS NOTHING ACROSS THE TOP. As a full-width strip it
|
|
113
115
|
// reserved 270px and a hairline for one line of grey text, and pushed
|
|
@@ -147,7 +149,7 @@ function Watching({ idle }) {
|
|
|
147
149
|
height: '100%',
|
|
148
150
|
borderBottomWidth: 0,
|
|
149
151
|
borderRightWidth: 1,
|
|
150
|
-
}, borderColor: "$borderColor", children: _jsx(AgentBoard, { runs: runs, active: open ?? undefined, onOpen: setOpen, empty: _jsx(Text, { fontSize: "$2", color: "$soft", children: loading ? 'Reading runs…' : 'No runs yet. Start one and it appears here.' }) }) }), _jsx(YStack, { width: "100%", flex: 1, minW: 0, minH: 0, $lg: { width: 'auto' }, children: open ? _jsx(Watch, { id: open }, open) : (idle ?? _jsx(Idle, { runs: runs.length })) })] }));
|
|
152
|
+
}, borderColor: "$borderColor", children: _jsx(AgentBoard, { runs: runs, active: open ?? undefined, onOpen: setOpen, empty: _jsx(Text, { fontSize: "$2", color: "$soft", children: loading ? t('Reading runs…') : t('No runs yet. Start one and it appears here.') }) }) }), _jsx(YStack, { width: "100%", flex: 1, minW: 0, minH: 0, $lg: { width: 'auto' }, children: open ? _jsx(Watch, { id: open }, open) : (idle ?? _jsx(Idle, { runs: runs.length })) })] }));
|
|
151
153
|
}
|
|
152
154
|
/**
|
|
153
155
|
* Nothing is open. What that MEANS depends on whether there is anything to
|
|
@@ -156,10 +158,11 @@ function Watching({ idle }) {
|
|
|
156
158
|
* home — the composer and what to do next.
|
|
157
159
|
*/
|
|
158
160
|
function Idle({ runs }) {
|
|
161
|
+
const { t } = useI18n();
|
|
159
162
|
if (runs === 0) {
|
|
160
|
-
return (_jsx(YStack, { flex: 1, minH: 0, overflowY: "auto", overflowX: "hidden", children: _jsxs(YStack, { width: "100%", maxW: 640, mx: "auto", px: "$5", pt: "$10", gap: "$4", children: [_jsxs(YStack, { gap: "$2", children: [_jsx(Text, { render: "h1", fontSize: "$7", fontWeight: "500", color: "$ink", children:
|
|
163
|
+
return (_jsx(YStack, { flex: 1, minH: 0, overflowY: "auto", overflowX: "hidden", children: _jsxs(YStack, { width: "100%", maxW: 640, mx: "auto", px: "$5", pt: "$10", gap: "$4", children: [_jsxs(YStack, { gap: "$2", children: [_jsx(Text, { render: "h1", fontSize: "$7", fontWeight: "500", color: "$ink", children: t('Start a run') }), _jsx(Text, { fontSize: "$3", color: "$soft", maxW: 520, children: t('Give an agent a task. Its plan, progress, and output will appear here.') })] }), _jsx(Start, {}), _jsx(Text, { fontSize: "$1", color: "$soft", children: t('Runs stay visible in Working so you can inspect or steer them at any time.') })] }) }));
|
|
161
164
|
}
|
|
162
|
-
return (_jsx(YStack, { flex: 1, items: "center", justify: "center", p: "$6", children: _jsx(Text, { fontSize: "$3", color: "$soft", children:
|
|
165
|
+
return (_jsx(YStack, { flex: 1, items: "center", justify: "center", p: "$6", children: _jsx(Text, { fontSize: "$3", color: "$soft", children: t('Pick a run to watch it work.') }) }));
|
|
163
166
|
}
|
|
164
167
|
/**
|
|
165
168
|
* One run: its steps on the left, whatever it produced on the right.
|
|
@@ -169,6 +172,7 @@ function Idle({ runs }) {
|
|
|
169
172
|
* carrying the previous run's.
|
|
170
173
|
*/
|
|
171
174
|
function Watch({ id }) {
|
|
175
|
+
const { t } = useI18n();
|
|
172
176
|
const ai = useAi();
|
|
173
177
|
const { session } = useSession(id);
|
|
174
178
|
const [live, setLive] = useState([]);
|
|
@@ -210,12 +214,24 @@ function Watch({ id }) {
|
|
|
210
214
|
setNote(null);
|
|
211
215
|
try {
|
|
212
216
|
await ai.sessions.steer(id, command);
|
|
213
|
-
setNote(
|
|
217
|
+
setNote(command === 'pause'
|
|
218
|
+
? t('Pause queued — it takes effect between turns')
|
|
219
|
+
: command === 'resume'
|
|
220
|
+
? t('Resume queued — it takes effect between turns')
|
|
221
|
+
: command === 'stop'
|
|
222
|
+
? t('Stop queued — it takes effect between turns')
|
|
223
|
+
: t('Sent — the agent reads it between turns'));
|
|
214
224
|
}
|
|
215
225
|
catch {
|
|
216
|
-
setNote(
|
|
226
|
+
setNote(command === 'pause'
|
|
227
|
+
? t('Could not pause this run')
|
|
228
|
+
: command === 'resume'
|
|
229
|
+
? t('Could not resume this run')
|
|
230
|
+
: command === 'stop'
|
|
231
|
+
? t('Could not stop this run')
|
|
232
|
+
: t('Could not reach this run'));
|
|
217
233
|
}
|
|
218
|
-
}, [ai, id]);
|
|
234
|
+
}, [ai, id, t]);
|
|
219
235
|
const send = useCallback(async () => {
|
|
220
236
|
const text = draft.trim();
|
|
221
237
|
if (!text)
|
|
@@ -224,20 +240,26 @@ function Watch({ id }) {
|
|
|
224
240
|
setNote(null);
|
|
225
241
|
try {
|
|
226
242
|
await ai.sessions.steer(id, 'message', { message: text });
|
|
227
|
-
setNote('Sent — the agent reads it between turns');
|
|
243
|
+
setNote(t('Sent — the agent reads it between turns'));
|
|
228
244
|
}
|
|
229
245
|
catch {
|
|
230
|
-
setNote('Could not reach this run');
|
|
246
|
+
setNote(t('Could not reach this run'));
|
|
231
247
|
}
|
|
232
|
-
}, [ai, draft, id]);
|
|
233
|
-
return (_jsxs(XStack, { flex: 1, minH: 0, flexWrap: "wrap", children: [_jsxs(YStack, { flex: 1, minH: 0, minW: 0, children: [_jsx(ChannelHeader, { name: session?.title || session?.agent || id, artifacts: 0 }), _jsx(XStack, { px: "$4", pb: "$2", children: _jsx(Bar, { run: session }) }), _jsx(YStack, { flex: 1, minH: 0, overflowY: "auto", overflowX: "hidden", p: "$4", gap: "$4", children: _jsx(ProgressBlock, { steps: shown, done: finished, children: message ? (_jsx(Text, { fontSize: "$4", color: "$ink", children: message })) : null }) }), _jsxs(YStack, { p: "$3", gap: "$2", borderTopWidth: 1, borderColor: "$borderColor", children: [_jsx(Steer, { onCommand: (c) => void steer(c), withhold: finished ? ['pause', 'resume', 'stop'] : [], note: note }), _jsx(Composer, { value: draft, onChange: setDraft, onSend: () => void send(), placeholder:
|
|
234
|
-
{ id: 'code', label: 'Code', kind: 'code', content: _jsx(Nothing, { what: "changes" }) },
|
|
235
|
-
{ id: 'view', label: 'View', kind: 'view', content: _jsx(Nothing, { what: "preview" }) },
|
|
236
|
-
{ id: 'canvas', label: 'Canvas', kind: 'canvas', content: _jsx(Nothing, { what: "summary" }) },
|
|
248
|
+
}, [ai, draft, id, t]);
|
|
249
|
+
return (_jsxs(XStack, { flex: 1, minH: 0, flexWrap: "wrap", children: [_jsxs(YStack, { flex: 1, minH: 0, minW: 0, children: [_jsx(ChannelHeader, { name: session?.title || session?.agent || id, artifacts: 0 }), _jsx(XStack, { px: "$4", pb: "$2", children: _jsx(Bar, { run: session }) }), _jsx(YStack, { flex: 1, minH: 0, overflowY: "auto", overflowX: "hidden", p: "$4", gap: "$4", children: _jsx(ProgressBlock, { steps: shown, done: finished, children: message ? (_jsx(Text, { fontSize: "$4", color: "$ink", children: message })) : null }) }), _jsxs(YStack, { p: "$3", gap: "$2", borderTopWidth: 1, borderColor: "$borderColor", children: [_jsx(Steer, { onCommand: (c) => void steer(c), withhold: finished ? ['pause', 'resume', 'stop'] : [], note: note }), _jsx(Composer, { value: draft, onChange: setDraft, onSend: () => void send(), placeholder: t('Steer this run…'), label: t('Steer this run') })] })] }), _jsx(YStack, { width: "100%", p: "$3", borderTopWidth: 1, $sm: { width: 420, shrink: 0, borderTopWidth: 0, borderLeftWidth: 1 }, borderColor: "$borderColor", children: _jsx(Pane, { tabs: [
|
|
250
|
+
{ id: 'code', label: t('Code'), kind: 'code', content: _jsx(Nothing, { what: "changes" }) },
|
|
251
|
+
{ id: 'view', label: t('View'), kind: 'view', content: _jsx(Nothing, { what: "preview" }) },
|
|
252
|
+
{ id: 'canvas', label: t('Canvas'), kind: 'canvas', content: _jsx(Nothing, { what: "summary" }) },
|
|
237
253
|
] }) })] }));
|
|
238
254
|
}
|
|
239
255
|
function Nothing({ what }) {
|
|
240
|
-
|
|
256
|
+
const { t } = useI18n();
|
|
257
|
+
const line = what === 'changes'
|
|
258
|
+
? t('This run has produced no changes yet.')
|
|
259
|
+
: what === 'preview'
|
|
260
|
+
? t('This run has produced no preview yet.')
|
|
261
|
+
: t('This run has produced no summary yet.');
|
|
262
|
+
return (_jsx(Text, { fontSize: "$2", color: "$soft", children: line }));
|
|
241
263
|
}
|
|
242
264
|
/**
|
|
243
265
|
* The board, and the session its reads need.
|
|
@@ -248,9 +270,10 @@ function Nothing({ what }) {
|
|
|
248
270
|
* an `if` the rules forbid.
|
|
249
271
|
*/
|
|
250
272
|
export function Work({ idle }) {
|
|
273
|
+
const { t } = useI18n();
|
|
251
274
|
const { user, isLoading } = useIam();
|
|
252
275
|
if (isLoading || !user) {
|
|
253
|
-
return (_jsxs(YStack, { flex: 1, items: "center", justify: "center", p: "$6", gap: "$2", children: [_jsx(Text, { render: "h1", fontSize: "$5", fontWeight: "600", color: "$ink", children:
|
|
276
|
+
return (_jsxs(YStack, { flex: 1, items: "center", justify: "center", p: "$6", gap: "$2", children: [_jsx(Text, { render: "h1", fontSize: "$5", fontWeight: "600", color: "$ink", children: t('Agents') }), _jsx(Text, { fontSize: "$3", color: "$soft", text: "center", children: isLoading ? '\u00a0' : t('Sign in to watch your agents work.') })] }));
|
|
254
277
|
}
|
|
255
278
|
return _jsx(Watching, { idle: idle });
|
|
256
279
|
}
|