@hanzo/build 0.2.110 → 0.2.111

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,6 +1,6 @@
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
5
  export declare function Agents({ view, q, adding, onAdding, onView, onCount }: Pane): import("react").JSX.Element;
6
6
  /** One agent's page: who it is, what it runs on and reads, what it may call and spend, and what it has done. */
@@ -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,7 +43,7 @@ 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
+ /** Categories as Browse offers them: the default agents' first, as listed, then the rest by how many each holds. */
48
47
  export function kinds(first, rest) {
49
48
  const lead = [...new Set(first.map((c) => c.category))];
50
49
  const count = new Map();
@@ -54,8 +53,8 @@ export function kinds(first, rest) {
54
53
  return [ANY, ...lead, ...[...count.keys()].sort((a, b) => count.get(b) - count.get(a) || a.localeCompare(b))];
55
54
  }
56
55
  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);
56
+ /** A category as Browse names it: All and people, in the reader's words; the rest are the host's, as given. */
57
+ const category = (c, t) => (c === ANY || c === 'Person' ? t(c) : c);
59
58
  /**
60
59
  * A budget's sentences by its period ('' where the agent names none): whole
61
60
  * sentences, so a language says the period its own way.
@@ -87,7 +86,6 @@ export function Agents({ view, q, adding, onAdding, onView, onCount }) {
87
86
  const signed = Boolean(host.person);
88
87
  const browsing = view === 'discover';
89
88
  const mine = useLoad(signed ? () => agents(target) : null, [], [target, signed]);
90
- const offered = useLoad(browsing ? () => presets(target) : null, [], [target, view]);
91
89
  const figures = useLoad(browsing && host.personas ? host.personas : null, [], [view]);
92
90
  useCount(mine.value.length, onCount);
93
91
  const [note, setNote] = useState('');
@@ -118,14 +116,13 @@ export function Agents({ view, q, adding, onAdding, onView, onCount }) {
118
116
  setNote(t('{name} is saved', { name: a.name }));
119
117
  } })) : null;
120
118
  if (browsing) {
121
- const first = [...(host.cast ?? []), ...offered.value.map(fromPreset)];
119
+ const first = host.cast ?? [];
122
120
  const all = [...first, ...figures.value];
123
121
  const shown = all.filter((c) => (kind === ANY || c.category === kind) && matches(q, c.title, c.name, c.description, c.category));
124
122
  const topAgents = kind === ANY ? shown.filter((c) => c.category !== 'Bot') : shown;
125
123
  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] }));
124
+ 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 }), 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}`));
125
+ 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 ? 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, 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: first, onClose: () => setElecting(null), onElected: opened }) : null] }));
129
126
  }
130
127
  if (!signed) {
131
128
  return _jsx(Visitor, { children: t('Sign in to see your agents.') });
@@ -182,7 +179,7 @@ function Elect({ preset, all, onClose, onElected, }) {
182
179
  setWorking(false);
183
180
  }
184
181
  };
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) => {
182
+ 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
183
  const active = c.name === picked.name && c.category === picked.category;
187
184
  return (_jsx(Button, { size: "sm", variant: active ? 'primary' : 'ghost', onPress: () => selectPreset(c), children: c.title }, `${c.category}/${c.name}`));
188
185
  }) }) })) : 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') })] })] }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hanzo/build",
3
- "version": "0.2.110",
3
+ "version": "0.2.111",
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.",