@hanzo/build 0.2.125 → 0.2.127
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/lib/api/machines.d.ts +8 -0
- package/lib/api/machines.js +16 -5
- package/lib/api/places.d.ts +12 -4
- package/lib/api/places.js +11 -3
- package/lib/api/work.d.ts +9 -0
- package/lib/api/work.js +44 -3
- package/lib/automations.js +74 -35
- package/lib/awake.d.ts +24 -0
- package/lib/awake.js +68 -0
- package/lib/clipboard.d.ts +2 -0
- package/lib/clipboard.js +10 -0
- package/lib/customize/agents.js +149 -31
- package/lib/customize/connectors.js +91 -34
- package/lib/customize/drafted.js +23 -10
- package/lib/customize/index.js +40 -10
- package/lib/customize/inventory.d.ts +4 -1
- package/lib/customize/inventory.js +66 -17
- package/lib/customize/plugins.js +43 -15
- package/lib/customize/skills.js +87 -23
- package/lib/customize/ui.d.ts +29 -3
- package/lib/customize/ui.js +89 -12
- package/lib/desk.d.ts +1 -1
- package/lib/desk.js +67 -40
- package/lib/dev-mode.d.ts +22 -0
- package/lib/dev-mode.js +80 -0
- package/lib/environment.js +4 -4
- package/lib/forge.js +97 -24
- package/lib/handoff.d.ts +8 -0
- package/lib/handoff.js +22 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/landing.js +100 -25
- package/lib/library.js +108 -39
- package/lib/make.js +3 -2
- package/lib/mind.d.ts +9 -29
- package/lib/mind.js +43 -4
- package/lib/pane.d.ts +13 -0
- package/lib/pane.js +4 -0
- package/lib/panel.d.ts +4 -0
- package/lib/panel.js +49 -46
- package/lib/plans.js +36 -15
- package/lib/project.js +72 -63
- package/lib/reply.d.ts +6 -1
- package/lib/reply.js +19 -9
- package/lib/run.js +23 -41
- package/lib/scheduled.js +36 -16
- package/lib/settings/account.js +2 -1
- package/lib/settings/billing.js +9 -4
- package/lib/settings/credits.d.ts +2 -1
- package/lib/settings/credits.js +2 -2
- package/lib/settings/machines.js +41 -18
- package/lib/settings/notifications.js +2 -1
- package/lib/shelf.d.ts +4 -1
- package/lib/shelf.js +79 -14
- package/lib/suggestions.js +2 -1
- package/lib/summary.js +3 -2
- package/lib/sync.js +3 -3
- package/lib/transcript.js +13 -6
- package/package.json +11 -1
package/lib/customize/agents.js
CHANGED
|
@@ -22,10 +22,11 @@ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-run
|
|
|
22
22
|
import { SizableText, XStack, YStack } from '@hanzo/gui';
|
|
23
23
|
import { phrase } from '@hanzo/i18n';
|
|
24
24
|
import { useI18n } from '@hanzo/i18n/react';
|
|
25
|
-
import { ArrowLeft, Upload } from '@hanzogui/lucide-icons-2';
|
|
25
|
+
import { ArrowLeft, Upload, X } from '@hanzogui/lucide-icons-2';
|
|
26
26
|
import { Button, Input, Switch, Textarea } from '@hanzo/ui';
|
|
27
27
|
import { ModelPicker } from '@hanzo/ui/models';
|
|
28
28
|
import { useEffect, useMemo, useRef, useState } from 'react';
|
|
29
|
+
import { RING } from '../pane.js';
|
|
29
30
|
import { agents, ALL, CAST_CAP, CAST_TASK, create, draft, EMPTY, one, PERIODS, person, profile, remove, SCHEDULES, TRIGGERS, update, use } from '../api/agents.js';
|
|
30
31
|
import { models } from '../api/models.js';
|
|
31
32
|
import { tools } from '../api/tools.js';
|
|
@@ -37,10 +38,42 @@ import { Inventory, Traits } from './inventory.js';
|
|
|
37
38
|
import { useLoad } from './load.js';
|
|
38
39
|
import { keep, kept, nature, score } from './ocean.js';
|
|
39
40
|
import { say } from './say.js';
|
|
40
|
-
import { Add, Choice, Confirm, Empty, Failed, Field, Grid, Line, Mark, matches,
|
|
41
|
+
import { Add, Choice, Confirm, Empty, Failed, Field, FilterPills, Grid, Line, Mark, matches, Part, Sheet, Soft, useCount, Visitor } from './ui.js';
|
|
41
42
|
/** How many cards Browse draws at a time. */
|
|
42
|
-
const PAGE =
|
|
43
|
+
const PAGE = 24;
|
|
43
44
|
const ANY = phrase('All');
|
|
45
|
+
const DOMAIN_DEFS = [
|
|
46
|
+
{ id: 'all', label: phrase('All') },
|
|
47
|
+
{ id: 'team', label: phrase('Core team') },
|
|
48
|
+
{ id: 'engineering', label: phrase('Engineering & science') },
|
|
49
|
+
{ id: 'business', label: phrase('Business & strategy') },
|
|
50
|
+
{ id: 'creative', label: phrase('Design & creative') },
|
|
51
|
+
{ id: 'thinking', label: phrase('Writing & thinking') },
|
|
52
|
+
];
|
|
53
|
+
const ENGINEERING_CATS = new Set([
|
|
54
|
+
'engineer', 'programmer', 'tech leader', 'cryptographer', 'scientist',
|
|
55
|
+
'mathematician', 'physicist', 'innovator', 'logician', 'architect',
|
|
56
|
+
]);
|
|
57
|
+
const BUSINESS_CATS = new Set([
|
|
58
|
+
'executive', 'leader', 'investor', 'economist', 'management',
|
|
59
|
+
'accountant', 'merchant', 'advertiser', 'jurist', 'diplomat', 'statesman',
|
|
60
|
+
]);
|
|
61
|
+
const CREATIVE_CATS = new Set([
|
|
62
|
+
'designer', 'artist', 'filmmaker', 'musician', 'composer',
|
|
63
|
+
'photographer', 'sculptor', 'choreographer', 'singer', 'comedian',
|
|
64
|
+
]);
|
|
65
|
+
function domainOf(c, isTeam) {
|
|
66
|
+
if (isTeam || c.category.toLowerCase() === 'team')
|
|
67
|
+
return 'team';
|
|
68
|
+
const cat = c.category.toLowerCase();
|
|
69
|
+
if (ENGINEERING_CATS.has(cat))
|
|
70
|
+
return 'engineering';
|
|
71
|
+
if (BUSINESS_CATS.has(cat))
|
|
72
|
+
return 'business';
|
|
73
|
+
if (CREATIVE_CATS.has(cat))
|
|
74
|
+
return 'creative';
|
|
75
|
+
return 'thinking';
|
|
76
|
+
}
|
|
44
77
|
const TRIGGER_LABELS = {
|
|
45
78
|
webhook: { title: phrase('Webhook & API events'), detail: phrase('Wake immediately when an inbound webhook or API event fires.') },
|
|
46
79
|
git: { title: phrase('Git, PR & CI events'), detail: phrase('React proactively to pushes, pull requests, and build failures.') },
|
|
@@ -102,6 +135,20 @@ const SO_FAR = {
|
|
|
102
135
|
};
|
|
103
136
|
const EACH = { day: phrase('Each day, USD'), week: phrase('Each week, USD'), month: phrase('Each month, USD') };
|
|
104
137
|
const PERIOD = { day: phrase('Day'), week: phrase('Week'), month: phrase('Month') };
|
|
138
|
+
const CARD = { rounded: '$4', borderWidth: 1, borderColor: '$borderColor', bg: '$panel' };
|
|
139
|
+
const CARD_HOVER = { borderColor: 'var(--border-strong)', bg: '$hover' };
|
|
140
|
+
/**
|
|
141
|
+
* Agent card: top row is [Avatar] [Name + short Role] [flex={1}] [+ Use], and
|
|
142
|
+
* the 2-line description spans full card width underneath so copy never crushes.
|
|
143
|
+
*/
|
|
144
|
+
function AgentCard({ title, role, detail, meta, mark, action, onOpen, }) {
|
|
145
|
+
const identity = (_jsxs(_Fragment, { children: [mark, _jsxs(YStack, { flex: 1, minW: 0, gap: "$0.5", children: [_jsx(SizableText, { size: "$3", color: "$ink", numberOfLines: 1, children: title }), role ? (_jsx(SizableText, { size: "$1", color: "$soft", numberOfLines: 1, children: role })) : null] })] }));
|
|
146
|
+
const footer = detail || meta ? (_jsxs(YStack, { width: "100%", minW: 0, gap: "$1.5", children: [detail ? (_jsx(SizableText, { size: "$2", color: "$soft", numberOfLines: 2, children: detail })) : null, meta ? (_jsx(SizableText, { size: "$1", color: "$hint", numberOfLines: 1, children: meta })) : null] })) : null;
|
|
147
|
+
if (onOpen && !action) {
|
|
148
|
+
return (_jsx(YStack, { role: "listitem", minW: 0, ...CARD, hoverStyle: CARD_HOVER, children: _jsxs(YStack, { render: "button", "aria-label": title, onPress: onOpen, width: "100%", minW: 0, p: "$4", gap: "$3", "$platform-web": { textAlign: 'start' }, focusVisibleStyle: RING, children: [_jsx(XStack, { items: "center", gap: "$3", width: "100%", minW: 0, children: identity }), footer] }) }));
|
|
149
|
+
}
|
|
150
|
+
return (_jsxs(YStack, { role: "listitem", gap: "$3", p: "$4", minW: 0, ...CARD, children: [_jsxs(XStack, { items: "center", gap: "$3", width: "100%", minW: 0, children: [onOpen ? (_jsx(XStack, { render: "button", "aria-label": title, onPress: onOpen, flex: 1, minW: 0, gap: "$3", items: "center", "$platform-web": { textAlign: 'start' }, focusVisibleStyle: RING, children: identity })) : (_jsx(XStack, { flex: 1, minW: 0, gap: "$3", items: "center", children: identity })), action] }), footer] }));
|
|
151
|
+
}
|
|
105
152
|
export function Agents({ view, q, adding, onAdding, onView, onCount, mode = 'agents' }) {
|
|
106
153
|
const { t } = useI18n();
|
|
107
154
|
const host = useHost();
|
|
@@ -114,12 +161,20 @@ export function Agents({ view, q, adding, onAdding, onView, onCount, mode = 'age
|
|
|
114
161
|
const yoursList = useMemo(() => (botsMode ? mine.value.filter((a) => a.executionMode === 'long-running') : mine.value.filter((a) => a.executionMode !== 'long-running')), [mine.value, botsMode]);
|
|
115
162
|
useCount(yoursList.length, onCount);
|
|
116
163
|
const [note, setNote] = useState('');
|
|
117
|
-
const [
|
|
164
|
+
const [domain, setDomain] = useState('all');
|
|
165
|
+
const [sortBy, setSortBy] = useState('recommended');
|
|
166
|
+
const [showSpecialists, setShowSpecialists] = useState(false);
|
|
118
167
|
const [more, setMore] = useState(PAGE);
|
|
119
168
|
const [using, setUsing] = useState(null);
|
|
169
|
+
const [scratch, setScratch] = useState(false);
|
|
120
170
|
const [making, setMaking] = useState(null);
|
|
121
171
|
const [electing, setElecting] = useState(null);
|
|
122
|
-
useEffect(() => setMore(PAGE), [q,
|
|
172
|
+
useEffect(() => setMore(PAGE), [q, domain, sortBy, botsMode]);
|
|
173
|
+
const allCast = host.cast ?? [];
|
|
174
|
+
const isBotCast = (c) => c.category === 'Bot' || c.executionMode === 'long-running';
|
|
175
|
+
const first = botsMode
|
|
176
|
+
? allCast.map(asBot)
|
|
177
|
+
: allCast.map((c) => (isBotCast(c) ? { ...c, category: 'Team', executionMode: undefined, schedule: undefined, triggers: undefined } : c));
|
|
123
178
|
const opened = (a) => host.go(path({ kind: 'agent', name: a.name }));
|
|
124
179
|
const take = async (c) => {
|
|
125
180
|
setUsing(c);
|
|
@@ -140,30 +195,87 @@ export function Agents({ view, q, adding, onAdding, onView, onCount, mode = 'age
|
|
|
140
195
|
setUsing(null);
|
|
141
196
|
}
|
|
142
197
|
};
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
198
|
+
// Toggleable creation panel opened by `+ New agent` / `+ New bot` — closed by default when browsing so the grid starts immediately.
|
|
199
|
+
const creator = adding && signed ? (_jsxs(YStack, { gap: "$3", p: "$4", rounded: "$4", borderWidth: 1, borderColor: "$borderColor", bg: "$panel", children: [_jsxs(XStack, { items: "center", justify: "space-between", gap: "$2", children: [_jsx(SizableText, { size: "$3", fontWeight: "500", color: "$ink", children: botsMode ? t('Create a new bot') : t('Create a new agent') }), _jsx(XStack, { render: "button", "aria-label": t('Close'), onPress: () => onAdding(false), width: 32, height: 32, items: "center", justify: "center", shrink: 0, focusVisibleStyle: RING, children: _jsx(X, { size: 15, color: "$soft" }) })] }), botsMode ? (_jsxs(_Fragment, { children: [_jsx(SizableText, { size: "$2", color: "$soft", children: t('Build a persistent 24/7 bot from scratch, or elect a preset to run on a schedule and event triggers.') }), _jsxs(XStack, { gap: "$2", flexWrap: "wrap", children: [_jsx(Button, { size: "sm", variant: "primary", onPress: () => {
|
|
200
|
+
onAdding(false);
|
|
201
|
+
setScratch(true);
|
|
202
|
+
}, children: t('Start from scratch') }), allCast.length ? (_jsx(Button, { size: "sm", variant: "outline", onPress: () => {
|
|
203
|
+
onAdding(false);
|
|
204
|
+
setElecting((first[0] ?? allCast[0]));
|
|
205
|
+
}, children: t('Elect 24/7 preset') })) : null] })] })) : (_jsxs(_Fragment, { children: [_jsx(Drafted, { onMade: opened }), _jsxs(XStack, { gap: "$2", flexWrap: "wrap", items: "center", pt: "$1", borderTopWidth: 1, borderColor: "$borderColor", children: [_jsx(SizableText, { size: "$1", color: "$soft", paddingInlineEnd: "$1", children: t('Or start another way') }), _jsx(Button, { size: "sm", variant: "outline", onPress: () => {
|
|
206
|
+
onAdding(false);
|
|
207
|
+
setScratch(true);
|
|
208
|
+
}, children: t('Start from scratch') }), _jsx(Button, { size: "sm", variant: "outline", onPress: () => {
|
|
209
|
+
onAdding(false);
|
|
210
|
+
setMaking('self');
|
|
211
|
+
}, children: t('Clone yourself') }), _jsx(Button, { size: "sm", variant: "outline", onPress: () => {
|
|
212
|
+
onAdding(false);
|
|
213
|
+
setMaking('person');
|
|
214
|
+
}, children: t('Create from a person') })] })] }))] })) : null;
|
|
215
|
+
const modals = (_jsxs(_Fragment, { children: [scratch ? (_jsx(Editor, { defaultBot: botsMode, onClose: () => setScratch(false), onSaved: (a) => {
|
|
216
|
+
setScratch(false);
|
|
217
|
+
onAdding(false);
|
|
218
|
+
onView('yours');
|
|
219
|
+
mine.reload();
|
|
220
|
+
setNote(t('{name} is saved', { name: a.name }));
|
|
221
|
+
} })) : null, making ? _jsx(Person, { self: making === 'self', onClose: () => setMaking(null), onMade: opened }) : null, electing ? _jsx(Elect, { preset: electing, all: allCast, onClose: () => setElecting(null), onElected: opened }) : null] }));
|
|
149
222
|
if (browsing) {
|
|
150
|
-
const allCast = host.cast ?? [];
|
|
151
|
-
const isBotCast = (c) => c.category === 'Bot' || c.executionMode === 'long-running';
|
|
152
|
-
const first = botsMode
|
|
153
|
-
? allCast.map(asBot)
|
|
154
|
-
: allCast.map((c) => (isBotCast(c) ? { ...c, category: 'Team', executionMode: undefined, schedule: undefined, triggers: undefined } : c));
|
|
155
223
|
const rest = botsMode ? [] : figures.value.filter((c) => !isBotCast(c));
|
|
156
|
-
const
|
|
157
|
-
const
|
|
158
|
-
const
|
|
159
|
-
|
|
224
|
+
const teamSet = new Set(first.map((c) => `${c.name}/${c.title}`));
|
|
225
|
+
const sortList = (list) => sortBy === 'az' ? [...list].sort((a, b) => a.title.localeCompare(b.title)) : [...list];
|
|
226
|
+
const queryText = q.trim();
|
|
227
|
+
const matchCast = (c) => matches(q, c.title, c.name, c.description, c.category, ...(c.after ?? []));
|
|
228
|
+
const teamFiltered = sortList(first.filter((c) => (botsMode || domain === 'all' || domain === 'team') && matchCast(c)));
|
|
229
|
+
const specialistsFiltered = sortList(rest.filter((c) => !botsMode &&
|
|
230
|
+
(domain === 'all' || domainOf(c, teamSet.has(`${c.name}/${c.title}`)) === domain) &&
|
|
231
|
+
matchCast(c)));
|
|
232
|
+
const card = (c, inCoreTeam = false) => {
|
|
233
|
+
const cat = botsMode ? t('Bot') : category(c.category, t);
|
|
234
|
+
const hideTeamLabel = inCoreTeam && !botsMode && c.category.toLowerCase() === 'team';
|
|
235
|
+
const role = hideTeamLabel
|
|
236
|
+
? c.after?.length
|
|
237
|
+
? t('after {names}', { names: c.after.join(', ') })
|
|
238
|
+
: undefined
|
|
239
|
+
: cat || undefined;
|
|
240
|
+
const detail = [
|
|
241
|
+
c.description === c.title || c.description === c.category ? '' : c.description,
|
|
242
|
+
!hideTeamLabel && c.after?.length ? t('after {names}', { names: c.after.join(', ') }) : '',
|
|
243
|
+
]
|
|
244
|
+
.filter(Boolean)
|
|
245
|
+
.join(' · ') || undefined;
|
|
246
|
+
const meta = botsMode
|
|
247
|
+
? [c.executionMode === 'long-running' ? t('24/7 · proactive · event-driven') : '', c.schedule].filter(Boolean).join(' · ') || undefined
|
|
248
|
+
: undefined;
|
|
249
|
+
return (_jsx(AgentCard, { title: c.title, role: role, detail: detail, meta: meta, mark: _jsx(Mark, { name: c.title, size: 40, logo: c.avatar }), onOpen: signed && botsMode ? () => setElecting(c) : undefined, action: signed ? (_jsxs(XStack, { items: "center", gap: "$1.5", shrink: 0, children: [botsMode ? (_jsx(XStack, { "$max-sm": { display: 'none' }, children: _jsx(Button, { size: "sm", variant: "ghost", disabled: using !== null, "aria-label": t('Elect {name} to run 24/7', { name: c.title }), onPress: () => setElecting(c), children: t('Configure 24/7') }) })) : null, _jsx(Add, { name: c.title, use: true, added: false, busy: using !== null, onPress: () => void take(c) })] })) : undefined }, `${c.category}/${c.name}/${c.title}`));
|
|
250
|
+
};
|
|
251
|
+
const domainCounts = {
|
|
252
|
+
all: first.length + rest.length,
|
|
253
|
+
team: first.length,
|
|
254
|
+
engineering: rest.filter((c) => domainOf(c, false) === 'engineering').length,
|
|
255
|
+
business: rest.filter((c) => domainOf(c, false) === 'business').length,
|
|
256
|
+
creative: rest.filter((c) => domainOf(c, false) === 'creative').length,
|
|
257
|
+
thinking: rest.filter((c) => domainOf(c, false) === 'thinking').length,
|
|
258
|
+
};
|
|
259
|
+
const domainOptions = DOMAIN_DEFS.filter((d) => d.id === 'all' || d.id === 'team' || domainCounts[d.id] > 0).map((d) => ({
|
|
260
|
+
id: d.id,
|
|
261
|
+
label: d.id === 'all' ? t(d.label) : `${t(d.label)}`,
|
|
262
|
+
}));
|
|
263
|
+
const hasAnyMatch = teamFiltered.length > 0 || specialistsFiltered.length > 0;
|
|
264
|
+
const showGroupedAll = !botsMode && domain === 'all' && !queryText;
|
|
265
|
+
const specialistsVisible = showGroupedAll ? showSpecialists : true;
|
|
266
|
+
return (_jsxs(YStack, { gap: "$4", children: [creator, !botsMode && domainOptions.length > 1 ? (_jsxs(XStack, { items: "center", justify: "space-between", gap: "$3", flexWrap: "wrap", children: [_jsx(XStack, { grow: 1, shrink: 1, minW: 0, children: _jsx(FilterPills, { label: t('Category'), value: domain, options: domainOptions, onChange: (next) => setDomain(next), maxVisibleDesktop: 6, mobileLimit: 4 }) }), _jsx(XStack, { role: "radiogroup", "aria-label": t('Sort agents'), items: "center", gap: 2, p: 2, shrink: 0, children: [
|
|
267
|
+
{ id: 'recommended', label: t('Recommended') },
|
|
268
|
+
{ id: 'az', label: t('A–Z') },
|
|
269
|
+
].map((opt) => {
|
|
270
|
+
const active = sortBy === opt.id;
|
|
271
|
+
return (_jsx(XStack, { render: "button", role: "radio", "aria-checked": active, onPress: () => setSortBy(opt.id), px: "$2.5", py: "$1", minH: 28, focusVisibleStyle: RING, items: "center", justify: "center", children: _jsx(SizableText, { size: "$1", fontWeight: active ? '600' : '400', color: active ? '$ink' : '$soft', children: opt.label }) }, opt.id));
|
|
272
|
+
}) })] })) : null, _jsx(Line, { children: note }), !hasAnyMatch ? (figures.loading ? null : queryText ? (_jsx(Soft, { children: t(botsMode ? 'No bot matches “{q}”.' : 'No agent matches “{q}”.', { q: queryText }) })) : botsMode ? (_jsx(Soft, { children: t('Create a persistent 24/7 bot from scratch or elect any preset.') })) : (_jsx(Soft, { children: t('No agent matches “{q}”.', { q: queryText }) }))) : (_jsxs(YStack, { gap: "$5", children: [teamFiltered.length > 0 ? (_jsxs(YStack, { gap: "$3", children: [!botsMode ? (_jsxs(XStack, { items: "baseline", justify: "space-between", gap: "$2", children: [_jsx(SizableText, { render: "h2", size: "$4", color: "$ink", children: t('Core team') }), _jsx(SizableText, { size: "$1", color: "$soft", fontVariant: ['tabular-nums'], children: t('{n} ready-to-use specialists', { n: teamFiltered.length }) })] })) : null, _jsx(Grid, { label: botsMode ? t('Bots to start from') : t('Core team agents'), children: teamFiltered.map((c) => card(c, !botsMode)) })] })) : null, specialistsFiltered.length > 0 ? (_jsxs(YStack, { gap: "$3", pt: teamFiltered.length > 0 ? '$5' : 0, borderTopWidth: teamFiltered.length > 0 ? 1 : 0, children: [_jsxs(XStack, { items: "center", justify: "space-between", gap: "$3", flexWrap: "wrap", children: [_jsxs(YStack, { gap: "$1.5", flex: 1, minW: 200, children: [_jsx(SizableText, { render: "h2", size: "$4", color: "$ink", children: domain === 'all' ? t('Domain thinkers & personas') : t(DOMAIN_DEFS.find((d) => d.id === domain)?.label ?? 'Personas') }), _jsx(SizableText, { size: "$2", color: "$soft", children: t('{n} curated personas across science, strategy, design, and writing', { n: specialistsFiltered.length }) })] }), showGroupedAll ? (_jsx(Button, { size: "sm", variant: "outline", onPress: () => setShowSpecialists((v) => !v), children: showSpecialists ? t('Hide personas') : t('Browse {n} personas', { n: specialistsFiltered.length }) })) : null] }), specialistsVisible ? (_jsxs(_Fragment, { children: [_jsx(Grid, { label: t('Domain thinkers & personas'), children: specialistsFiltered.slice(0, more).map((c) => card(c, false)) }), specialistsFiltered.length > more ? (_jsx(XStack, { children: _jsx(Button, { size: "sm", variant: "outline", onPress: () => setMore(more + PAGE), children: t('Show more ({remaining} left)', { remaining: specialistsFiltered.length - more }) }) })) : null] })) : null] })) : null] })), figures.error ? _jsx(Failed, { error: figures.error, onRetry: figures.reload }) : figures.loading ? _jsx(Soft, { children: t('Loading…') }) : null, modals] }));
|
|
160
273
|
}
|
|
161
274
|
if (!signed) {
|
|
162
275
|
return _jsx(Visitor, { children: t(botsMode ? 'Sign in to see your bots.' : 'Sign in to see your agents.') });
|
|
163
276
|
}
|
|
164
277
|
const shown = yoursList.filter((a) => matches(q, a.name, a.description, a.model));
|
|
165
|
-
return (_jsxs(YStack, { gap: "$3", children: [_jsx(Line, { children: note }), mine.error && !yoursList.length ? (_jsx(Failed, { error: mine.error, onRetry: mine.reload })) : mine.loading && !yoursList.length ? (_jsx(Soft, { children: t(botsMode ? 'Loading your bots…' : 'Loading your agents…') })) : !yoursList.length ? (_jsxs(Empty, { title: t(botsMode ? 'No bots yet' : 'No agents yet'), detail:
|
|
166
|
-
a.model,
|
|
278
|
+
return (_jsxs(YStack, { gap: "$3", children: [creator, _jsx(Line, { children: note }), mine.error && !yoursList.length ? (_jsx(Failed, { error: mine.error, onRetry: mine.reload })) : mine.loading && !yoursList.length ? (_jsx(Soft, { children: t(botsMode ? 'Loading your bots…' : 'Loading your agents…') })) : !yoursList.length ? (_jsxs(Empty, { title: t(botsMode ? 'No bots yet' : 'No agents yet'), detail: t(botsMode ? 'Create a 24/7 bot from scratch or browse presets to start from.' : 'Create one with AI, from scratch, or browse agents to start from.'), children: [_jsx(Button, { size: "sm", variant: "outline", onPress: () => onView('discover'), children: t(botsMode ? 'Browse bots' : 'Browse agents') }), _jsx(Button, { size: "sm", onPress: () => onAdding(true), children: t(botsMode ? 'New bot' : 'New agent') })] })) : !shown.length ? (_jsx(Soft, { children: t(botsMode ? 'No bot of yours matches “{q}”.' : 'No agent of yours matches “{q}”.', { q: q.trim() }) })) : (_jsx(Grid, { label: t(botsMode ? 'Your bots' : 'Your agents'), children: shown.map((a) => (_jsx(AgentCard, { title: a.name, role: a.model || undefined, detail: a.description || t('No description.'), meta: [
|
|
167
279
|
a.executionMode === 'long-running' ? t('24/7') : '',
|
|
168
280
|
a.schedule || '',
|
|
169
281
|
a.runs === 1 ? t('1 run') : t('{n} runs', { n: a.runs }),
|
|
@@ -171,7 +283,7 @@ export function Agents({ view, q, adding, onAdding, onView, onCount, mode = 'age
|
|
|
171
283
|
a.cap ? t(SPENT[a.period], { spent: money(a.spent), cap: money(a.cap) }) : '',
|
|
172
284
|
]
|
|
173
285
|
.filter(Boolean)
|
|
174
|
-
.join(' · '), mark: _jsx(Face, { agent: a, cast: host.cast ?? [] }), onOpen: () => opened(a) }, a.id || a.name))) })),
|
|
286
|
+
.join(' · '), mark: _jsx(Face, { agent: a, cast: host.cast ?? [] }), onOpen: () => opened(a) }, a.id || a.name))) })), modals] }));
|
|
175
287
|
}
|
|
176
288
|
/** Elect an agent or bot preset to run autonomously 24/7, proactively on a schedule, and event-driven. */
|
|
177
289
|
function Elect({ preset, all, onClose, onElected, }) {
|
|
@@ -213,10 +325,13 @@ function Elect({ preset, all, onClose, onElected, }) {
|
|
|
213
325
|
setWorking(false);
|
|
214
326
|
}
|
|
215
327
|
};
|
|
216
|
-
return (_jsxs(Sheet, { title: t('Elect 24/7 autonomous preset'), open: true, onOpenChange: (o) => !o && onClose(), width: 680, children: [_jsxs(XStack, { items: "center", gap: "$3", p: "$3", rounded: "$3", borderWidth: 1, borderColor: "$borderColor", children: [_jsx(Mark, { name: picked.title, size: 44, logo: picked.avatar }), _jsxs(YStack, { flex: 1, minW: 0, children: [_jsx(SizableText, { size: "$3", color: "$ink", children: picked.title }), _jsx(SizableText, { size: "$1", color: "$soft", numberOfLines: 2, children: picked.description || picked.category })] })] }), all.length > 1 ? (_jsx(Field, { label: t('Preset'), hint: t('Select any
|
|
328
|
+
return (_jsxs(Sheet, { title: t('Elect 24/7 autonomous preset'), open: true, onOpenChange: (o) => !o && onClose(), width: 680, children: [_jsxs(XStack, { items: "center", gap: "$3", p: "$3", rounded: "$3", borderWidth: 1, borderColor: "$borderColor", children: [_jsx(Mark, { name: picked.title, size: 44, logo: picked.avatar }), _jsxs(YStack, { flex: 1, minW: 0, children: [_jsx(SizableText, { size: "$3", color: "$ink", children: picked.title }), _jsx(SizableText, { size: "$1", color: "$soft", numberOfLines: 2, children: picked.description || picked.category })] })] }), all.length > 1 ? (_jsx(Field, { label: t('Preset'), hint: t('Select any agent or bot preset to elect as an autonomous 24/7 worker.'), children: _jsx(XStack, { gap: "$1.5", flexWrap: "wrap", maxH: 136, overflow: "scroll", p: "$1", borderWidth: 1, borderColor: "$borderColor", bg: "$panel", rounded: "$3", children: all.map((c) => {
|
|
217
329
|
const active = c.name === picked.name && c.category === picked.category;
|
|
218
|
-
return (_jsx(Button, { size: "sm", variant: active ? '
|
|
219
|
-
}) }) })) : null, _jsxs(XStack, { items: "center", gap: "$3", p: "$3", rounded: "$3", borderWidth: 1, borderColor: "$borderColor", children: [_jsxs(YStack, { flex: 1, minW: 0, children: [_jsx(SizableText, { size: "$2", color: "$ink", children: t('Run autonomously 24/7') }), _jsx(SizableText, { size: "$1", color: "$soft", children: t('Stays active continuously (long-running), waking proactively on its schedule and when events fire.') })] }), _jsx(Switch, { checked: autonomous, onCheckedChange: setAutonomous, "aria-label": t('Run autonomously 24/7') })] }), autonomous ? (_jsxs(_Fragment, { children: [_jsx(Field, { label: t('Proactive schedule'), hint: t('Choose how often this agent wakes proactively, or enter any 5-field cron expression.'), children: _jsxs(YStack, { gap: "$2", children: [_jsx(XStack, { gap: "$1.5", flexWrap: "wrap", children: SCHEDULES.map((s) =>
|
|
330
|
+
return (_jsx(Button, { size: "sm", variant: active ? 'outline' : 'ghost', "aria-pressed": active, onPress: () => selectPreset(c), children: c.title }, `${c.category}/${c.name}`));
|
|
331
|
+
}) }) })) : null, _jsxs(XStack, { items: "center", gap: "$3", p: "$3", rounded: "$3", borderWidth: 1, borderColor: "$borderColor", children: [_jsxs(YStack, { flex: 1, minW: 0, children: [_jsx(SizableText, { size: "$2", color: "$ink", children: t('Run autonomously 24/7') }), _jsx(SizableText, { size: "$1", color: "$soft", children: t('Stays active continuously (long-running), waking proactively on its schedule and when events fire.') })] }), _jsx(Switch, { checked: autonomous, onCheckedChange: setAutonomous, "aria-label": t('Run autonomously 24/7') })] }), autonomous ? (_jsxs(_Fragment, { children: [_jsx(Field, { label: t('Proactive schedule'), hint: t('Choose how often this agent wakes proactively, or enter any 5-field cron expression.'), children: _jsxs(YStack, { gap: "$2", children: [_jsx(XStack, { gap: "$1.5", flexWrap: "wrap", children: SCHEDULES.map((s) => {
|
|
332
|
+
const active = schedule.trim() === s.cron;
|
|
333
|
+
return (_jsx(Button, { size: "sm", variant: "outline", "aria-pressed": active, onPress: () => setSchedule(s.cron), children: t(s.label) }, s.cron));
|
|
334
|
+
}) }), _jsx(Input, { value: schedule, onChangeText: setSchedule, placeholder: "*/15 * * * *", "aria-label": t('Proactive schedule') })] }) }), _jsxs(YStack, { gap: "$2", children: [_jsx(SizableText, { size: "$2", color: "$ink", children: t('Event-driven triggers') }), _jsx(YStack, { borderWidth: 1, borderColor: "$borderColor", rounded: "$3", children: TRIGGERS.map((tr, i) => (_jsxs(XStack, { items: "center", gap: "$3", px: "$3", py: "$2", borderTopWidth: i ? 1 : 0, borderColor: "$borderColor", children: [_jsxs(YStack, { flex: 1, minW: 0, children: [_jsx(SizableText, { size: "$2", color: "$ink", children: t(TRIGGER_LABELS[tr].title) }), _jsx(SizableText, { size: "$1", color: "$soft", children: t(TRIGGER_LABELS[tr].detail) })] }), _jsx(Switch, { checked: triggers.includes(tr), onCheckedChange: (v) => toggleTrigger(tr, v), "aria-label": t(TRIGGER_LABELS[tr].title) })] }, tr))) })] })] })) : null, _jsxs(YStack, { gap: "$2", children: [_jsx(SizableText, { size: "$2", color: "$ink", children: t('Budget') }), _jsxs(XStack, { gap: "$3", flexWrap: "wrap", rowGap: "$2", items: "flex-end", children: [_jsxs(YStack, { gap: "$1", width: 140, children: [_jsx(SizableText, { size: "$1", color: "$soft", children: t(EACH[period]) }), _jsx(Input, { value: cap, onChangeText: setCap, placeholder: "10", "aria-label": t('Budget each period'), inputMode: "decimal" })] }), _jsxs(YStack, { gap: "$1", width: 140, children: [_jsx(SizableText, { size: "$1", color: "$soft", children: t('One run, USD') }), _jsx(Input, { value: task, onChangeText: setTask, placeholder: "1", "aria-label": t('Budget for one run'), inputMode: "decimal" })] }), _jsx(Choice, { label: t('Period'), value: period, options: PERIODS.map((p) => ({ id: p, label: t(PERIOD[p]) })), onChange: (p) => setPeriod(p) })] })] }), _jsx(Line, { children: note }), _jsxs(XStack, { gap: "$2", items: "center", children: [_jsx(XStack, { flex: 1 }), _jsx(Button, { size: "sm", variant: "ghost", onPress: onClose, children: t('Cancel') }), _jsx(Button, { size: "sm", variant: "primary", disabled: working || (autonomous && !schedule.trim()), onPress: () => void save(), children: autonomous ? t('Elect and run 24/7') : t('Create') })] })] }));
|
|
220
335
|
}
|
|
221
336
|
/**
|
|
222
337
|
* Clone yourself, or anyone named: a name, who they are, and writing of theirs,
|
|
@@ -291,11 +406,11 @@ export function Profile({ name }) {
|
|
|
291
406
|
const a = got.value?.agent;
|
|
292
407
|
const isBot = a?.executionMode === 'long-running';
|
|
293
408
|
const back = () => host.go(path({ kind: 'customize', tab: isBot ? 'bots' : 'agents' }));
|
|
294
|
-
return (_jsxs(YStack, { flex: 1, minH: 0, overflow: "scroll", px: "$6", py: "$6", "$max-md": { px: '$4', py: '$4' }, children: [_jsxs(YStack, { width: "100%", maxW: 880, mx: "auto", gap: "$5", children: [_jsxs(XStack, { render: "button", onPress: back, items: "center", gap: "$1.5", self: "flex-start", cursor: "pointer", "aria-label": t(isBot ? 'Back to bots' : 'Back to agents'), children: [_jsx(ArrowLeft, { size: 14, color: "$soft", 'data-i18n-mirror': '' }), _jsx(SizableText, { size: "$2", color: "$soft", children: t(isBot ? 'Bots' : 'Agents') })] }), !host.person ? (_jsx(Visitor, { children: t('Sign in to see this agent.') })) : got.error && !a ? (_jsx(Failed, { error: got.error, onRetry: got.reload })) : !a ? (_jsx(Soft, { children: t('Loading the agent…') })) : (_jsxs(_Fragment, { children: [_jsxs(XStack, { items: "center", gap: "$4", children: [_jsx(Face, { agent: a, cast: host.cast ?? [], size: 64 }), _jsxs(YStack, { flex: 1, minW: 0, gap: "$1", children: [_jsx(SizableText, { render: "h1", size: "$7", color: "$ink", numberOfLines: 1, children: a.name }), _jsx(SizableText, { size: "$3", color: "$soft", children: a.description || t('No role written yet.') })] }), _jsx(Button, { size: "sm", variant: "outline", onPress: () => setEditing(true), children: t('Edit') })] }), _jsx(Part, { title: t('Model'), detail: a.model || t('The deployment’s default') }), _jsx(Part, { title: t('Autonomous
|
|
409
|
+
return (_jsxs(YStack, { flex: 1, minH: 0, overflow: "scroll", px: "$6", py: "$6", "$max-md": { px: '$4', py: '$4' }, children: [_jsxs(YStack, { width: "100%", maxW: 880, mx: "auto", gap: "$5", children: [_jsxs(XStack, { render: "button", onPress: back, items: "center", gap: "$1.5", self: "flex-start", cursor: "pointer", "aria-label": t(isBot ? 'Back to bots' : 'Back to agents'), children: [_jsx(ArrowLeft, { size: 14, color: "$soft", 'data-i18n-mirror': '' }), _jsx(SizableText, { size: "$2", color: "$soft", children: t(isBot ? 'Bots' : 'Agents') })] }), !host.person ? (_jsx(Visitor, { children: t('Sign in to see this agent.') })) : got.error && !a ? (_jsx(Failed, { error: got.error, onRetry: got.reload })) : !a ? (_jsx(Soft, { children: t('Loading the agent…') })) : (_jsxs(_Fragment, { children: [_jsxs(XStack, { items: "center", gap: "$4", children: [_jsx(Face, { agent: a, cast: host.cast ?? [], size: 64 }), _jsxs(YStack, { flex: 1, minW: 0, gap: "$1", children: [_jsx(SizableText, { render: "h1", size: "$7", color: "$ink", numberOfLines: 1, children: a.name }), _jsx(SizableText, { size: "$3", color: "$soft", children: a.description || t('No role written yet.') })] }), _jsx(Button, { size: "sm", variant: "outline", onPress: () => setEditing(true), children: t('Edit') })] }), _jsx(Part, { title: t('Model'), detail: a.model || t('The deployment’s default') }), _jsx(Part, { title: t('Autonomous and event-driven'), detail: a.executionMode === 'long-running'
|
|
295
410
|
? [t('Runs autonomously 24/7'), a.schedule ? `${t('Schedule')}: ${a.schedule}` : '', a.triggers?.length ? `${t('Triggers')}: ${a.triggers.join(', ')}` : '']
|
|
296
411
|
.filter(Boolean)
|
|
297
412
|
.join(' · ')
|
|
298
|
-
: t('One-shot (on-demand). Edit to enable 24/7 proactive and event-driven execution.') }), _jsx(Part, { title: t('Instructions'), detail: a.instructions ? '' : t('None written: it runs on its model alone.'), children: a.instructions ? (_jsx(YStack, { p: "$3", rounded: "$3", borderWidth: 1, borderColor: "$borderColor", maxH: 320, overflow: "scroll", children: _jsx(SizableText, { size: "$2", color: "$ink",
|
|
413
|
+
: t('One-shot (on-demand). Edit to enable 24/7 proactive and event-driven execution.') }), _jsx(Part, { title: t('Instructions'), detail: a.instructions ? '' : t('None written: it runs on its model alone.'), children: a.instructions ? (_jsx(YStack, { p: "$3", rounded: "$3", borderWidth: 1, borderColor: "$borderColor", bg: "$panel", maxH: 320, overflow: "scroll", children: _jsx(SizableText, { size: "$2", color: "$ink", "$platform-web": { whiteSpace: 'pre-wrap' }, children: a.instructions }) })) : null }), _jsx(Part, { title: t('Tools'), detail: a.tools.includes(ALL) ? t('Every tool the fleet’s MCP server serves.') : a.tools.length ? a.tools.join(', ') : t('None: it calls no tool.') }), _jsx(Part, { title: t('Budget'), detail: a.cap ? t(BUDGET[a.period], { spent: money(a.spent), cap: money(a.cap), task: money(a.task) }) : t('No budget set.') }), _jsx(Part, { title: t('Runs'), detail: a.runs ? t('{runs} in all; the latest {n} below.', { runs: a.runs, n: Math.min(a.runs, got.value.runs.length) }) : t('It has not run yet.'), children: got.value.runs.map((r) => (_jsxs(XStack, { gap: "$3", py: "$2", borderTopWidth: 1, borderColor: "$borderColor", items: "flex-start", children: [_jsx(SizableText, { size: "$1", color: r.status === 'ok' ? '$soft' : '$bad', width: 44, shrink: 0, children: r.status === 'ok' ? t('ok') : t('failed') }), _jsxs(YStack, { flex: 1, minW: 0, children: [_jsx(SizableText, { size: "$2", color: "$ink", numberOfLines: 1, children: r.input || t('(no input)') }), _jsx(SizableText, { size: "$1", color: "$soft", numberOfLines: 2, children: r.status === 'ok' ? r.output : r.error })] }), _jsx(SizableText, { size: "$1", color: "$soft", shrink: 0, children: [r.model, r.at ? new Date(r.at).toLocaleString() : ''].filter(Boolean).join(' · ') })] }, r.id))) })] }))] }), editing && a ? (_jsx(Editor, { agent: a, onClose: () => setEditing(false), onSaved: () => {
|
|
299
414
|
setEditing(false);
|
|
300
415
|
got.reload();
|
|
301
416
|
}, onDeleted: back })) : null] }));
|
|
@@ -353,13 +468,16 @@ function Editor({ agent, defaultBot = false, onClose, onSaved, onDeleted, }) {
|
|
|
353
468
|
? t('Every tool the fleet’s MCP server serves when it runs.')
|
|
354
469
|
: d.tools.length
|
|
355
470
|
? t('{n} chosen. It can call only these.', { n: d.tools.length })
|
|
356
|
-
: t('None chosen: it can call no tool.') })] }), _jsx(SizableText, { size: "$1", color: "$soft", children: t('Every tool') }), _jsx(Switch, { checked: every, onCheckedChange: (v) => set({ tools: v ? [ALL] : [] }), "aria-label": t('Every tool') })] }), every ? null : (_jsxs(_Fragment, { children: [_jsx(Input, { value: find, onChangeText: setFind, placeholder: t('Find a tool…'), "aria-label": t('Find a tool') }), _jsx(YStack, { borderWidth: 1, borderColor: "$borderColor", rounded: "$3", maxH: 240, overflow: "scroll", children: on.loading && !on.value.length ? (_jsx(Soft, { children: t('Loading the tools that are on…') })) : on.error && !on.value.length ? (_jsx(Failed, { error: on.error, onRetry: on.reload })) : !shownTools.length ? (_jsx(Soft, { children: choices.length ? t('No tool matches.') : t('No tool is on for your organization yet. Add skills or connectors first.') })) : (shownTools.map((x, i) => (_jsxs(XStack, { items: "center", gap: "$3", px: "$3", py: "$2", borderTopWidth: i ? 1 : 0, borderColor: "$borderColor", children: [_jsxs(YStack, { flex: 1, minW: 0, children: [_jsx(SizableText, { size: "$2", color: "$ink",
|
|
471
|
+
: t('None chosen: it can call no tool.') })] }), _jsx(SizableText, { size: "$1", color: "$soft", children: t('Every tool') }), _jsx(Switch, { checked: every, onCheckedChange: (v) => set({ tools: v ? [ALL] : [] }), "aria-label": t('Every tool') })] }), every ? null : (_jsxs(_Fragment, { children: [_jsx(Input, { value: find, onChangeText: setFind, placeholder: t('Find a tool…'), "aria-label": t('Find a tool') }), _jsx(YStack, { borderWidth: 1, borderColor: "$borderColor", rounded: "$3", maxH: 240, overflow: "scroll", children: on.loading && !on.value.length ? (_jsx(Soft, { children: t('Loading the tools that are on…') })) : on.error && !on.value.length ? (_jsx(Failed, { error: on.error, onRetry: on.reload })) : !shownTools.length ? (_jsx(Soft, { children: choices.length ? t('No tool matches.') : t('No tool is on for your organization yet. Add skills or connectors first.') })) : (shownTools.map((x, i) => (_jsxs(XStack, { items: "center", gap: "$3", px: "$3", py: "$2", borderTopWidth: i ? 1 : 0, borderColor: "$borderColor", children: [_jsxs(YStack, { flex: 1, minW: 0, children: [_jsx(SizableText, { size: "$2", color: "$ink", fontFamily: "$mono", numberOfLines: 1, children: x.name }), _jsx(SizableText, { size: "$1", color: "$soft", numberOfLines: 1, children: [x.source, x.description].filter(Boolean).join(' · ') })] }), _jsx(Switch, { checked: d.tools.includes(x.name), onCheckedChange: (v) => pick(x.name, v), "aria-label": t('Use {name}', { name: x.name }) })] }, x.name)))) })] }))] }), _jsxs(YStack, { gap: "$2", children: [_jsxs(XStack, { items: "center", gap: "$3", children: [_jsxs(YStack, { flex: 1, minW: 0, children: [_jsx(SizableText, { size: "$2", color: "$ink", children: t('Autonomous and event-driven (24/7)') }), _jsx(SizableText, { size: "$1", color: "$soft", children: d.executionMode === 'long-running'
|
|
357
472
|
? t('Runs autonomously 24/7 on its proactive schedule and event triggers.')
|
|
358
473
|
: t('One-shot (on-demand). Turn on to run autonomously 24/7.') })] }), _jsx(Switch, { checked: d.executionMode === 'long-running', onCheckedChange: (v) => set(v
|
|
359
474
|
? { executionMode: 'long-running', schedule: d.schedule || '*/15 * * * *', triggers: d.triggers?.length ? d.triggers : ['webhook', 'git', 'channel', 'watch'] }
|
|
360
|
-
: { executionMode: undefined, schedule: undefined, triggers: undefined }), "aria-label": t('Run autonomously 24/7') })] }), d.executionMode === 'long-running' ? (_jsxs(YStack, { gap: "$2", p: "$3", borderWidth: 1, borderColor: "$borderColor", rounded: "$3", children: [_jsx(SizableText, { size: "$1", color: "$soft", children: t('Proactive schedule (5-field cron)') }), _jsx(XStack, { gap: "$1.5", flexWrap: "wrap", children: SCHEDULES.map((s) =>
|
|
475
|
+
: { executionMode: undefined, schedule: undefined, triggers: undefined }), "aria-label": t('Run autonomously 24/7') })] }), d.executionMode === 'long-running' ? (_jsxs(YStack, { gap: "$2", p: "$3", borderWidth: 1, borderColor: "$borderColor", rounded: "$3", children: [_jsx(SizableText, { size: "$1", color: "$soft", children: t('Proactive schedule (5-field cron)') }), _jsx(XStack, { gap: "$1.5", flexWrap: "wrap", children: SCHEDULES.map((s) => {
|
|
476
|
+
const active = (d.schedule ?? '').trim() === s.cron;
|
|
477
|
+
return (_jsx(Button, { size: "sm", variant: "outline", "aria-pressed": active, onPress: () => set({ schedule: s.cron }), children: t(s.label) }, s.cron));
|
|
478
|
+
}) }), _jsx(Input, { value: d.schedule ?? '', onChangeText: (v) => set({ schedule: v }), placeholder: "*/15 * * * *", "aria-label": t('Proactive schedule') }), _jsx(SizableText, { size: "$1", color: "$soft", children: t('Event-driven triggers') }), _jsx(XStack, { gap: "$1.5", flexWrap: "wrap", children: TRIGGERS.map((tr) => {
|
|
361
479
|
const active = (d.triggers ?? []).includes(tr);
|
|
362
|
-
return (_jsx(Button, { size: "sm", variant:
|
|
480
|
+
return (_jsx(Button, { size: "sm", variant: "outline", "aria-pressed": active, onPress: () => set({ triggers: active ? (d.triggers ?? []).filter((x) => x !== tr) : [...(d.triggers ?? []), tr] }), children: t(TRIGGER_LABELS[tr].title) }, tr));
|
|
363
481
|
}) })] })) : null] }), _jsxs(YStack, { gap: "$2", children: [_jsx(SizableText, { size: "$2", color: "$ink", children: t('Budget') }), _jsxs(XStack, { gap: "$3", flexWrap: "wrap", rowGap: "$2", items: "flex-end", children: [_jsxs(YStack, { gap: "$1", width: 140, children: [_jsx(SizableText, { size: "$1", color: "$soft", children: t(EACH[d.period]) }), _jsx(Input, { value: d.cap, onChangeText: (v) => set({ cap: v }), placeholder: "10", "aria-label": t('Budget each period'), inputMode: "decimal" })] }), _jsxs(YStack, { gap: "$1", width: 140, children: [_jsx(SizableText, { size: "$1", color: "$soft", children: t('One run, USD') }), _jsx(Input, { value: d.task, onChangeText: (v) => set({ task: v }), placeholder: "1", "aria-label": t('Budget for one run'), inputMode: "decimal" })] }), _jsx(Choice, { label: t('Period'), value: d.period, options: PERIODS.map((p) => ({ id: p, label: t(PERIOD[p]) })), onChange: (p) => set({ period: p }) })] }), _jsx(SizableText, { size: "$1", color: "$soft", children: [full.value && full.value.cap ? t(SO_FAR[full.value.period], { spent: money(full.value.spent) }) : '', t('A run stops at either limit.')].filter(Boolean).join(' ') })] }), _jsx(Line, { children: note }), _jsxs(XStack, { gap: "$2", items: "center", children: [agent && onDeleted ? (_jsx(Button, { size: "sm", variant: "ghost", onPress: () => setAsking(true), children: t('Delete') })) : null, _jsx(XStack, { flex: 1 }), _jsx(Button, { size: "sm", variant: "ghost", onPress: onClose, children: t('Cancel') }), _jsx(Button, { size: "sm", disabled: working, onPress: () => void save(), children: agent ? t('Save') : t('Create') })] }), agent && onDeleted ? (_jsx(Confirm, { what: agent.name, says: t('The agent and every run recorded against it are removed.'), open: asking, onOpenChange: setAsking, onYes: async () => {
|
|
364
482
|
await remove(target, agent.id || agent.name);
|
|
365
483
|
onDeleted();
|