@hanzo/app 0.2.57 → 0.2.59
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/App.js +1 -1
- package/dist/Board.js +37 -121
- package/dist/Boxes.js +12 -16
- package/dist/CalScheduler.js +40 -81
- package/dist/Chat.js +84 -78
- package/dist/Chrome.d.ts +2 -14
- package/dist/Chrome.js +7 -44
- package/dist/Column.js +6 -2
- package/dist/Contents.d.ts +1 -1
- package/dist/Contents.js +2 -1
- package/dist/Drive.js +100 -121
- package/dist/Inbox.js +7 -7
- package/dist/Market.js +10 -15
- package/dist/Meet.js +48 -78
- package/dist/Orgs.js +10 -9
- package/dist/Palette.d.ts +1 -1
- package/dist/Palette.js +2 -1
- package/dist/Rail.js +3 -3
- package/dist/Schedule.js +11 -15
- package/dist/Settings.d.ts +1 -1
- package/dist/SettingsPane.js +2 -2
- package/dist/Shared.js +11 -16
- package/dist/Shell.js +1 -1
- package/dist/Talk.js +4 -4
- package/dist/Terminals.js +1 -3
- package/dist/Top.js +1 -1
- package/dist/Usage.js +3 -3
- package/dist/WindowControls.js +3 -5
- package/dist/Work.js +28 -51
- package/dist/bots/Bots.js +73 -129
- package/dist/bots/runtime.js +41 -103
- 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/ground.d.ts +14 -0
- package/dist/ground.js +14 -0
- 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 +5 -4
- package/dist/lib/orgname.d.ts +1 -1
- package/dist/lib/orgname.js +1 -1
- package/dist/lib/pay.d.ts +2 -6
- package/dist/lib/pay.js +2 -15
- 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 +8 -10
- package/dist/recent.d.ts +1 -1
- package/dist/recent.js +2 -1
- package/dist/say.d.ts +4 -0
- package/dist/say.js +7 -0
- package/dist/thread.js +1 -1
- package/package.json +3 -3
- package/assets/memoji/art.svg +0 -22
- package/assets/memoji/cyber.svg +0 -22
- package/assets/memoji/data.svg +0 -22
- package/assets/memoji/des.svg +0 -22
- package/assets/memoji/dev.svg +0 -22
- package/assets/memoji/doc.svg +0 -22
- package/assets/memoji/edu.svg +0 -22
- package/assets/memoji/fin.svg +0 -22
- package/assets/memoji/gov.svg +0 -22
- package/assets/memoji/huma.svg +0 -22
- package/assets/memoji/lang.svg +0 -22
- package/assets/memoji/law.svg +0 -22
- package/assets/memoji/mana.svg +0 -22
- package/assets/memoji/mark.svg +0 -22
- package/assets/memoji/mu.svg +0 -22
- package/assets/memoji/opera.svg +0 -22
- package/assets/memoji/rev.svg +0 -22
- package/assets/memoji/sal.svg +0 -22
- package/assets/memoji/sci.svg +0 -22
- package/assets/memoji/su.svg +0 -22
- package/assets/memoji/vi.svg +0 -22
- package/dist/TeamPreview.d.ts +0 -9
- package/dist/TeamPreview.js +0 -305
- package/dist/TeamStory.d.ts +0 -49
- package/dist/TeamStory.js +0 -67
- package/dist/preview.d.ts +0 -84
- package/dist/preview.js +0 -120
- package/dist/workday.d.ts +0 -247
- package/dist/workday.js +0 -642
package/dist/Rail.js
CHANGED
|
@@ -45,7 +45,7 @@ import { out } from './help.js';
|
|
|
45
45
|
import { BETAS } from './lib/betas.js';
|
|
46
46
|
import { HOSTED_APPS } from './lib/hosted.js';
|
|
47
47
|
import { Me } from './Me.js';
|
|
48
|
-
import {
|
|
48
|
+
import { HEAD, TOUCH_HEAD } from './ground.js';
|
|
49
49
|
import { app, hosted, WORKSPACE } from './lib/host.js';
|
|
50
50
|
/** The rail's width, px. */
|
|
51
51
|
export const RAIL = 44;
|
|
@@ -125,8 +125,8 @@ export function Rail({ host, mode, at, open, toggle, inside = null, rows = false
|
|
|
125
125
|
if (rows)
|
|
126
126
|
return (_jsxs(YStack, { "data-slot": "places", render: "nav", "aria-label": t('Products'), pt: "$2", shrink: 0, children: [_jsxs(YStack, { role: "list", gap: 2, children: [_jsx(YStack, { role: "listitem", children: _jsx(Row, { label: "Studio", on: mode === 'studio', onPress: onStudio, "data-slot": "place-studio", icon: _jsx(WandSparkles, { size: 16, "aria-hidden": true }) }) }), _jsx(YStack, { role: "listitem", children: _jsx(Row, { label: "Tabs", on: mode === 'tabs', onPress: onTabs, "data-slot": "place-tabs", icon: _jsx(SquareTerminal, { size: 16, "aria-hidden": true }) }) }), apps.map((a) => (_jsx(YStack, { role: "listitem", children: _jsx(Row, { label: a.name, on: inside === a.id, onPress: () => go(hosted(a.id)), "data-slot": `place-app-${a.id}`, icon: _jsx(a.icon, { size: 16, "aria-hidden": true }) }) }, a.id))), _jsx(YStack, { role: "listitem", children: _jsx(DropdownMenu, { placement: "bottom-start", minWidth: 220, trigger: _jsx(Row, { label: t('More'), "data-slot": "place-more", "aria-haspopup": "menu", icon: _jsx(Ellipsis, { size: 16, "aria-hidden": true }) }), items: rest }) })] }), betasDialog] }));
|
|
127
127
|
return (_jsxs(YStack, { "data-slot": "rail", render: "nav", "aria-label": t('Products'), width: RAIL, flex: 1,
|
|
128
|
-
// The first mark
|
|
129
|
-
pt: (
|
|
128
|
+
// The first mark stands at the pane's top edge, one head row high (HEAD), the account on the sidebar's foot (Column's `pb`).
|
|
129
|
+
pt: (HEAD - MARK) / 2, pb: "$2", gap: 4, shrink: 0, items: "center", $touchable: { pt: (TOUCH_HEAD - TOUCH) / 2 }, children: [toggle ? (_jsx(YStack, { pb: 4, children: _jsx(Toggle, { open: open, onPress: toggle }) })) : null, _jsx(Mark, { label: t('Chat'), on: mode === 'chat', onPress: onChat, "data-slot": "rail-chat", children: _jsx(MessageSquare, { size: 18, "aria-hidden": true }) }), _jsx(Mark, { label: "Dev", on: mode === 'dev' && !here, onPress: onDev, "data-slot": "rail-dev", children: _jsx(Code2, { size: 18, "aria-hidden": true }) }), _jsx(Mark, { label: "Studio", on: mode === 'studio', onPress: onStudio, "data-slot": "rail-studio", children: _jsx(WandSparkles, { size: 18, "aria-hidden": true }) }), _jsx(Mark, { label: "Tabs", on: mode === 'tabs', onPress: onTabs, "data-slot": "rail-tabs", children: _jsx(SquareTerminal, { size: 18, "aria-hidden": true }) }), apps.map((a) => (_jsx(Mark, { label: a.name, on: inside === a.id, onPress: () => go(hosted(a.id)), "data-slot": `rail-app-${a.id}`, children: _jsx(a.icon, { size: 18, "aria-hidden": true }) }, a.id))), _jsx(Mark, { label: t('Library'), on: here === 'library', onPress: to(RAISED.library), "data-slot": "rail-library", children: _jsx(Library, { size: 18, "aria-hidden": true }) }), _jsx(Mark, { label: t('Scheduled tasks'), on: here === 'scheduled', onPress: to(RAISED.scheduled), "data-slot": "rail-scheduled", children: _jsx(Clock, { size: 18, "aria-hidden": true }) }), _jsx(Mark, { label: t('Customize'), on: here === 'customize', onPress: to(RAISED.customize), "data-slot": "rail-customize", children: _jsx(Puzzle, { size: 18, "aria-hidden": true }) }), _jsx(Mark, { label: t('Betas'), on: mode === 'beta', onPress: () => go('/beta'), "data-slot": "rail-betas", children: _jsx(FlaskConical, { size: 18, "aria-hidden": true }) }), betasDialog, rest.length ? (_jsx(DropdownMenu
|
|
130
130
|
// Toward the content: right of the rail, left of it right to left.
|
|
131
131
|
, {
|
|
132
132
|
// Toward the content: right of the rail, left of it right to left.
|
package/dist/Schedule.js
CHANGED
|
@@ -9,7 +9,6 @@ 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';
|
|
13
12
|
import { Anchor, Button, Dialog, DialogContent, DialogTitle, Input, Select, SelectContent, SelectItem, SelectTrigger, SelectValue, SizableText, Text, Textarea, XStack, YStack } from '@hanzo/ui';
|
|
14
13
|
import { cron, schedule, zone } from './lib/auto.js';
|
|
15
14
|
import { app } from './lib/host.js';
|
|
@@ -17,15 +16,14 @@ import { site } from './where.js';
|
|
|
17
16
|
import { BAD } from './lib/mix.js';
|
|
18
17
|
/** How long the "When" field rests before it is read. */
|
|
19
18
|
const REST = 400;
|
|
20
|
-
/** A moment as the reader's clock says it
|
|
21
|
-
function local(at
|
|
19
|
+
/** A moment as the reader's clock says it. */
|
|
20
|
+
function local(at) {
|
|
22
21
|
const d = new Date(at);
|
|
23
22
|
if (Number.isNaN(d.getTime()))
|
|
24
23
|
return '';
|
|
25
|
-
return d.toLocaleString(
|
|
24
|
+
return d.toLocaleString(undefined, { weekday: 'short', month: 'short', day: 'numeric', hour: 'numeric', minute: '2-digit' });
|
|
26
25
|
}
|
|
27
26
|
export function Schedule({ open, onOpenChange, prompt, model, models, }) {
|
|
28
|
-
const { t, locale } = useI18n();
|
|
29
27
|
const ai = useAi();
|
|
30
28
|
const [words, setWords] = useState('');
|
|
31
29
|
const [said, setSaid] = useState('');
|
|
@@ -58,7 +56,7 @@ export function Schedule({ open, onOpenChange, prompt, model, models, }) {
|
|
|
58
56
|
const n = ++asked.current;
|
|
59
57
|
const stop = new AbortController();
|
|
60
58
|
setReading(true);
|
|
61
|
-
const
|
|
59
|
+
const t = setTimeout(() => {
|
|
62
60
|
cron(ai, text, zone(), stop.signal).then((got) => {
|
|
63
61
|
if (n !== asked.current)
|
|
64
62
|
return;
|
|
@@ -69,12 +67,12 @@ export function Schedule({ open, onOpenChange, prompt, model, models, }) {
|
|
|
69
67
|
if (n !== asked.current || stop.signal.aborted)
|
|
70
68
|
return;
|
|
71
69
|
setRead(null);
|
|
72
|
-
setWrong(e?.message ||
|
|
70
|
+
setWrong(e?.message || 'That is not a time the scheduler can read.');
|
|
73
71
|
setReading(false);
|
|
74
72
|
});
|
|
75
73
|
}, REST);
|
|
76
74
|
return () => {
|
|
77
|
-
clearTimeout(
|
|
75
|
+
clearTimeout(t);
|
|
78
76
|
stop.abort();
|
|
79
77
|
};
|
|
80
78
|
}, [said, open, ai]);
|
|
@@ -89,23 +87,21 @@ export function Schedule({ open, onOpenChange, prompt, model, models, }) {
|
|
|
89
87
|
setMade(true);
|
|
90
88
|
}
|
|
91
89
|
catch (e) {
|
|
92
|
-
setWrong(e?.message ||
|
|
90
|
+
setWrong(e?.message || 'The task was not scheduled.');
|
|
93
91
|
}
|
|
94
92
|
finally {
|
|
95
93
|
setBusy(false);
|
|
96
94
|
}
|
|
97
95
|
};
|
|
98
96
|
const options = models.some((m) => m.id === chose) || !chose ? models : [{ id: chose, name: chose }, ...models];
|
|
99
|
-
return (_jsx(Dialog, { open: open, onOpenChange: onOpenChange, children: _jsxs(DialogContent, { maxW: 520, rounded: "$6", gap: "$3", "data-slot": "schedule", children: [_jsx(DialogTitle, { children:
|
|
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) => {
|
|
97
|
+
return (_jsx(Dialog, { open: open, onOpenChange: onOpenChange, children: _jsxs(DialogContent, { maxW: 520, rounded: "$6", gap: "$3", "data-slot": "schedule", children: [_jsx(DialogTitle, { children: "Schedule this" }), made ? (_jsxs(YStack, { gap: "$3", children: [_jsxs(SizableText, { size: "$3", color: "$ink", role: "status", children: ["Scheduled.", ' ', _jsx(Anchor, { href: site(app('-/automations')), color: "$ink", textDecorationLine: "underline", children: "See it in Scheduled tasks." })] }), _jsx(XStack, { justify: "flex-end", children: _jsx(Button, { size: "sm", rounded: 999, onPress: () => onOpenChange(false), children: "Done" }) })] })) : (_jsxs(YStack, { gap: "$3", children: [_jsxs(YStack, { gap: "$1", children: [_jsx(Text, { fontSize: "$1", color: "$soft", children: "Prompt" }), _jsx(Textarea, { value: words, onChangeText: setWords, rows: 4, "aria-label": "Prompt" })] }), _jsxs(YStack, { gap: "$1", children: [_jsx(Text, { fontSize: "$1", color: "$soft", children: "When" }), _jsx(Input, { autoFocus: true, value: said, onChangeText: setSaid, placeholder: "Every Monday at 9am", "aria-label": "When it runs", "aria-describedby": "schedule-when", onKeyDown: (e) => {
|
|
102
98
|
if (e.key === 'Enter' && !e.nativeEvent?.isComposing)
|
|
103
99
|
void create();
|
|
104
100
|
} }), _jsx(Text, { id: "schedule-when", fontSize: "$1", color: wrong ? BAD : '$soft', role: "status", minH: 18, children: wrong
|
|
105
101
|
? wrong
|
|
106
102
|
: reading
|
|
107
|
-
?
|
|
103
|
+
? 'Reading.'
|
|
108
104
|
: read
|
|
109
|
-
? [read.says, read.next ?
|
|
110
|
-
:
|
|
105
|
+
? [read.says, read.next ? `next ${local(read.next)}` : 'when you run it'].filter(Boolean).join(' · ')
|
|
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: "Model" }), _jsxs(Select, { value: chose, onValueChange: setChose, children: [_jsx(SelectTrigger, { "aria-label": "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: "Cancel" }), _jsx(Button, { size: "sm", rounded: 999, disabled: !ready, onPress: () => void create(), children: busy ? 'Scheduling…' : 'Create' })] })] }))] }) }));
|
|
111
107
|
}
|
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
|
|
249
|
+
const { t } = 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
|
|
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 })] }) }) })] })] }));
|
|
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,7 +15,6 @@ 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';
|
|
19
18
|
import { Anchor, Button, Text, XStack, YStack } from '@hanzo/ui';
|
|
20
19
|
import { brand } from './where.js';
|
|
21
20
|
import { useHydrated } from './lib/hydrated.js';
|
|
@@ -31,7 +30,6 @@ function target() {
|
|
|
31
30
|
}
|
|
32
31
|
const MEASURE = 'var(--container-prose, 48rem)';
|
|
33
32
|
export function Shared() {
|
|
34
|
-
const { t } = useI18n();
|
|
35
33
|
const hydrated = useHydrated();
|
|
36
34
|
const { isLoading, isAuthenticated, accessToken } = useIam();
|
|
37
35
|
const [aim, setAim] = useState(undefined);
|
|
@@ -69,7 +67,7 @@ export function Shared() {
|
|
|
69
67
|
}
|
|
70
68
|
setState(shared ? { kind: 'read', shared } : { kind: 'gone' });
|
|
71
69
|
})
|
|
72
|
-
.catch((e) => on && setState({ kind: 'wrong', said: e instanceof Error ? e.message :
|
|
70
|
+
.catch((e) => on && setState({ kind: 'wrong', said: e instanceof Error ? e.message : 'This chat could not be read. Try again.' }));
|
|
73
71
|
return () => {
|
|
74
72
|
on = false;
|
|
75
73
|
};
|
|
@@ -79,30 +77,27 @@ export function Shared() {
|
|
|
79
77
|
: hydrated && !isLoading && aim && !('token' in aim) && !isAuthenticated
|
|
80
78
|
? { kind: 'ask' }
|
|
81
79
|
: state;
|
|
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:
|
|
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: "Shared with you \u00B7 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) }) })] }));
|
|
83
81
|
}
|
|
84
82
|
function Body({ state, signedIn, onOpen }) {
|
|
85
|
-
const { t } = useI18n();
|
|
86
83
|
if (state.kind === 'reading') {
|
|
87
|
-
return (_jsx(Text, { fontSize: "$3", color: "$soft", "aria-live": "polite", children:
|
|
84
|
+
return (_jsx(Text, { fontSize: "$3", color: "$soft", "aria-live": "polite", children: "Opening the chat." }));
|
|
88
85
|
}
|
|
89
86
|
if (state.kind === 'missing' || state.kind === 'gone') {
|
|
90
|
-
return (_jsxs(YStack, { gap: "$3", items: "flex-start", children: [_jsx(Text, { render: "h1", fontSize: "$7", fontWeight: "600", color: "$ink", children:
|
|
87
|
+
return (_jsxs(YStack, { gap: "$3", items: "flex-start", children: [_jsx(Text, { render: "h1", fontSize: "$7", fontWeight: "600", color: "$ink", children: "This chat is no longer shared." }), _jsx(Text, { fontSize: "$3", color: "$soft", children: state.kind === 'missing' ? 'The link is incomplete. Ask for it again.' : 'The link was turned off, or it was never a link to a chat.' }), _jsx(Anchor, { href: "/", children: _jsxs(Button, { size: "sm", variant: "outline", children: ["Go to ", brand()] }) })] }));
|
|
91
88
|
}
|
|
92
89
|
if (state.kind === 'ask') {
|
|
93
90
|
return _jsx(Ask, { signedIn: signedIn });
|
|
94
91
|
}
|
|
95
92
|
if (state.kind === 'wrong') {
|
|
96
|
-
return (_jsxs(YStack, { gap: "$3", items: "flex-start", children: [_jsx(Text, { render: "h1", fontSize: "$6", fontWeight: "600", color: "$ink", children:
|
|
93
|
+
return (_jsxs(YStack, { gap: "$3", items: "flex-start", children: [_jsx(Text, { render: "h1", fontSize: "$6", fontWeight: "600", color: "$ink", children: "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: "Try again" })] }));
|
|
97
94
|
}
|
|
98
95
|
const { shared } = state;
|
|
99
|
-
const by = shared.by ||
|
|
96
|
+
const by = shared.by || 'The person who shared it';
|
|
100
97
|
if (!shared.full) {
|
|
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":
|
|
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 }))] }));
|
|
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": "Open the chat", children: [_jsx(Text, { fontSize: "$4", fontWeight: "600", color: "$ink", children: shared.by ? `${shared.by} shared this chat with you` : 'This chat was shared with you' }), _jsxs(Text, { fontSize: "$2", color: "$soft", children: ["Opening it shows ", shared.by || 'them', " the name you signed in with, and keeps it under Shared with you."] }), _jsx(XStack, { children: _jsx(Button, { size: "sm", onClick: onOpen, children: `Open — ${by} will see your name` }) })] })) : (_jsx(Ask, { signedIn: signedIn }))] }));
|
|
104
99
|
}
|
|
105
|
-
return (_jsxs(_Fragment, { children: [_jsx(Text, { render: "h1", fontSize: "$7", lineHeight: "$7", fontWeight: "600", color: "$ink", children: shared.title }), shared.by ? (
|
|
100
|
+
return (_jsxs(_Fragment, { children: [_jsx(Text, { render: "h1", fontSize: "$7", lineHeight: "$7", fontWeight: "600", color: "$ink", children: shared.title }), shared.by ? (_jsxs(Text, { fontSize: "$2", color: "$soft", children: ["Shared by ", shared.by] })) : null, _jsx(YStack, { gap: "$4", render: "ol", m: 0, p: 0, "aria-label": "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' ? 'Asked' : turn.model ? `Answered · ${turn.model}` : '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))) })] }));
|
|
106
101
|
}
|
|
107
102
|
/**
|
|
108
103
|
* What a reader who is not signed in is shown under the title: sign up or sign
|
|
@@ -111,9 +106,9 @@ function Body({ state, signedIn, onOpen }) {
|
|
|
111
106
|
* in again.
|
|
112
107
|
*/
|
|
113
108
|
function Ask({ signedIn }) {
|
|
114
|
-
const
|
|
109
|
+
const seen = 'The person who shared it will see that you opened it.';
|
|
115
110
|
if (signedIn) {
|
|
116
|
-
return (_jsxs(YStack, { gap: "$3", p: "$4", rounded: "$4", borderWidth: 1, borderColor: "$borderColor", bg: "$backgroundHover", role: "region", "aria-label":
|
|
111
|
+
return (_jsxs(YStack, { gap: "$3", p: "$4", rounded: "$4", borderWidth: 1, borderColor: "$borderColor", bg: "$backgroundHover", role: "region", "aria-label": "Sign in to read the chat", children: [_jsx(Text, { fontSize: "$4", fontWeight: "600", color: "$ink", children: "Sign in again to read this chat" }), _jsxs(Text, { fontSize: "$2", color: "$soft", children: ["Your session has ended; signing in brings you straight back here. ", seen] }), _jsx(XStack, { gap: "$2", children: _jsx(Button, { size: "sm", onClick: () => enter(LOGIN), children: "Sign in" }) })] }));
|
|
117
112
|
}
|
|
118
|
-
return (_jsxs(YStack, { gap: "$3", p: "$4", rounded: "$4", borderWidth: 1, borderColor: "$borderColor", bg: "$backgroundHover", role: "region", "aria-label":
|
|
113
|
+
return (_jsxs(YStack, { gap: "$3", p: "$4", rounded: "$4", borderWidth: 1, borderColor: "$borderColor", bg: "$backgroundHover", role: "region", "aria-label": "Sign in to read the chat", children: [_jsx(Text, { fontSize: "$4", fontWeight: "600", color: "$ink", children: "Sign in to read this chat" }), _jsxs(Text, { fontSize: "$2", color: "$soft", children: ["A free Hanzo account opens it, and you come straight back here. ", seen] }), _jsxs(XStack, { gap: "$2", flexWrap: "wrap", children: [_jsx(Button, { size: "sm", onClick: () => enter(signUp()), children: "Sign up to view" }), _jsx(Button, { size: "sm", variant: "outline", onClick: () => enter(LOGIN), children: "Sign in" })] })] }));
|
|
119
114
|
}
|
package/dist/Shell.js
CHANGED
|
@@ -917,7 +917,7 @@ export function Paned({ children, swap, framed = false, bare = false, }) {
|
|
|
917
917
|
borderColor: "var(--edge, var(--white-06))",
|
|
918
918
|
}), ref: split.main,
|
|
919
919
|
// inline-style: the pane hidden while the column has its room, written by a drag too (useSplit).
|
|
920
|
-
style: split.mainStyle,
|
|
920
|
+
style: split.mainStyle, flex: 1, minW: 0, minH: 0, children: swap ?? (_jsx(Framed.Provider, { value: framed, children: _jsx(SideProvider, { value: split.side, children: _jsx(Slot.Provider, { value: slot, children: children }) }) })) }), aside ? (_jsxs(YStack, { render: "aside", "data-slot": "side", gridArea: "side", ...pane(framed ? undefined : sheet(1).backgroundColor),
|
|
921
921
|
// In the frame the gutter stands between the pane and this column.
|
|
922
922
|
marginInlineStart: framed ? "var(--pane-gap)" : undefined, ref: split.aside,
|
|
923
923
|
// inline-style: the width a drag rewrites on the element itself, and full screen (useSplit).
|
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) {
|
|
38
38
|
const then = new Date(ms);
|
|
39
39
|
const sameDay = new Date().toDateString() === then.toDateString();
|
|
40
|
-
return then.toLocaleString(
|
|
40
|
+
return then.toLocaleString(undefined, 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
|
|
52
|
+
const { t, dir } = 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
|
|
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
|
|
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,11 +7,9 @@ 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';
|
|
11
10
|
import { api } from './lib/api.js';
|
|
12
11
|
import { bearer } from './lib/session.js';
|
|
13
12
|
export default function Terminals() {
|
|
14
|
-
const { t } = useI18n();
|
|
15
13
|
const fleet = useFleet(bearer(), api());
|
|
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:
|
|
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: `The machines could not be read: ${fleet.error}` })) : null, _jsx(Workspace, { hosts: fleet.hosts, mint: fleet.mint, onLaunch: fleet.launch })] }));
|
|
17
15
|
}
|
package/dist/Top.js
CHANGED
|
@@ -63,5 +63,5 @@ export function Top({ host, mode, places, open = false, go, onMenu, onChat, onDe
|
|
|
63
63
|
},
|
|
64
64
|
}
|
|
65
65
|
: { label: made?.label ?? t('New'), onPress: made?.onPress };
|
|
66
|
-
return (_jsxs(XStack, { "data-slot": "app-bar",
|
|
66
|
+
return (_jsxs(XStack, { "data-slot": "app-bar", height: `calc(${BAND}px + var(--safe-top) + var(--pane-gap))`, pt: "calc(var(--safe-top) + var(--pane-gap))", px: "$4.5", items: "center", justify: "space-between", shrink: 0, $md: { display: 'none' }, children: [_jsx(Round, { label: t('Open sidebar'), "data-slot": "bar-menu", onPress: onMenu, pointerEvents: open ? 'none' : 'auto', children: _jsx(Lines, {}) }), _jsx(XStack, { "data-slot": "bar-mode", ...GLASS, height: LINE, p: "$1", items: "center", children: _jsxs(ToggleGroup, { type: "single", "aria-label": t('App'), value: mode === 'chat' || mode === 'dev' ? mode : '', disableDeactivation: true, onValueChange: (v) => (v === 'chat' ? onChat() : v === 'dev' ? onDev() : undefined), children: [_jsx(Side, { value: "chat", children: t('Chat') }), _jsx(Side, { value: "dev", children: "Dev" })] }) }), fresh.onPress ? (_jsx(Round, { label: fresh.label, "data-slot": "bar-new", onPress: fresh.onPress, children: _jsx(SquarePen, { size: 16, strokeWidth: 1.75, "aria-hidden": true }) })) : (_jsx(XStack, { width: ROUND, height: ROUND, "aria-hidden": true }))] }));
|
|
67
67
|
}
|
package/dist/Usage.js
CHANGED
|
@@ -16,9 +16,10 @@ 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 });
|
|
19
20
|
/** The account control, shared by Chat, Dev and Studio through the composer slot. */
|
|
20
21
|
export function UsageControl({ context, read }) {
|
|
21
|
-
const { t
|
|
22
|
+
const { t } = useI18n();
|
|
22
23
|
const [open, setOpen] = useState(false);
|
|
23
24
|
const currentOrg = org();
|
|
24
25
|
const identity = `${currentOrg}:${subject()}`;
|
|
@@ -85,8 +86,7 @@ export function UsageControl({ context, read }) {
|
|
|
85
86
|
const title = plan ? `${plan.name}${plan.tag ? ` ${plan.tag}` : ''}` : t('Plan usage');
|
|
86
87
|
const toggle = (on) => { setOpen(on); if (on && read)
|
|
87
88
|
read.reload(); };
|
|
88
|
-
const
|
|
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);
|
|
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: 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,7 +2,6 @@
|
|
|
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';
|
|
6
5
|
function getWindow() {
|
|
7
6
|
if (typeof window === 'undefined')
|
|
8
7
|
return null;
|
|
@@ -125,7 +124,6 @@ export function toggleWindowMaximize(e) {
|
|
|
125
124
|
invokeTauri('plugin:window|toggle_maximize');
|
|
126
125
|
}
|
|
127
126
|
export function WindowControls() {
|
|
128
|
-
const { t } = useI18n();
|
|
129
127
|
const [isDesktop, setIsDesktop] = useState(false);
|
|
130
128
|
const [isMaximized, setIsMaximized] = useState(false);
|
|
131
129
|
useEffect(() => {
|
|
@@ -200,15 +198,15 @@ export function WindowControls() {
|
|
|
200
198
|
marginInlineStart: 'auto',
|
|
201
199
|
userSelect: 'none',
|
|
202
200
|
zIndex: 'var(--z-dropdown)',
|
|
203
|
-
}, children: [_jsx(View, { render: _jsx("button", { type: "button" }), "data-tauri-drag-region": "false", onClick: handleMinimize, onMouseDown: (e) => e.stopPropagation?.(), "aria-label":
|
|
201
|
+
}, children: [_jsx(View, { render: _jsx("button", { type: "button" }), "data-tauri-drag-region": "false", onClick: handleMinimize, onMouseDown: (e) => e.stopPropagation?.(), "aria-label": "Minimize", width: 28, height: 28, rounded: 6, items: "center", justify: "center", bg: "transparent", borderWidth: 0, cursor: "pointer", hoverStyle: { bg: 'var(--white-08)' }, "$platform-web": {
|
|
204
202
|
color: 'var(--muted-foreground)',
|
|
205
203
|
borderRadius: '6px',
|
|
206
204
|
transition: 'all 0.15s ease',
|
|
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 ?
|
|
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": {
|
|
208
206
|
color: 'var(--muted-foreground)',
|
|
209
207
|
borderRadius: '6px',
|
|
210
208
|
transition: 'all 0.15s ease',
|
|
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":
|
|
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": "Close", width: 28, height: 28, rounded: 6, items: "center", justify: "center", bg: "transparent", borderWidth: 0, cursor: "pointer", hoverStyle: { bg: 'var(--state-error)' }, "$platform-web": {
|
|
212
210
|
color: 'var(--muted-foreground)',
|
|
213
211
|
borderRadius: '6px',
|
|
214
212
|
transition: 'all 0.15s ease',
|
package/dist/Work.js
CHANGED
|
@@ -18,7 +18,6 @@ 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';
|
|
22
21
|
import { Composer } from '@hanzo/ui/chat';
|
|
23
22
|
import { Start } from './Start.js';
|
|
24
23
|
import { Bar } from './progress.js';
|
|
@@ -45,7 +44,7 @@ const STATUS = (s) => s === 'running' || s === 'paused' || s === 'done' || s ===
|
|
|
45
44
|
* and says it. Anything that does not look like a payload is human text already
|
|
46
45
|
* and passes through untouched.
|
|
47
46
|
*/
|
|
48
|
-
const
|
|
47
|
+
const say = (preview) => {
|
|
49
48
|
if (!preview)
|
|
50
49
|
return undefined;
|
|
51
50
|
const raw = preview.trim();
|
|
@@ -53,32 +52,31 @@ const previewOf = (preview, t) => {
|
|
|
53
52
|
return preview;
|
|
54
53
|
const kind = /"type"\s*:\s*\\?"([a-z_]+)/i.exec(raw)?.[1];
|
|
55
54
|
switch (kind) {
|
|
56
|
-
case 'done': return
|
|
57
|
-
case 'error': return
|
|
58
|
-
case 'start': return
|
|
55
|
+
case 'done': return 'Finished';
|
|
56
|
+
case 'error': return 'Failed';
|
|
57
|
+
case 'start': return 'Starting';
|
|
59
58
|
case 'tool':
|
|
60
|
-
case 'tool_call': return
|
|
59
|
+
case 'tool_call': return 'Using a tool';
|
|
61
60
|
case 'text':
|
|
62
|
-
case 'delta': return
|
|
61
|
+
case 'delta': return 'Writing';
|
|
63
62
|
case undefined: return undefined;
|
|
64
63
|
default: return kind.replace(/_/g, ' ');
|
|
65
64
|
}
|
|
66
65
|
};
|
|
67
|
-
const toRun = (s,
|
|
66
|
+
const toRun = (s, children = []) => ({
|
|
68
67
|
id: s.id,
|
|
69
68
|
agent: s.agent || s.title || s.id,
|
|
70
69
|
status: STATUS(s.status),
|
|
71
|
-
doing:
|
|
70
|
+
doing: say(s.lastEvent?.preview),
|
|
72
71
|
target: s.target,
|
|
73
72
|
project: s.project,
|
|
74
73
|
children,
|
|
75
74
|
});
|
|
76
75
|
/** Flatten the server's tree into the board's, dropping the node we asked for. */
|
|
77
|
-
const kidsOf = (node
|
|
76
|
+
const kidsOf = (node) =>
|
|
78
77
|
// `children` is NULL on a leaf, not `[]` — the guard is load-bearing.
|
|
79
|
-
(node?.children ?? []).map((child) => child.session ? toRun(child.session,
|
|
78
|
+
(node?.children ?? []).map((child) => child.session ? toRun(child.session, kidsOf(child)) : null).filter((r) => r !== null);
|
|
80
79
|
function Watching({ idle }) {
|
|
81
|
-
const { t } = useI18n();
|
|
82
80
|
const ai = useAi();
|
|
83
81
|
const { sessions, loading, reload } = useSessions({ limit: 100 });
|
|
84
82
|
// THE OPEN RUN IS THE SHELL'S, not this pane's. `Start` announces a new run by
|
|
@@ -102,14 +100,14 @@ function Watching({ idle }) {
|
|
|
102
100
|
const stop = new AbortController();
|
|
103
101
|
void Promise.all(swarms.map((s) => ai.sessions
|
|
104
102
|
.tree(s.id, { signal: stop.signal })
|
|
105
|
-
.then((node) => [s.id, kidsOf(node
|
|
103
|
+
.then((node) => [s.id, kidsOf(node)])
|
|
106
104
|
.catch(() => [s.id, []]))).then((pairs) => {
|
|
107
105
|
if (!stop.signal.aborted)
|
|
108
106
|
setTrees(Object.fromEntries(pairs));
|
|
109
107
|
});
|
|
110
108
|
return () => stop.abort();
|
|
111
|
-
}, [ai, sessions
|
|
112
|
-
const runs = useMemo(() => sessions.map((s) => toRun(s,
|
|
109
|
+
}, [ai, sessions]);
|
|
110
|
+
const runs = useMemo(() => sessions.map((s) => toRun(s, trees[s.id] ?? [])), [sessions, trees]);
|
|
113
111
|
return (_jsxs(YStack, { flex: 1, minH: 0, width: "100%", $lg: { flexDirection: 'row' }, children: [_jsx(YStack
|
|
114
112
|
// AN EMPTY BOARD DRAWS NOTHING ACROSS THE TOP. As a full-width strip it
|
|
115
113
|
// reserved 270px and a hairline for one line of grey text, and pushed
|
|
@@ -149,7 +147,7 @@ function Watching({ idle }) {
|
|
|
149
147
|
height: '100%',
|
|
150
148
|
borderBottomWidth: 0,
|
|
151
149
|
borderRightWidth: 1,
|
|
152
|
-
}, borderColor: "$borderColor", children: _jsx(AgentBoard, { runs: runs, active: open ?? undefined, onOpen: setOpen, empty: _jsx(Text, { fontSize: "$2", color: "$soft", children: loading ?
|
|
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 })) })] }));
|
|
153
151
|
}
|
|
154
152
|
/**
|
|
155
153
|
* Nothing is open. What that MEANS depends on whether there is anything to
|
|
@@ -158,11 +156,10 @@ function Watching({ idle }) {
|
|
|
158
156
|
* home — the composer and what to do next.
|
|
159
157
|
*/
|
|
160
158
|
function Idle({ runs }) {
|
|
161
|
-
const { t } = useI18n();
|
|
162
159
|
if (runs === 0) {
|
|
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:
|
|
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: "Start a run" }), _jsx(Text, { fontSize: "$3", color: "$soft", maxW: 520, children: "Give an agent a task. Its plan, progress, and output will appear here." })] }), _jsx(Start, {}), _jsx(Text, { fontSize: "$1", color: "$soft", children: "Runs stay visible in Working so you can inspect or steer them at any time." })] }) }));
|
|
164
161
|
}
|
|
165
|
-
return (_jsx(YStack, { flex: 1, items: "center", justify: "center", p: "$6", children: _jsx(Text, { fontSize: "$3", color: "$soft", children:
|
|
162
|
+
return (_jsx(YStack, { flex: 1, items: "center", justify: "center", p: "$6", children: _jsx(Text, { fontSize: "$3", color: "$soft", children: "Pick a run to watch it work." }) }));
|
|
166
163
|
}
|
|
167
164
|
/**
|
|
168
165
|
* One run: its steps on the left, whatever it produced on the right.
|
|
@@ -172,7 +169,6 @@ function Idle({ runs }) {
|
|
|
172
169
|
* carrying the previous run's.
|
|
173
170
|
*/
|
|
174
171
|
function Watch({ id }) {
|
|
175
|
-
const { t } = useI18n();
|
|
176
172
|
const ai = useAi();
|
|
177
173
|
const { session } = useSession(id);
|
|
178
174
|
const [live, setLive] = useState([]);
|
|
@@ -214,24 +210,12 @@ function Watch({ id }) {
|
|
|
214
210
|
setNote(null);
|
|
215
211
|
try {
|
|
216
212
|
await ai.sessions.steer(id, command);
|
|
217
|
-
setNote(command
|
|
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'));
|
|
213
|
+
setNote(`${command} queued — it takes effect between turns`);
|
|
224
214
|
}
|
|
225
215
|
catch {
|
|
226
|
-
setNote(command
|
|
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'));
|
|
216
|
+
setNote(`Could not ${command} this run`);
|
|
233
217
|
}
|
|
234
|
-
}, [ai, id
|
|
218
|
+
}, [ai, id]);
|
|
235
219
|
const send = useCallback(async () => {
|
|
236
220
|
const text = draft.trim();
|
|
237
221
|
if (!text)
|
|
@@ -240,26 +224,20 @@ function Watch({ id }) {
|
|
|
240
224
|
setNote(null);
|
|
241
225
|
try {
|
|
242
226
|
await ai.sessions.steer(id, 'message', { message: text });
|
|
243
|
-
setNote(
|
|
227
|
+
setNote('Sent — the agent reads it between turns');
|
|
244
228
|
}
|
|
245
229
|
catch {
|
|
246
|
-
setNote(
|
|
230
|
+
setNote('Could not reach this run');
|
|
247
231
|
}
|
|
248
|
-
}, [ai, draft, id
|
|
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:
|
|
250
|
-
{ id: 'code', label:
|
|
251
|
-
{ id: 'view', label:
|
|
252
|
-
{ id: 'canvas', label:
|
|
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: "Steer this run\u2026", label: "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: [
|
|
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" }) },
|
|
253
237
|
] }) })] }));
|
|
254
238
|
}
|
|
255
239
|
function Nothing({ what }) {
|
|
256
|
-
|
|
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 }));
|
|
240
|
+
return (_jsxs(Text, { fontSize: "$2", color: "$soft", children: ["This run has produced no ", what, " yet."] }));
|
|
263
241
|
}
|
|
264
242
|
/**
|
|
265
243
|
* The board, and the session its reads need.
|
|
@@ -270,10 +248,9 @@ function Nothing({ what }) {
|
|
|
270
248
|
* an `if` the rules forbid.
|
|
271
249
|
*/
|
|
272
250
|
export function Work({ idle }) {
|
|
273
|
-
const { t } = useI18n();
|
|
274
251
|
const { user, isLoading } = useIam();
|
|
275
252
|
if (isLoading || !user) {
|
|
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:
|
|
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: "Agents" }), _jsx(Text, { fontSize: "$3", color: "$soft", text: "center", children: isLoading ? '\u00a0' : 'Sign in to watch your agents work.' })] }));
|
|
277
254
|
}
|
|
278
255
|
return _jsx(Watching, { idle: idle });
|
|
279
256
|
}
|