@hanzo/build 0.2.110 → 0.2.112

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.
@@ -34,11 +34,6 @@ export interface Agent {
34
34
  /** Event-driven triggers that wake the agent proactively. */
35
35
  triggers?: Trigger[];
36
36
  }
37
- export interface Preset {
38
- id: string;
39
- title: string;
40
- prompt: string;
41
- }
42
37
  /** The fields a person edits. Money is in dollars here and micro-USD on the wire. */
43
38
  export interface Draft {
44
39
  name: string;
@@ -88,7 +83,7 @@ export declare function profile(t: Target, ref: string): Promise<{
88
83
  agent: Agent;
89
84
  runs: Run[];
90
85
  }>;
91
- /** An agent to start from: a default agent, a persona or a preset. */
86
+ /** An agent to start from: a default agent or a persona. */
92
87
  export interface Cast {
93
88
  /** The name it is made under. */
94
89
  name: string;
@@ -138,7 +133,3 @@ export declare function create(t: Target, d: Draft): Promise<Agent>;
138
133
  export declare function changes(was: Agent, d: Draft): Record<string, unknown>;
139
134
  export declare function update(t: Target, was: Agent, d: Draft): Promise<Agent>;
140
135
  export declare function remove(t: Target, ref: string): Promise<void>;
141
- /** The presets that make a working agent. */
142
- export declare function presets(t: Target): Promise<Preset[]>;
143
- /** A preset as a template. */
144
- export declare function fromPreset(p: Preset): Cast;
package/lib/api/agents.js CHANGED
@@ -1,21 +1,18 @@
1
1
  /**
2
2
  * Agents: the org's own — a model, instructions, the tools it may call, a
3
- * budget and a face — and the templates one is made from.
3
+ * budget and a face — and how one is made from a template.
4
4
  *
5
5
  * GET /v1/agent {agents: [agent]}, without instructions
6
6
  * POST /v1/agent create → 201 agent
7
7
  * GET /v1/agent/{ref} one, with its instructions
8
8
  * PATCH /v1/agent/{ref} the fields sent change, the rest stay → agent
9
9
  * DELETE /v1/agent/{ref} removes it and every run recorded against it → 204
10
- * GET /v1/agent/chat/presets {presets: [{id, title, systemPrompt, serverExecuted}]}
11
10
  *
12
11
  * A ref is the agent's id or its name. A budget is required: the most it may
13
12
  * spend in a period and in one run, in micro-USD, and the period — day, week or
14
13
  * month. Tools are names from the tool plane; none grants none, and `*` is
15
14
  * whatever the fleet's MCP server serves when it runs. An omitted model is the
16
- * deployment's default. A preset whose tool calls run on the platform
17
- * (`serverExecuted`) makes a working agent; the others hand their calls back to
18
- * the client that asked, so they are not offered here.
15
+ * deployment's default.
19
16
  */
20
17
  import { phrase } from '@hanzo/i18n';
21
18
  import { call, seg } from './call.js';
@@ -252,15 +249,3 @@ export async function update(t, was, d) {
252
249
  export async function remove(t, ref) {
253
250
  await call(t, 'DELETE', `/v1/agent/${seg(ref)}`);
254
251
  }
255
- /** The presets that make a working agent. */
256
- export async function presets(t) {
257
- return rows(obj(await call(t, 'GET', '/v1/agent/chat/presets')).presets)
258
- .map(obj)
259
- .filter((p) => p.serverExecuted === true)
260
- .map((p) => ({ id: str(p.id), title: str(p.title), prompt: str(p.systemPrompt) }))
261
- .filter((p) => p.id);
262
- }
263
- /** A preset as a template. */
264
- export function fromPreset(p) {
265
- return { name: p.id, title: p.title || p.id, description: p.title, category: phrase('Preset'), model: '', instructions: p.prompt };
266
- }
@@ -1,8 +1,10 @@
1
1
  import { type Cast } from '../api/agents.ts';
2
2
  import { type Pane } from './ui.tsx';
3
- /** Categories as Browse offers them: the default agents' and presets' first, as listed, then the rest by how many each holds. */
3
+ /** Categories as Browse offers them: the default agents' first, as listed, then the rest by how many each holds. */
4
4
  export declare function kinds(first: readonly Cast[], rest: readonly Cast[]): string[];
5
- export declare function Agents({ view, q, adding, onAdding, onView, onCount }: Pane): import("react").JSX.Element;
5
+ export declare function Agents({ view, q, adding, onAdding, onView, onCount, mode }: Pane & {
6
+ mode?: 'agents' | 'bots';
7
+ }): import("react").JSX.Element;
6
8
  /** One agent's page: who it is, what it runs on and reads, what it may call and spend, and what it has done. */
7
9
  export declare function Profile({ name }: {
8
10
  name: string;
@@ -4,8 +4,7 @@ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-run
4
4
  * what it may spend.
5
5
  *
6
6
  * Browse is every agent there is to start from: the host's default agents
7
- * (`cast`) and personas (`personas`), and the platform's presets whose tool
8
- * calls run on the platform, by name and category. Use makes the org's own
7
+ * (`cast`) and personas (`personas`), by name and category. Use makes the org's own
9
8
  * agent from one and opens it; nothing is added any other way, so an org starts
10
9
  * with none. An agent is also made from scratch, from the person signed in
11
10
  * (Clone yourself) or from anyone named. Yours lists the org's agents. Opening one is its profile page
@@ -27,7 +26,7 @@ import { ArrowLeft, Upload } from '@hanzogui/lucide-icons-2';
27
26
  import { Button, Input, Switch, Textarea } from '@hanzo/ui';
28
27
  import { ModelPicker } from '@hanzo/ui/models';
29
28
  import { useEffect, useMemo, useRef, useState } from 'react';
30
- import { agents, ALL, CAST_CAP, CAST_TASK, create, draft, EMPTY, fromPreset, one, PERIODS, person, presets, profile, remove, SCHEDULES, TRIGGERS, update, use } from '../api/agents.js';
29
+ import { agents, ALL, CAST_CAP, CAST_TASK, create, draft, EMPTY, one, PERIODS, person, profile, remove, SCHEDULES, TRIGGERS, update, use } from '../api/agents.js';
31
30
  import { models } from '../api/models.js';
32
31
  import { tools } from '../api/tools.js';
33
32
  import { useHost, useTarget } from '../host.js';
@@ -44,18 +43,37 @@ const TRIGGER_LABELS = {
44
43
  channel: { title: phrase('Channel & message events'), detail: phrase('Listen and respond to Slack, Discord, Telegram, and team channels.') },
45
44
  watch: { title: phrase('Proactive anomaly watch'), detail: phrase('Continuously monitor metrics, queues, and alerts 24/7.') },
46
45
  };
47
- /** Categories as Browse offers them: the default agents' and presets' first, as listed, then the rest by how many each holds. */
46
+ const FAST_BOTS = new Set(['dev', 'qa', 'cyber', 'it', 'auto', 'sal', 'mark', 'rev', 'biz', 'cust', 'com', 'su']);
47
+ const GIT_BOTS = new Set(['dev', 'qa', 'cyber', 'it', 'auto', 'sci', 'data']);
48
+ /** Any real agent preset configured to operate as a 24/7 autonomous, proactive, and event-driven bot. */
49
+ function asBot(c) {
50
+ const key = c.name.toLowerCase();
51
+ const schedule = c.schedule || (FAST_BOTS.has(key) ? '*/15 * * * *' : '0 9 * * 1-5');
52
+ const triggers = c.triggers?.length
53
+ ? c.triggers
54
+ : GIT_BOTS.has(key)
55
+ ? ['git', 'webhook', 'watch']
56
+ : ['channel', 'webhook', 'watch'];
57
+ return {
58
+ ...c,
59
+ category: 'Bot',
60
+ executionMode: 'long-running',
61
+ schedule,
62
+ triggers,
63
+ };
64
+ }
65
+ /** Categories as Browse offers them: the default agents' first, as listed, then the rest by how many each holds. */
48
66
  export function kinds(first, rest) {
49
- const lead = [...new Set(first.map((c) => c.category))];
67
+ const lead = [...new Set(first.map((c) => c.category).filter((cat) => cat !== 'Bot'))];
50
68
  const count = new Map();
51
69
  for (const c of rest)
52
- if (!lead.includes(c.category))
70
+ if (c.category !== 'Bot' && !lead.includes(c.category))
53
71
  count.set(c.category, (count.get(c.category) ?? 0) + 1);
54
72
  return [ANY, ...lead, ...[...count.keys()].sort((a, b) => count.get(b) - count.get(a) || a.localeCompare(b))];
55
73
  }
56
74
  const money = (m) => `$${(m / 1_000_000).toFixed(m % 10_000 ? 4 : 2).replace(/\.?0+$/, '')}`;
57
- /** A category as Browse names it: All, and the platform's presets and people, in the reader's words; the rest are the host's, as given. */
58
- const category = (c, t) => (c === ANY || c === 'Preset' || c === 'Person' ? t(c) : c);
75
+ /** A category as Browse names it: All and people, in the reader's words; the rest are the host's, as given. */
76
+ const category = (c, t) => (c === ANY || c === 'Person' ? t(c) : c);
59
77
  /**
60
78
  * A budget's sentences by its period ('' where the agent names none): whole
61
79
  * sentences, so a language says the period its own way.
@@ -80,29 +98,36 @@ const SO_FAR = {
80
98
  };
81
99
  const EACH = { day: phrase('Each day, USD'), week: phrase('Each week, USD'), month: phrase('Each month, USD') };
82
100
  const PERIOD = { day: phrase('Day'), week: phrase('Week'), month: phrase('Month') };
83
- export function Agents({ view, q, adding, onAdding, onView, onCount }) {
101
+ export function Agents({ view, q, adding, onAdding, onView, onCount, mode = 'agents' }) {
84
102
  const { t } = useI18n();
85
103
  const host = useHost();
86
104
  const target = useTarget();
87
105
  const signed = Boolean(host.person);
88
106
  const browsing = view === 'discover';
107
+ const botsMode = mode === 'bots';
89
108
  const mine = useLoad(signed ? () => agents(target) : null, [], [target, signed]);
90
- const offered = useLoad(browsing ? () => presets(target) : null, [], [target, view]);
91
- const figures = useLoad(browsing && host.personas ? host.personas : null, [], [view]);
92
- useCount(mine.value.length, onCount);
109
+ const figures = useLoad(browsing && !botsMode && host.personas ? host.personas : null, [], [view, botsMode]);
110
+ const yoursList = useMemo(() => (botsMode ? mine.value.filter((a) => a.executionMode === 'long-running') : mine.value.filter((a) => a.executionMode !== 'long-running')), [mine.value, botsMode]);
111
+ useCount(yoursList.length, onCount);
93
112
  const [note, setNote] = useState('');
94
113
  const [kind, setKind] = useState(ANY);
95
114
  const [more, setMore] = useState(PAGE);
96
115
  const [using, setUsing] = useState(null);
97
116
  const [making, setMaking] = useState(null);
98
117
  const [electing, setElecting] = useState(null);
99
- useEffect(() => setMore(PAGE), [q, kind]);
118
+ useEffect(() => setMore(PAGE), [q, kind, botsMode]);
100
119
  const opened = (a) => host.go(path({ kind: 'agent', name: a.name }));
101
120
  const take = async (c) => {
102
121
  setUsing(c);
103
122
  setNote('');
104
123
  try {
105
- opened(await use(target, c, window.location.href));
124
+ opened(await use(target, c, window.location.href, botsMode
125
+ ? {
126
+ executionMode: 'long-running',
127
+ schedule: c.schedule || '*/15 * * * *',
128
+ triggers: c.triggers?.length ? c.triggers : ['webhook', 'git', 'channel', 'watch'],
129
+ }
130
+ : undefined));
106
131
  }
107
132
  catch (e) {
108
133
  setNote(say(e, t));
@@ -111,27 +136,28 @@ export function Agents({ view, q, adding, onAdding, onView, onCount }) {
111
136
  setUsing(null);
112
137
  }
113
138
  };
114
- const editor = adding ? (_jsx(Editor, { onClose: () => onAdding(false), onSaved: (a) => {
139
+ const editor = adding ? (_jsx(Editor, { defaultBot: botsMode, onClose: () => onAdding(false), onSaved: (a) => {
115
140
  onAdding(false);
116
141
  onView('yours');
117
142
  mine.reload();
118
143
  setNote(t('{name} is saved', { name: a.name }));
119
144
  } })) : null;
120
145
  if (browsing) {
121
- const first = [...(host.cast ?? []), ...offered.value.map(fromPreset)];
122
- const all = [...first, ...figures.value];
123
- const shown = all.filter((c) => (kind === ANY || c.category === kind) && matches(q, c.title, c.name, c.description, c.category));
124
- const topAgents = kind === ANY ? shown.filter((c) => c.category !== 'Bot') : shown;
125
- const botPresets = kind === ANY ? shown.filter((c) => c.category === 'Bot') : [];
126
- const failed = figures.error ?? offered.error;
127
- const card = (c) => (_jsx(Tile, { title: c.title, detail: c.description === c.title || c.description === c.category ? undefined : c.description, meta: [category(c.category, t), c.executionMode === 'long-running' ? t('24/7 · Proactive · Event-driven') : '', c.schedule].filter(Boolean).join(' · '), mark: _jsx(Mark, { name: c.title, size: 40, logo: c.avatar || (c.name === 'create' ? '/agents/creative.png' : undefined) }), onOpen: signed ? () => setElecting(c) : undefined, action: signed ? (_jsxs(XStack, { items: "center", gap: "$1.5", children: [_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('24/7') }) }), _jsx(Add, { name: c.title, use: true, added: false, busy: using !== null, onPress: () => void take(c) })] })) : undefined }, `${c.category}/${c.name}/${c.title}`));
128
- return (_jsxs(YStack, { gap: "$3", children: [signed ? (_jsxs(XStack, { gap: "$2", flexWrap: "wrap", children: [_jsx(Button, { size: "sm", variant: "outline", onPress: () => onAdding(true), children: t('Start from scratch') }), _jsx(Button, { size: "sm", variant: "outline", onPress: () => setMaking('self'), children: t('Clone yourself') }), _jsx(Button, { size: "sm", variant: "outline", onPress: () => setMaking('person'), children: t('Create from a person') }), first.length ? (_jsx(Button, { size: "sm", variant: "outline", onPress: () => setElecting(first[0]), children: t('Elect 24/7 preset') })) : null] })) : null, _jsx(XStack, { overflowX: "auto", overflowY: "hidden", pb: "$1", children: _jsx(Choice, { label: t('Category'), value: kind, options: kinds(first, figures.value).map((id) => ({ id, label: category(id, t) })), onChange: setKind }) }), _jsx(Line, { children: note }), shown.length ? (_jsxs(YStack, { gap: "$5", children: [topAgents.length ? (_jsx(Grid, { label: kind === 'Bot' ? t('Bots to start from') : t('Agents to start from'), children: topAgents.slice(0, more).map(card) })) : null, botPresets.length ? (_jsx(Part, { title: t('Bots'), detail: t('Autonomous 24/7, proactive and event-driven workers. Select and elect any agent or bot preset to run continuously on a schedule or when events fire.'), children: _jsx(Grid, { label: t('Bots to start from'), children: botPresets.slice(0, more).map(card) }) })) : null] })) : figures.loading || offered.loading ? null : (_jsx(Soft, { children: t('No agent matches “{q}”.', { q: q.trim() }) })), topAgents.length > more || botPresets.length > more ? (_jsx(XStack, { children: _jsx(Button, { size: "sm", variant: "ghost", onPress: () => setMore(more + PAGE), children: t('More') }) })) : null, failed ? _jsx(Failed, { error: failed, onRetry: figures.error ? figures.reload : offered.reload }) : figures.loading || offered.loading ? _jsx(Soft, { children: t('Loading…') }) : null, editor, making ? _jsx(Person, { self: making === 'self', onClose: () => setMaking(null), onMade: opened }) : null, electing ? _jsx(Elect, { preset: electing, all: first, onClose: () => setElecting(null), onElected: opened }) : null] }));
146
+ const allCast = host.cast ?? [];
147
+ const isBotCast = (c) => c.category === 'Bot' || c.executionMode === 'long-running';
148
+ const explicitBots = allCast.filter(isBotCast);
149
+ const first = botsMode ? (explicitBots.length ? explicitBots : allCast.map(asBot)) : allCast.filter((c) => !isBotCast(c));
150
+ const rest = botsMode ? [] : figures.value.filter((c) => !isBotCast(c));
151
+ const all = [...first, ...rest];
152
+ const shown = all.filter((c) => (botsMode || kind === ANY || c.category === kind) && matches(q, c.title, c.name, c.description, c.category));
153
+ const card = (c) => (_jsx(Tile, { title: c.title, detail: c.description === c.title || c.description === c.category ? undefined : c.description, meta: [botsMode ? t('Bot') : category(c.category, t), c.executionMode === 'long-running' ? t('24/7 · Proactive · Event-driven') : '', c.schedule].filter(Boolean).join(' · '), 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", 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}`));
154
+ return (_jsxs(YStack, { gap: "$3", children: [signed ? (_jsxs(XStack, { gap: "$2", flexWrap: "wrap", children: [_jsx(Button, { size: "sm", variant: "outline", onPress: () => onAdding(true), children: t('Start from scratch') }), botsMode ? (allCast.length ? (_jsx(Button, { size: "sm", variant: "outline", onPress: () => setElecting((first[0] ?? allCast[0])), children: t('Elect 24/7 preset') })) : null) : (_jsxs(_Fragment, { children: [_jsx(Button, { size: "sm", variant: "outline", onPress: () => setMaking('self'), children: t('Clone yourself') }), _jsx(Button, { size: "sm", variant: "outline", onPress: () => setMaking('person'), children: t('Create from a person') })] }))] })) : null, !botsMode ? (_jsx(XStack, { overflowX: "auto", overflowY: "hidden", pb: "$1", children: _jsx(Choice, { label: t('Category'), value: kind, options: kinds(first, rest).map((id) => ({ id, label: category(id, t) })), onChange: setKind }) })) : null, _jsx(Line, { children: note }), shown.length ? (_jsx(Grid, { label: botsMode ? t('Bots to start from') : t('Agents to start from'), children: shown.slice(0, more).map(card) })) : figures.loading ? null : q.trim() ? (_jsx(Soft, { children: t(botsMode ? 'No bot matches “{q}”.' : 'No agent matches “{q}”.', { q: q.trim() }) })) : 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: q.trim() }) })), shown.length > more ? (_jsx(XStack, { children: _jsx(Button, { size: "sm", variant: "ghost", onPress: () => setMore(more + PAGE), children: t('More') }) })) : null, figures.error ? _jsx(Failed, { error: figures.error, onRetry: figures.reload }) : figures.loading ? _jsx(Soft, { children: t('Loading…') }) : null, editor, 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] }));
129
155
  }
130
156
  if (!signed) {
131
- return _jsx(Visitor, { children: t('Sign in to see your agents.') });
157
+ return _jsx(Visitor, { children: t(botsMode ? 'Sign in to see your bots.' : 'Sign in to see your agents.') });
132
158
  }
133
- const shown = mine.value.filter((a) => matches(q, a.name, a.description, a.model));
134
- return (_jsxs(YStack, { gap: "$3", children: [_jsx(Line, { children: note }), mine.error && !mine.value.length ? (_jsx(Failed, { error: mine.error, onRetry: mine.reload })) : mine.loading && !mine.value.length ? (_jsx(Soft, { children: t('Loading your agents…') })) : !mine.value.length ? (_jsxs(Empty, { title: t('No agents yet'), detail: "", children: [_jsx(Button, { size: "sm", variant: "outline", onPress: () => onView('discover'), children: t('Browse agents') }), _jsx(Button, { size: "sm", onPress: () => onAdding(true), children: t('New agent') })] })) : !shown.length ? (_jsx(Soft, { children: t('No agent of yours matches “{q}”.', { q: q.trim() }) })) : (_jsx(Grid, { label: t('Your agents'), children: shown.map((a) => (_jsx(Tile, { title: a.name, detail: a.description || t('No description.'), meta: [
159
+ const shown = yoursList.filter((a) => matches(q, a.name, a.description, a.model));
160
+ 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: "", 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(Tile, { title: a.name, detail: a.description || t('No description.'), meta: [
135
161
  a.model,
136
162
  a.executionMode === 'long-running' ? t('24/7') : '',
137
163
  a.schedule || '',
@@ -182,7 +208,7 @@ function Elect({ preset, all, onClose, onElected, }) {
182
208
  setWorking(false);
183
209
  }
184
210
  };
185
- 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 || (picked.name === 'create' ? '/agents/creative.png' : undefined) }), _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", rounded: "$3", children: all.map((c) => {
211
+ 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", rounded: "$3", children: all.map((c) => {
186
212
  const active = c.name === picked.name && c.category === picked.category;
187
213
  return (_jsx(Button, { size: "sm", variant: active ? 'primary' : 'ghost', onPress: () => selectPreset(c), children: c.title }, `${c.category}/${c.name}`));
188
214
  }) }) })) : 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) => (_jsx(Button, { size: "sm", variant: schedule.trim() === s.cron ? 'primary' : 'outline', onPress: () => setSchedule(s.cron), children: t(s.label) }, s.cron))) }), _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", disabled: working || (autonomous && !schedule.trim()), onPress: () => void save(), children: autonomous ? t('Elect & Run 24/7') : t('Create') })] })] }));
@@ -236,9 +262,10 @@ export function Profile({ name }) {
236
262
  const target = useTarget();
237
263
  const got = useLoad(host.person ? () => profile(target, name) : null, null, [target, name]);
238
264
  const [editing, setEditing] = useState(false);
239
- const back = () => host.go(path({ kind: 'customize', tab: 'agents' }));
240
265
  const a = got.value?.agent;
241
- 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('Back to agents'), children: [_jsx(ArrowLeft, { size: 14, color: "$soft", 'data-i18n-mirror': '' }), _jsx(SizableText, { size: "$2", color: "$soft", children: t('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 & Event-Driven'), detail: a.executionMode === 'long-running'
266
+ const isBot = a?.executionMode === 'long-running';
267
+ const back = () => host.go(path({ kind: 'customize', tab: isBot ? 'bots' : 'agents' }));
268
+ 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 & Event-Driven'), detail: a.executionMode === 'long-running'
242
269
  ? [t('Runs autonomously 24/7'), a.schedule ? `${t('Schedule')}: ${a.schedule}` : '', a.triggers?.length ? `${t('Triggers')}: ${a.triggers.join(', ')}` : '']
243
270
  .filter(Boolean)
244
271
  .join(' · ')
@@ -248,13 +275,15 @@ export function Profile({ name }) {
248
275
  }, onDeleted: back })) : null] }));
249
276
  }
250
277
  /** Write a new agent, or change one; an existing agent is read whole first, for its instructions. */
251
- function Editor({ agent, onClose, onSaved, onDeleted, }) {
278
+ function Editor({ agent, defaultBot = false, onClose, onSaved, onDeleted, }) {
252
279
  const { t } = useI18n();
253
280
  const target = useTarget();
254
281
  const full = useLoad(agent ? () => one(target, agent.id || agent.name) : null, null, [target, agent?.id]);
255
282
  const catalog = useLoad(() => models(target), [], [target]);
256
283
  const on = useLoad(() => tools(target, { activated: true }), [], [target]);
257
- const [d, setD] = useState(EMPTY);
284
+ const [d, setD] = useState(() => defaultBot
285
+ ? { ...EMPTY, executionMode: 'long-running', schedule: '*/15 * * * *', triggers: ['webhook', 'git', 'channel', 'watch'] }
286
+ : EMPTY);
258
287
  const [ready, setReady] = useState(!agent);
259
288
  const [working, setWorking] = useState(false);
260
289
  const [note, setNote] = useState('');
@@ -292,7 +321,7 @@ function Editor({ agent, onClose, onSaved, onDeleted, }) {
292
321
  }
293
322
  };
294
323
  const pick = (name, yes) => set({ tools: yes ? [...d.tools, name] : d.tools.filter((n) => n !== name) });
295
- return (_jsx(Sheet, { title: agent ? agent.name : t('New agent'), open: true, onOpenChange: (o) => !o && onClose(), width: 680, children: agent && full.error && !full.value ? (_jsx(Failed, { error: full.error, onRetry: full.reload })) : !ready ? (_jsx(Soft, { children: t('Loading the agent…') })) : (_jsxs(_Fragment, { children: [_jsx(Field, { label: t('Name'), hint: agent ? t('An agent keeps its name.') : t('Letters, digits, . _ or -. Other agents call it as agent_<name>.'), children: _jsx(Input, { value: d.name, onChangeText: (v) => set({ name: v }), "aria-label": t('Name'), disabled: Boolean(agent), autoCapitalize: "none" }) }), _jsx(Field, { label: t('Description'), hint: t('The line another agent reads to decide whether to call this one.'), children: _jsx(Input, { value: d.description, onChangeText: (v) => set({ description: v }), placeholder: t('Answers questions about our codebase'), "aria-label": t('Description') }) }), _jsx(Field, { label: t('Model'), children: _jsxs(XStack, { items: "center", gap: "$2", flexWrap: "wrap", children: [_jsx(ModelPicker, { size: "sm", name: t('Model'), placeholder: t('The deployment’s default'), models: catalog.value, scope: "chat", value: d.model || undefined, onChange: (id) => set({ model: id }), loading: catalog.loading, error: catalog.error ? say(catalog.error, t) : null }), d.model && !agent ? (_jsx(Button, { size: "sm", variant: "ghost", onPress: () => set({ model: '' }), children: t('Use the default') })) : null] }) }), _jsx(Field, { label: t('Instructions'), hint: t('The system prompt: what the model reads before every run.'), children: _jsx(Textarea, { value: d.instructions, onChangeText: (v) => set({ instructions: v }), placeholder: t('Be terse, and cite the file you read.'), "aria-label": t('Instructions'), rows: 8 }) }), _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('Tools') }), _jsx(SizableText, { size: "$1", color: "$soft", children: every
324
+ return (_jsx(Sheet, { title: agent ? agent.name : t(defaultBot ? 'New bot' : 'New agent'), open: true, onOpenChange: (o) => !o && onClose(), width: 680, children: agent && full.error && !full.value ? (_jsx(Failed, { error: full.error, onRetry: full.reload })) : !ready ? (_jsx(Soft, { children: t('Loading the agent…') })) : (_jsxs(_Fragment, { children: [_jsx(Field, { label: t('Name'), hint: agent ? t('An agent keeps its name.') : t('Letters, digits, . _ or -. Other agents call it as agent_<name>.'), children: _jsx(Input, { value: d.name, onChangeText: (v) => set({ name: v }), "aria-label": t('Name'), disabled: Boolean(agent), autoCapitalize: "none" }) }), _jsx(Field, { label: t('Description'), hint: t('The line another agent reads to decide whether to call this one.'), children: _jsx(Input, { value: d.description, onChangeText: (v) => set({ description: v }), placeholder: t('Answers questions about our codebase'), "aria-label": t('Description') }) }), _jsx(Field, { label: t('Model'), children: _jsxs(XStack, { items: "center", gap: "$2", flexWrap: "wrap", children: [_jsx(ModelPicker, { size: "sm", name: t('Model'), placeholder: t('The deployment’s default'), models: catalog.value, scope: "chat", value: d.model || undefined, onChange: (id) => set({ model: id }), loading: catalog.loading, error: catalog.error ? say(catalog.error, t) : null }), d.model && !agent ? (_jsx(Button, { size: "sm", variant: "ghost", onPress: () => set({ model: '' }), children: t('Use the default') })) : null] }) }), _jsx(Field, { label: t('Instructions'), hint: t('The system prompt: what the model reads before every run.'), children: _jsx(Textarea, { value: d.instructions, onChangeText: (v) => set({ instructions: v }), placeholder: t('Be terse, and cite the file you read.'), "aria-label": t('Instructions'), rows: 8 }) }), _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('Tools') }), _jsx(SizableText, { size: "$1", color: "$soft", children: every
296
325
  ? t('Every tool the fleet’s MCP server serves when it runs.')
297
326
  : d.tools.length
298
327
  ? t('{n} chosen. It can call only these.', { n: d.tools.length })
@@ -15,7 +15,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
15
15
  import { SizableText, XStack, YStack } from '@hanzo/gui';
16
16
  import { phrase } from '@hanzo/i18n';
17
17
  import { useI18n } from '@hanzo/i18n/react';
18
- import { BookOpen, Bot, Plug, Plus, Puzzle } from '@hanzogui/lucide-icons-2';
18
+ import { BookOpen, Bot, Plug, Plus, Puzzle, Users } from '@hanzogui/lucide-icons-2';
19
19
  import { Button, Input } from '@hanzo/ui';
20
20
  import { useCallback, useState } from 'react';
21
21
  import { useHost } from '../host.js';
@@ -58,6 +58,14 @@ const LABEL = {
58
58
  add: phrase('New agent'),
59
59
  find: phrase('Search agents'),
60
60
  typing: phrase('Search agents…'),
61
+ icon: _jsx(Users, { size: 15 }),
62
+ },
63
+ bots: {
64
+ title: phrase('Bots'),
65
+ says: phrase('Persistent 24/7 agents that run continuously on a schedule or when events fire.'),
66
+ add: phrase('New bot'),
67
+ find: phrase('Search bots'),
68
+ typing: phrase('Search bots…'),
61
69
  icon: _jsx(Bot, { size: 15 }),
62
70
  },
63
71
  };
@@ -85,5 +93,5 @@ export function Customize({ tab, view: first }) {
85
93
  }) })), host.sections ? null : (_jsx(SizableText, { size: "$2", color: "$soft", children: t(LABEL[tab].says) })), _jsxs(XStack, { items: "center", gap: "$2", children: [_jsx(Choice, { label: t('Show'), value: view, options: [
86
94
  { id: 'discover', label: t('Browse') },
87
95
  { id: 'yours', label: t('Yours'), count },
88
- ], onChange: setView }), _jsx(XStack, { flex: 1 }), may ? (_jsxs(Button, { size: "sm", onPress: () => setAdding(true), children: [_jsx(Plus, { size: 14 }), " ", t(LABEL[tab].add)] })) : null] }), _jsx(Input, { value: q, onChangeText: setQ, placeholder: t(LABEL[tab].typing), "aria-label": t(LABEL[tab].find) }), host.person && kit && !host.admin && LABEL[tab].admin ? (_jsx(SizableText, { size: "$1", color: "$soft", children: t(LABEL[tab].admin) })) : null, tab === 'skills' ? (_jsx(Skills, { ...pane })) : tab === 'connectors' ? (_jsx(Connectors, { ...pane })) : tab === 'plugins' ? (_jsx(Plugins, { ...pane })) : (_jsx(Agents, { ...pane }))] }) }));
96
+ ], onChange: setView }), _jsx(XStack, { flex: 1 }), may ? (_jsxs(Button, { size: "sm", onPress: () => setAdding(true), children: [_jsx(Plus, { size: 14 }), " ", t(LABEL[tab].add)] })) : null] }), _jsx(Input, { value: q, onChangeText: setQ, placeholder: t(LABEL[tab].typing), "aria-label": t(LABEL[tab].find) }), host.person && kit && !host.admin && LABEL[tab].admin ? (_jsx(SizableText, { size: "$1", color: "$soft", children: t(LABEL[tab].admin) })) : null, tab === 'skills' ? (_jsx(Skills, { ...pane })) : tab === 'connectors' ? (_jsx(Connectors, { ...pane })) : tab === 'plugins' ? (_jsx(Plugins, { ...pane })) : tab === 'bots' ? (_jsx(Agents, { ...pane, mode: "bots" })) : (_jsx(Agents, { ...pane, mode: "agents" }))] }) }));
89
97
  }
package/lib/nav.js CHANGED
@@ -109,8 +109,8 @@ export function tabs(host, go, t = english) {
109
109
  const at = r.kind === 'customize' ? r.tab : r.kind === 'agent' ? 'agents' : '';
110
110
  return [{ id: 'customize', label: '', links: TABS.map((tab) => ({ id: tab, label: t(TAB_LABEL[tab]), icon: TAB_ICON[tab], onPress: () => go(path({ kind: 'customize', tab })), active: tab === at })) }];
111
111
  }
112
- const TAB_LABEL = { agents: phrase('Agents'), skills: phrase('Skills'), connectors: phrase('Connectors'), plugins: phrase('Plugins') };
113
- const TAB_ICON = { agents: _jsx(Bot, { size: 16 }), skills: _jsx(BookOpen, { size: 16 }), connectors: _jsx(Plug, { size: 16 }), plugins: _jsx(Puzzle, { size: 16 }) };
112
+ const TAB_LABEL = { agents: phrase('Agents'), bots: phrase('Bots'), skills: phrase('Skills'), connectors: phrase('Connectors'), plugins: phrase('Plugins') };
113
+ const TAB_ICON = { agents: _jsx(Users, { size: 16 }), bots: _jsx(Bot, { size: 16 }), skills: _jsx(BookOpen, { size: 16 }), connectors: _jsx(Plug, { size: 16 }), plugins: _jsx(Puzzle, { size: 16 }) };
114
114
  const SECTION_ICON = {
115
115
  general: _jsx(Settings, { size: 16 }),
116
116
  account: _jsx(User, { size: 16 }),
package/lib/route.d.ts CHANGED
@@ -32,8 +32,8 @@ export type Screen = 'artifacts' | 'templates' | 'projects' | 'issues' | 'automa
32
32
  /** Settings, one section each. Every setting the builder has lives on this page, none elsewhere. */
33
33
  export declare const SECTIONS: readonly ['general', 'account', 'privacy', 'billing', 'usage', 'capabilities', 'memory', 'code', 'environments', 'machines', 'keys', 'members', 'integrations', 'notifications'];
34
34
  export type Section = (typeof SECTIONS)[number];
35
- /** Customize, one tab each: what the agent brings to a run, yours and to discover. Agents first. */
36
- export declare const TABS: readonly ['agents', 'skills', 'connectors', 'plugins'];
35
+ /** Customize, one tab each: what the agent brings to a run, yours and to discover. Agents first, then Bots. */
36
+ export declare const TABS: readonly ['agents', 'bots', 'skills', 'connectors', 'plugins'];
37
37
  export type Tab = (typeof TABS)[number];
38
38
  export type Route = {
39
39
  kind: 'new';
package/lib/route.js CHANGED
@@ -15,8 +15,8 @@ export const SECTIONS = [
15
15
  'integrations',
16
16
  'notifications',
17
17
  ];
18
- /** Customize, one tab each: what the agent brings to a run, yours and to discover. Agents first. */
19
- export const TABS = ['agents', 'skills', 'connectors', 'plugins'];
18
+ /** Customize, one tab each: what the agent brings to a run, yours and to discover. Agents first, then Bots. */
19
+ export const TABS = ['agents', 'bots', 'skills', 'connectors', 'plugins'];
20
20
  /** The kinds the Library narrows to by address (api/library.ts KIND_IDS, plus `sites`). */
21
21
  export const OF = ['image', 'video', 'audio', 'document', 'slides', 'type', 'model', 'code', 'file', 'sites'];
22
22
  export const SESSION = /^sess_[0-9a-f]{32}$/;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hanzo/build",
3
- "version": "0.2.110",
3
+ "version": "0.2.112",
4
4
  "type": "module",
5
5
  "license": "Apache-2.0 OR MIT",
6
6
  "description": "Hanzo Build — say what you want, watch it built, deployed and running. The builder as a component, mounted by the Hanzo app at hanzo.ai.",