@hanzo/app 0.2.57 → 0.2.59
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/App.js +1 -1
- package/dist/Board.js +37 -121
- package/dist/Boxes.js +12 -16
- package/dist/CalScheduler.js +40 -81
- package/dist/Chat.js +84 -78
- package/dist/Chrome.d.ts +2 -14
- package/dist/Chrome.js +7 -44
- package/dist/Column.js +6 -2
- package/dist/Contents.d.ts +1 -1
- package/dist/Contents.js +2 -1
- package/dist/Drive.js +100 -121
- package/dist/Inbox.js +7 -7
- package/dist/Market.js +10 -15
- package/dist/Meet.js +48 -78
- package/dist/Orgs.js +10 -9
- package/dist/Palette.d.ts +1 -1
- package/dist/Palette.js +2 -1
- package/dist/Rail.js +3 -3
- package/dist/Schedule.js +11 -15
- package/dist/Settings.d.ts +1 -1
- package/dist/SettingsPane.js +2 -2
- package/dist/Shared.js +11 -16
- package/dist/Shell.js +1 -1
- package/dist/Talk.js +4 -4
- package/dist/Terminals.js +1 -3
- package/dist/Top.js +1 -1
- package/dist/Usage.js +3 -3
- package/dist/WindowControls.js +3 -5
- package/dist/Work.js +28 -51
- package/dist/bots/Bots.js +73 -129
- package/dist/bots/runtime.js +41 -103
- package/dist/cast.d.ts +1 -1
- package/dist/cast.js +1 -1
- package/dist/failure.d.ts +1 -1
- package/dist/failure.js +1 -1
- package/dist/ground.d.ts +14 -0
- package/dist/ground.js +14 -0
- package/dist/lib/limits.d.ts +1 -1
- package/dist/lib/limits.js +1 -1
- package/dist/lib/org.d.ts +3 -3
- package/dist/lib/org.js +5 -4
- package/dist/lib/orgname.d.ts +1 -1
- package/dist/lib/orgname.js +1 -1
- package/dist/lib/pay.d.ts +2 -6
- package/dist/lib/pay.js +2 -15
- package/dist/lib/plans.d.ts +1 -1
- package/dist/lib/plans.js +1 -1
- package/dist/lib/tier.d.ts +2 -2
- package/dist/lib/tier.js +6 -6
- package/dist/look.js +8 -10
- package/dist/recent.d.ts +1 -1
- package/dist/recent.js +2 -1
- package/dist/say.d.ts +4 -0
- package/dist/say.js +7 -0
- package/dist/thread.js +1 -1
- package/package.json +3 -3
- package/assets/memoji/art.svg +0 -22
- package/assets/memoji/cyber.svg +0 -22
- package/assets/memoji/data.svg +0 -22
- package/assets/memoji/des.svg +0 -22
- package/assets/memoji/dev.svg +0 -22
- package/assets/memoji/doc.svg +0 -22
- package/assets/memoji/edu.svg +0 -22
- package/assets/memoji/fin.svg +0 -22
- package/assets/memoji/gov.svg +0 -22
- package/assets/memoji/huma.svg +0 -22
- package/assets/memoji/lang.svg +0 -22
- package/assets/memoji/law.svg +0 -22
- package/assets/memoji/mana.svg +0 -22
- package/assets/memoji/mark.svg +0 -22
- package/assets/memoji/mu.svg +0 -22
- package/assets/memoji/opera.svg +0 -22
- package/assets/memoji/rev.svg +0 -22
- package/assets/memoji/sal.svg +0 -22
- package/assets/memoji/sci.svg +0 -22
- package/assets/memoji/su.svg +0 -22
- package/assets/memoji/vi.svg +0 -22
- package/dist/TeamPreview.d.ts +0 -9
- package/dist/TeamPreview.js +0 -305
- package/dist/TeamStory.d.ts +0 -49
- package/dist/TeamStory.js +0 -67
- package/dist/preview.d.ts +0 -84
- package/dist/preview.js +0 -120
- package/dist/workday.d.ts +0 -247
- package/dist/workday.js +0 -642
package/dist/bots/Bots.js
CHANGED
|
@@ -10,10 +10,8 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
10
10
|
// explore how bots use computers to automate sales, triage inboxes, and review code.
|
|
11
11
|
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
12
12
|
import { Monitor, Plus, Search, Send, Trash2 } from 'lucide-react';
|
|
13
|
-
import { phrase } from '@hanzo/i18n';
|
|
14
13
|
import { useIam } from '@hanzo/iam/react';
|
|
15
14
|
import { useAi, ENSO } from '../lib/ai.js';
|
|
16
|
-
import { useI18n } from '@hanzo/i18n/react';
|
|
17
15
|
import { say } from '../failure.js';
|
|
18
16
|
import { Input, Text, XStack, YStack } from '@hanzo/gui';
|
|
19
17
|
import { Button } from '@hanzo/ui';
|
|
@@ -24,51 +22,28 @@ import { DIM, FAINT, GROUND, INK, LINE, RAISED, SURFACE } from './ink.js';
|
|
|
24
22
|
import { BARE, BOXED, CARD, CLIP, GHOST, LABEL, NOTE, TAB } from './kit.js';
|
|
25
23
|
import { ALWAYS, ONCE, launch, sessions, steer } from './api.js';
|
|
26
24
|
/** How long ago, in the words a roster row has space for. */
|
|
27
|
-
function when(iso
|
|
25
|
+
function when(iso) {
|
|
28
26
|
if (!iso)
|
|
29
27
|
return '';
|
|
30
|
-
const
|
|
31
|
-
if (Number.isNaN(
|
|
28
|
+
const t = new Date(iso);
|
|
29
|
+
if (Number.isNaN(t.getTime()))
|
|
32
30
|
return '';
|
|
33
|
-
const days = Math.floor((Date.now() -
|
|
31
|
+
const days = Math.floor((Date.now() - t.getTime()) / 86_400_000);
|
|
34
32
|
if (days === 0)
|
|
35
|
-
return
|
|
33
|
+
return t.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' });
|
|
36
34
|
if (days === 1)
|
|
37
|
-
return
|
|
35
|
+
return 'Yesterday';
|
|
38
36
|
if (days < 7)
|
|
39
|
-
return
|
|
40
|
-
return
|
|
37
|
+
return t.toLocaleDateString([], { weekday: 'short' });
|
|
38
|
+
return t.toLocaleDateString([], { month: 'short', day: 'numeric' });
|
|
41
39
|
}
|
|
42
40
|
/** What a run cost, from the fields the run actually recorded. */
|
|
43
|
-
function cost(r
|
|
41
|
+
function cost(r) {
|
|
44
42
|
const tokens = (r.promptTokens ?? 0) + (r.completionTokens ?? 0);
|
|
45
|
-
return [
|
|
46
|
-
r.model,
|
|
47
|
-
r.durationMs ? t('{seconds}s', { seconds: (r.durationMs / 1000).toFixed(1) }) : '',
|
|
48
|
-
tokens ? t('{count} tokens', { count: tokens }) : '',
|
|
49
|
-
]
|
|
43
|
+
return [r.model, r.durationMs ? `${(r.durationMs / 1000).toFixed(1)}s` : '', tokens ? `${tokens} tokens` : '']
|
|
50
44
|
.filter(Boolean)
|
|
51
45
|
.join(' · ');
|
|
52
46
|
}
|
|
53
|
-
/** The platform's word for how a bot runs, as a person reads it. An unknown mode stays a token. */
|
|
54
|
-
function modeName(mode, t) {
|
|
55
|
-
if (mode === ALWAYS)
|
|
56
|
-
return t('long-running');
|
|
57
|
-
if (!mode || mode === ONCE)
|
|
58
|
-
return t('one-shot');
|
|
59
|
-
return mode;
|
|
60
|
-
}
|
|
61
|
-
/** A session's status, in the reader's words. An unrecognized status stays a token. */
|
|
62
|
-
function sessionStatus(status, t) {
|
|
63
|
-
switch (status) {
|
|
64
|
-
case 'running':
|
|
65
|
-
return t('running');
|
|
66
|
-
case 'paused':
|
|
67
|
-
return t('paused');
|
|
68
|
-
default:
|
|
69
|
-
return status;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
47
|
/** When something happened, as a number to sort by. */
|
|
73
48
|
const at = (iso) => {
|
|
74
49
|
const t = iso ? new Date(iso).getTime() : NaN;
|
|
@@ -79,7 +54,7 @@ const at = (iso) => {
|
|
|
79
54
|
* log nothing is reading, so a control on one is a control over nothing. */
|
|
80
55
|
const open = (s) => s.status === 'running' || s.status === 'paused';
|
|
81
56
|
/** A Bot's recorded runs as the turns they were. */
|
|
82
|
-
function turns(detail
|
|
57
|
+
function turns(detail) {
|
|
83
58
|
return (detail?.recentRuns ?? []).flatMap((r) => {
|
|
84
59
|
const when = at(r.createdAt);
|
|
85
60
|
const out = [];
|
|
@@ -89,8 +64,8 @@ function turns(detail, t) {
|
|
|
89
64
|
id: `${r.id}-out`,
|
|
90
65
|
at: when + 1,
|
|
91
66
|
who: 'bot',
|
|
92
|
-
text: r.error || r.output ||
|
|
93
|
-
note: cost(r
|
|
67
|
+
text: r.error || r.output || 'This run recorded no output.',
|
|
68
|
+
note: cost(r),
|
|
94
69
|
failed: Boolean(r.error),
|
|
95
70
|
});
|
|
96
71
|
return out;
|
|
@@ -101,7 +76,7 @@ const EXAMPLE_BOTS = [
|
|
|
101
76
|
id: 'bot-sales-outbound',
|
|
102
77
|
avatar: '/bots/sales-outbound.png',
|
|
103
78
|
name: 'Sales Outbound',
|
|
104
|
-
description:
|
|
79
|
+
description: 'Prospecting, lead qualification, and cold outreach',
|
|
105
80
|
model: 'claude-3-5-sonnet',
|
|
106
81
|
executionMode: ALWAYS,
|
|
107
82
|
schedule: '0 9 * * 1-5',
|
|
@@ -111,7 +86,7 @@ const EXAMPLE_BOTS = [
|
|
|
111
86
|
id: 'bot-chief',
|
|
112
87
|
avatar: '/bots/chief.png',
|
|
113
88
|
name: 'Chief',
|
|
114
|
-
description:
|
|
89
|
+
description: 'Executive briefing, team updates, and orchestration',
|
|
115
90
|
model: 'claude-3-5-sonnet',
|
|
116
91
|
executionMode: ALWAYS,
|
|
117
92
|
schedule: '0 8 * * *',
|
|
@@ -121,7 +96,7 @@ const EXAMPLE_BOTS = [
|
|
|
121
96
|
id: 'bot-inbox-manager',
|
|
122
97
|
avatar: '/bots/inbox-manager.png',
|
|
123
98
|
name: 'Inbox Manager',
|
|
124
|
-
description:
|
|
99
|
+
description: 'Triage email, draft responses, and surface urgent items',
|
|
125
100
|
model: 'claude-3-5-sonnet',
|
|
126
101
|
executionMode: ALWAYS,
|
|
127
102
|
schedule: '*/15 * * * *',
|
|
@@ -130,7 +105,7 @@ const EXAMPLE_BOTS = [
|
|
|
130
105
|
{
|
|
131
106
|
id: 'bot-code-reviewer',
|
|
132
107
|
name: 'Code Reviewer',
|
|
133
|
-
description:
|
|
108
|
+
description: 'Analyze pull requests, check test suites, and style',
|
|
134
109
|
model: 'claude-3-5-sonnet',
|
|
135
110
|
executionMode: ONCE,
|
|
136
111
|
updatedAt: new Date(Date.now() - 1000 * 60 * 180).toISOString(),
|
|
@@ -138,7 +113,7 @@ const EXAMPLE_BOTS = [
|
|
|
138
113
|
{
|
|
139
114
|
id: 'bot-research-analyst',
|
|
140
115
|
name: 'Research Analyst',
|
|
141
|
-
description:
|
|
116
|
+
description: 'Track industry trends, competitive moves, and filings',
|
|
142
117
|
model: 'claude-3-5-sonnet',
|
|
143
118
|
executionMode: ONCE,
|
|
144
119
|
updatedAt: new Date(Date.now() - 1000 * 60 * 300).toISOString(),
|
|
@@ -146,58 +121,57 @@ const EXAMPLE_BOTS = [
|
|
|
146
121
|
];
|
|
147
122
|
const EXAMPLE_ACTIONS = {
|
|
148
123
|
'Sales Outbound': {
|
|
149
|
-
title:
|
|
150
|
-
status:
|
|
151
|
-
summary:
|
|
124
|
+
title: 'Computer',
|
|
125
|
+
status: 'Done',
|
|
126
|
+
summary: 'Reviewed 52 new outbound leads across target accounts. Qualified 18 high-fit profiles and prepared tailored email drafts.',
|
|
152
127
|
tasks: [
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
128
|
+
'Verified domain deliverability and prospect contact records',
|
|
129
|
+
'Extracted buyer intent signals from company milestones',
|
|
130
|
+
'Queued 18 personalized emails for Armand’s review',
|
|
156
131
|
],
|
|
157
132
|
},
|
|
158
133
|
'Chief': {
|
|
159
|
-
title:
|
|
160
|
-
status:
|
|
161
|
-
summary:
|
|
134
|
+
title: 'Computer',
|
|
135
|
+
status: 'Done',
|
|
136
|
+
summary: 'Compiled morning briefing, synced calendar events, and highlighted team priorities.',
|
|
162
137
|
tasks: [
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
138
|
+
'Aggregated GitHub pull requests and release milestones',
|
|
139
|
+
'Organized 3 priority decisions for today',
|
|
140
|
+
'Synchronized executive calendar and shared prep notes',
|
|
166
141
|
],
|
|
167
142
|
},
|
|
168
143
|
'Inbox Manager': {
|
|
169
|
-
title:
|
|
170
|
-
status:
|
|
171
|
-
summary:
|
|
144
|
+
title: 'Computer',
|
|
145
|
+
status: 'Done',
|
|
146
|
+
summary: 'Triaged 34 unread messages, flagged 4 urgent requests, and drafted replies for approval.',
|
|
172
147
|
tasks: [
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
148
|
+
'Categorized incoming inquiries by priority and topic',
|
|
149
|
+
'Drafted context-aware responses citing knowledge base docs',
|
|
150
|
+
'Scheduled followup reminders for unresolved partner threads',
|
|
176
151
|
],
|
|
177
152
|
},
|
|
178
153
|
'Code Reviewer': {
|
|
179
|
-
title:
|
|
180
|
-
status:
|
|
181
|
-
summary:
|
|
154
|
+
title: 'Computer',
|
|
155
|
+
status: 'Done',
|
|
156
|
+
summary: 'Analyzed pull request #142 for architectural consistency, security considerations, and edge cases.',
|
|
182
157
|
tasks: [
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
158
|
+
'Verified zero memory leaks and confirmed strict typing',
|
|
159
|
+
'Validated test suite passes across all target environments',
|
|
160
|
+
'Posted inline review suggestions for error handling',
|
|
186
161
|
],
|
|
187
162
|
},
|
|
188
163
|
'Research Analyst': {
|
|
189
|
-
title:
|
|
190
|
-
status:
|
|
191
|
-
summary:
|
|
164
|
+
title: 'Computer',
|
|
165
|
+
status: 'Done',
|
|
166
|
+
summary: 'Indexed frontier model benchmarks, competitive releases, and performance telemetry.',
|
|
192
167
|
tasks: [
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
168
|
+
'Indexed latest release notes and technical benchmarks',
|
|
169
|
+
'Created comparative capability matrix',
|
|
170
|
+
'Generated summary digest for the engineering team',
|
|
196
171
|
],
|
|
197
172
|
},
|
|
198
173
|
};
|
|
199
174
|
export function Bots() {
|
|
200
|
-
const { t, locale } = useI18n();
|
|
201
175
|
const { client, ready } = useAi();
|
|
202
176
|
const { user, isAuthenticated } = useIam();
|
|
203
177
|
// A client EXISTS signed out — `useAi` hands back an anonymous one so the
|
|
@@ -227,12 +201,12 @@ export function Bots() {
|
|
|
227
201
|
setRosterFailed(null);
|
|
228
202
|
}
|
|
229
203
|
catch (e) {
|
|
230
|
-
setRosterFailed(say(e,
|
|
204
|
+
setRosterFailed(say(e, 'this org’s bots'));
|
|
231
205
|
}
|
|
232
206
|
finally {
|
|
233
207
|
setLoading(false);
|
|
234
208
|
}
|
|
235
|
-
}, [client
|
|
209
|
+
}, [client]);
|
|
236
210
|
useEffect(() => {
|
|
237
211
|
if (live)
|
|
238
212
|
void read();
|
|
@@ -249,11 +223,8 @@ export function Bots() {
|
|
|
249
223
|
const q = query.trim().toLowerCase();
|
|
250
224
|
if (!q)
|
|
251
225
|
return activeRoster;
|
|
252
|
-
return activeRoster.filter((b) =>
|
|
253
|
-
|
|
254
|
-
return b.name.toLowerCase().includes(q) || about.toLowerCase().includes(q);
|
|
255
|
-
});
|
|
256
|
-
}, [activeRoster, query, live, t]);
|
|
226
|
+
return activeRoster.filter((b) => b.name.toLowerCase().includes(q) || (b.description ?? '').toLowerCase().includes(q));
|
|
227
|
+
}, [activeRoster, query]);
|
|
257
228
|
const bot = useMemo(() => activeRoster.find((b) => b.name === picked) ?? shown[0] ?? activeRoster[0] ?? null, [activeRoster, shown, picked]);
|
|
258
229
|
// Its record and its work, re-read after anything this room does to it —
|
|
259
230
|
// the platform's answer is the only account of what happened.
|
|
@@ -296,13 +267,13 @@ export function Bots() {
|
|
|
296
267
|
const computerAction = bot ? EXAMPLE_ACTIONS[bot.name] ?? null : null;
|
|
297
268
|
const stream = useMemo(() => {
|
|
298
269
|
if (!live) {
|
|
299
|
-
return trialTurns.map((
|
|
270
|
+
return trialTurns.map((t) => ({ at: t.at, key: t.id, turn: t, session: null }));
|
|
300
271
|
}
|
|
301
272
|
return [
|
|
302
|
-
...turns(detail
|
|
273
|
+
...turns(detail).map((t) => ({ at: t.at, key: t.id, turn: t, session: null })),
|
|
303
274
|
...own.map((s) => ({ at: at(s.updatedAt || s.startedAt || s.createdAt), key: s.id, turn: null, session: s })),
|
|
304
275
|
].sort((a, b) => a.at - b.at);
|
|
305
|
-
}, [live, detail, own, trialTurns
|
|
276
|
+
}, [live, detail, own, trialTurns]);
|
|
306
277
|
const always = bot?.executionMode === ALWAYS;
|
|
307
278
|
// Newest last means the newest is off-screen on a Bot with any history, so
|
|
308
279
|
// the stream opens where a reader is looking rather than at its oldest run.
|
|
@@ -326,11 +297,8 @@ export function Bots() {
|
|
|
326
297
|
id: `trial-${Date.now()}-out`,
|
|
327
298
|
at: Date.now(),
|
|
328
299
|
who: 'bot',
|
|
329
|
-
text:
|
|
330
|
-
|
|
331
|
-
model: bot.model,
|
|
332
|
-
}),
|
|
333
|
-
note: t('{model} · {seconds}s · {count} tokens', { model: bot.model, seconds: '0.8', count: 142 }),
|
|
300
|
+
text: `Received: "${input}". Running on ${bot.model} with computer tools enabled. Sign in to your organization to deploy bots into production.`,
|
|
301
|
+
note: `${bot.model} · 0.8s · 142 tokens`,
|
|
334
302
|
};
|
|
335
303
|
setTrialTurns((prev) => [...prev, botTurn]);
|
|
336
304
|
}, 400);
|
|
@@ -351,7 +319,7 @@ export function Bots() {
|
|
|
351
319
|
finally {
|
|
352
320
|
setRunning(false);
|
|
353
321
|
}
|
|
354
|
-
}, [live, client, bot, draft, running, refresh
|
|
322
|
+
}, [live, client, bot, draft, running, refresh]);
|
|
355
323
|
/** Stays up, or runs when asked. The platform REFUSES long-running without a
|
|
356
324
|
* cron — measured, 400 naming the field — so the cron is asked for beside
|
|
357
325
|
* the switch rather than guessed at here. */
|
|
@@ -379,46 +347,33 @@ export function Bots() {
|
|
|
379
347
|
await read();
|
|
380
348
|
}
|
|
381
349
|
catch (e) {
|
|
382
|
-
setFailed(say(e,
|
|
350
|
+
setFailed(say(e, 'this bot', 'save'));
|
|
383
351
|
}
|
|
384
|
-
}, [client, bot, read
|
|
385
|
-
return (_jsxs(XStack, { width: "100%", height: "100%", overflow: "hidden", bg: GROUND, "$max-lg": { overflowX: 'auto', overflowY: 'hidden' }, "$platform-web": { scrollSnapType: 'x mandatory' }, children: [_jsxs(YStack, { width: 280, minW: 280, height: "100%", bg: GROUND, borderRightWidth: 1, borderColor: LINE, "$max-lg": { width: '85%', maxW: 320 }, "$platform-web": { scrollSnapAlign: 'start' }, children: [_jsxs(XStack, { pt: 16, px: 18, pb: 12, items: "center", justify: "space-between", children: [_jsx(Lights, {}), _jsx(XStack, { ...GHOST, title:
|
|
352
|
+
}, [client, bot, read]);
|
|
353
|
+
return (_jsxs(XStack, { width: "100%", height: "100%", overflow: "hidden", bg: GROUND, "$max-lg": { overflowX: 'auto', overflowY: 'hidden' }, "$platform-web": { scrollSnapType: 'x mandatory' }, children: [_jsxs(YStack, { width: 280, minW: 280, height: "100%", bg: GROUND, borderRightWidth: 1, borderColor: LINE, "$max-lg": { width: '85%', maxW: 320 }, "$platform-web": { scrollSnapAlign: 'start' }, children: [_jsxs(XStack, { pt: 16, px: 18, pb: 12, items: "center", justify: "space-between", children: [_jsx(Lights, {}), _jsx(XStack, { ...GHOST, title: live ? 'New bot' : 'Sign in to keep a bot', onClick: () => setMaking((m) => !m), "aria-label": "New bot", "aria-expanded": making, disabled: !live, opacity: live ? 1 : 0.4, children: _jsx(Plus, { size: 18, color: DIM }) })] }), making && live ? (_jsx(Hire, { onDone: async (made) => {
|
|
386
354
|
setMaking(false);
|
|
387
355
|
setPicked(made.name);
|
|
388
356
|
await read();
|
|
389
|
-
}, onCancel: () => setMaking(false) })) : null, _jsx(YStack, { px: 14, pb: 12, children: _jsxs(XStack, { items: "center", gap: 8, bg: SURFACE, borderWidth: 1, borderColor: LINE, rounded: 8, px: 12, py: 8, children: [_jsx(Search, { size: 14, color: DIM, "aria-hidden": true }), _jsx(Input, { ...BARE, value: query, onChange: (e) => setQuery(e.target.value), placeholder:
|
|
357
|
+
}, onCancel: () => setMaking(false) })) : null, _jsx(YStack, { px: 14, pb: 12, children: _jsxs(XStack, { items: "center", gap: 8, bg: SURFACE, borderWidth: 1, borderColor: LINE, rounded: 8, px: 12, py: 8, children: [_jsx(Search, { size: 14, color: DIM, "aria-hidden": true }), _jsx(Input, { ...BARE, value: query, onChange: (e) => setQuery(e.target.value), placeholder: "Search", "aria-label": "Search bots", fontSize: "$2", flex: 1, minW: 0 })] }) }), _jsxs(YStack, { "data-hz": "roster", flex: 1, overflowY: "auto", px: 10, gap: 2, children: [live && rosterFailed ? (_jsx(Text, { ...NOTE, children: rosterFailed })) : live && loading && roster.length === 0 ? (_jsx(Text, { ...NOTE, children: "Reading the roster\u2026" })) : live && shown.length === 0 ? (_jsx(Text, { ...NOTE, children: roster.length === 0 ? 'This org keeps no bots yet.' : 'No bot matches that.' })) : null, shown.map((b) => {
|
|
390
358
|
const on = bot?.name === b.name;
|
|
391
|
-
return (_jsxs(XStack, { render: "button", type: 'button', "data-hz": "bot", "data-name": b.name, "aria-current": on, onClick: () => setPicked(b.name), items: "center", gap: 12, px: 12, py: 10, rounded: 10, bg: on ? SURFACE : 'transparent', borderWidth: 0, cursor: "pointer", width: "100%", children: [_jsx(Face, { bot: b, size: 36 }), _jsxs(YStack, { flex: 1, minW: 0, children: [_jsxs(XStack, { items: "center", justify: "space-between", gap: 8, children: [_jsx(Text, { fontSize: "$2", fontWeight: "600", color: on ? INK : DIM, children: b.name }), _jsx(Text, { fontSize: "$1", color: FAINT, whiteSpace: "nowrap", children: when(b.updatedAt
|
|
392
|
-
|
|
393
|
-
? b.description
|
|
394
|
-
: t(b.description)
|
|
395
|
-
: t(b.runs ? '{model} · {count} runs' : '{model}', {
|
|
396
|
-
model: b.model,
|
|
397
|
-
count: b.runs ?? 0,
|
|
398
|
-
}) })] })] }, b.id || b.name));
|
|
399
|
-
})] }), _jsxs(XStack, { px: 16, py: 14, borderTopWidth: 1, borderColor: LINE, items: "center", gap: 12, children: [_jsx(Text, { "aria-hidden": true, display: "flex", width: 32, height: 32, shrink: 0, rounded: 9999, bg: SURFACE, borderWidth: 1, borderColor: LINE, items: "center", justify: "center", fontSize: "$2", fontWeight: "600", color: DIM, children: (user?.name || (live ? '·' : 'Armand Segall')).trim().charAt(0).toUpperCase() }), _jsxs(YStack, { flex: 1, minW: 0, children: [_jsx(Text, { fontSize: "$2", fontWeight: "600", color: INK, children: user?.name || (live ? t('Signed in') : 'Armand Segall') }), _jsx(Text, { ...CLIP, fontSize: "$1", color: FAINT, children: user?.email || (live ? t('Active Workspace') : t('{email} · Example Workspace', { email: 'armand@example.com' })) })] })] })] }), _jsxs(YStack, { flex: 1, minW: 0, height: "100%", position: "relative", bg: GROUND, "$max-lg": { width: '100%', minW: '100%', shrink: 0, overflowX: 'hidden' }, "$platform-web": { scrollSnapAlign: 'start' }, children: [_jsxs(XStack, { height: 60, borderBottomWidth: 1, borderColor: LINE, items: "center", justify: "space-between", px: 16, gap: 12, children: [_jsxs(XStack, { items: "center", gap: 10, minW: 0, shrink: 1, children: [bot ? _jsx(Face, { bot: bot, size: 28 }) : null, _jsxs(YStack, { minW: 0, shrink: 1, children: [_jsx(Text, { ...CLIP, "data-hz": "head", fontSize: "$3", fontWeight: "600", color: INK, children: bot?.name || t('No bot') }), _jsx(Text, { ...CLIP, "data-hz": "mode", fontSize: "$1", color: FAINT, children: bot
|
|
400
|
-
? t(bot.schedule ? '{model} · {mode} · {schedule}' : '{model} · {mode}', {
|
|
401
|
-
model: bot.model,
|
|
402
|
-
mode: modeName(bot.executionMode, t),
|
|
403
|
-
schedule: bot.schedule ?? '',
|
|
404
|
-
})
|
|
405
|
-
: '' })] })] }), bot ? (_jsxs(XStack, { items: "center", gap: 8, shrink: 0, children: [!always ? (_jsx(Input, { ...BOXED, "data-hz": "cron", value: cron, onChange: (e) => setCron(e.target.value), placeholder: t('0 * * * *'), "aria-label": t('Schedule, as a 5-field cron'), width: 104, fontSize: "$1" })) : null, _jsx(Button, { size: "sm", variant: always ? 'primary' : 'default', rounded: 999, title: t(always ? 'Run only when asked' : 'Keep this bot up on a schedule'), "data-hz": "always", onClick: keepUp, "aria-pressed": always, children: t('24/7') }), _jsx(Button, { size: "sm", variant: "primary", title: t('Open a session for this bot'), "data-hz": "open", onClick: async () => {
|
|
359
|
+
return (_jsxs(XStack, { render: "button", type: 'button', "data-hz": "bot", "data-name": b.name, "aria-current": on, onClick: () => setPicked(b.name), items: "center", gap: 12, px: 12, py: 10, rounded: 10, bg: on ? SURFACE : 'transparent', borderWidth: 0, cursor: "pointer", width: "100%", children: [_jsx(Face, { bot: b, size: 36 }), _jsxs(YStack, { flex: 1, minW: 0, children: [_jsxs(XStack, { items: "center", justify: "space-between", gap: 8, children: [_jsx(Text, { fontSize: "$2", fontWeight: "600", color: on ? INK : DIM, children: b.name }), _jsx(Text, { fontSize: "$1", color: FAINT, whiteSpace: "nowrap", children: when(b.updatedAt) })] }), _jsx(Text, { ...CLIP, fontSize: "$2", color: DIM, text: "left", children: b.description || `${b.model}${b.runs ? ` · ${b.runs} runs` : ''}` })] })] }, b.id || b.name));
|
|
360
|
+
})] }), _jsxs(XStack, { px: 16, py: 14, borderTopWidth: 1, borderColor: LINE, items: "center", gap: 12, children: [_jsx(Text, { "aria-hidden": true, display: "flex", width: 32, height: 32, shrink: 0, rounded: 9999, bg: SURFACE, borderWidth: 1, borderColor: LINE, items: "center", justify: "center", fontSize: "$2", fontWeight: "600", color: DIM, children: (user?.name || (live ? '·' : 'Armand Segall')).trim().charAt(0).toUpperCase() }), _jsxs(YStack, { flex: 1, minW: 0, children: [_jsx(Text, { fontSize: "$2", fontWeight: "600", color: INK, children: user?.name || (live ? 'Signed in' : 'Armand Segall') }), _jsx(Text, { ...CLIP, fontSize: "$1", color: FAINT, children: user?.email || (live ? 'Active Workspace' : 'armand@example.com · Example Workspace') })] })] })] }), _jsxs(YStack, { flex: 1, minW: 0, height: "100%", position: "relative", bg: GROUND, "$max-lg": { width: '100%', minW: '100%', shrink: 0, overflowX: 'hidden' }, "$platform-web": { scrollSnapAlign: 'start' }, children: [_jsxs(XStack, { height: 60, borderBottomWidth: 1, borderColor: LINE, items: "center", justify: "space-between", px: 16, gap: 12, children: [_jsxs(XStack, { items: "center", gap: 10, minW: 0, shrink: 1, children: [bot ? _jsx(Face, { bot: bot, size: 28 }) : null, _jsxs(YStack, { minW: 0, shrink: 1, children: [_jsx(Text, { ...CLIP, "data-hz": "head", fontSize: "$3", fontWeight: "600", color: INK, children: bot?.name || 'No bot' }), _jsx(Text, { ...CLIP, "data-hz": "mode", fontSize: "$1", color: FAINT, children: bot ? `${bot.model} · ${bot.executionMode || ONCE}${bot.schedule ? ` · ${bot.schedule}` : ''}` : '' })] })] }), bot ? (_jsxs(XStack, { items: "center", gap: 8, shrink: 0, children: [!always ? (_jsx(Input, { ...BOXED, "data-hz": "cron", value: cron, onChange: (e) => setCron(e.target.value), placeholder: "0 * * * *", "aria-label": "Schedule, as a 5-field cron", width: 104, fontSize: "$1" })) : null, _jsx(Button, { size: "sm", variant: always ? 'primary' : 'default', rounded: 999, title: always ? 'Run only when asked' : 'Keep this bot up on a schedule', "data-hz": "always", onClick: keepUp, "aria-pressed": always, children: "24/7" }), _jsx(Button, { size: "sm", variant: "primary", title: "Open a session for this bot", "data-hz": "open", onClick: async () => {
|
|
406
361
|
if (!client || !bot)
|
|
407
362
|
return;
|
|
408
363
|
setFailed(null);
|
|
409
364
|
try {
|
|
410
|
-
await launch(client, bot.name,
|
|
365
|
+
await launch(client, bot.name, `${bot.name} session`);
|
|
411
366
|
await refresh();
|
|
412
367
|
}
|
|
413
368
|
catch (e) {
|
|
414
369
|
setFailed(e instanceof Error ? e.message : String(e));
|
|
415
370
|
}
|
|
416
|
-
}, children:
|
|
371
|
+
}, children: "Open a session" }), _jsx(XStack, { ...GHOST, title: 'What this bot has', "data-hz": "runtime", onClick: () => setPane((p) => !p), "aria-label": "Runtime", "aria-pressed": pane, bg: pane ? SURFACE : 'transparent', children: _jsx(Monitor, { size: 18, color: pane ? INK : DIM }) }), _jsx(XStack, { ...GHOST, title: 'Retire', "data-hz": "retire", onClick: retire, "aria-label": `Retire ${bot.name}`, children: _jsx(Trash2, { size: 16, color: DIM }) })] })) : null] }), _jsxs(XStack, { flex: 1, minH: 0, children: [_jsxs(YStack, { flex: 1, minW: 0, overflow: "hidden", children: [_jsxs(YStack, { "data-hz": "stream", flex: 1, overflowY: "auto", px: 32, py: 24, gap: 16, children: [!bot ? (_jsx(Text, { ...NOTE, children: live
|
|
417
372
|
? 'Nothing is kept yet. A bot is a model, a standing instruction and a record of what it has done — press + to keep one.'
|
|
418
|
-
: 'Select a bot to begin.'
|
|
419
|
-
?
|
|
373
|
+
: 'Select a bot to begin.' })) : null, bot && detail?.instructions ? (_jsxs(YStack, { ...CARD, children: [_jsx(Text, { ...LABEL, children: "Standing instruction" }), _jsx(Text, { render: "p", fontSize: "$2", lineHeight: "1.3rem", color: DIM, whiteSpace: "pre-wrap", children: detail.instructions })] })) : null, computerAction ? (_jsxs(YStack, { ...CARD, "data-hz": "computer-card", children: [_jsxs(XStack, { items: "center", justify: "space-between", children: [_jsxs(XStack, { items: "center", gap: 8, children: [_jsx(Monitor, { size: 15, color: INK }), _jsx(Text, { fontSize: "$2", fontWeight: "600", color: INK, children: computerAction.title })] }), _jsx(Text, { display: "inline-flex", items: "center", px: 8, py: 2, rounded: 999, fontSize: "$1", fontWeight: "600", bg: SURFACE, color: DIM, borderWidth: 1, borderColor: LINE, children: computerAction.status })] }), _jsx(Text, { render: "p", fontSize: "$2", lineHeight: "1.26rem", color: INK, children: computerAction.summary }), _jsx(YStack, { gap: 5, mt: 4, children: computerAction.tasks.map((task, idx) => (_jsxs(XStack, { items: "center", gap: 8, children: [_jsx(YStack, { width: 4, height: 4, shrink: 0, rounded: 9999, bg: FAINT }), _jsx(Text, { fontSize: "$2", color: DIM, children: task })] }, idx))) })] })) : null, bot && stream.length === 0 && !computerAction ? (_jsx(Text, { ...NOTE, children: "Nothing has been run yet. Ask for something below and the run is recorded here." })) : null, stream.map(({ key, turn, session }) => session ? (_jsx(Live, { session: session, onChange: refresh }, key)) : turn ? (_jsxs(Text, { render: "div", "data-hz": turn.who === 'you' ? 'asked' : 'answered', self: turn.who === 'you' ? 'flex-end' : 'flex-start', maxW: 620, rounded: 14, px: 16, py: 12, fontSize: "$3", lineHeight: "1.35625rem", whiteSpace: "pre-wrap", bg: turn.who === 'you' ? SURFACE : RAISED, borderWidth: 1, borderColor: LINE, color: turn.failed ? DIM : INK, children: [turn.text, turn.note ? (_jsx(Text, { display: "block", mt: 6, fontSize: "$1", lineHeight: "1.0656rem", color: FAINT, children: turn.failed ? `failed · ${turn.note}` : turn.note })) : null] }, key)) : null), _jsx("div", { ref: foot })] }), _jsxs(YStack, { pt: 16, px: 32, pb: 24, children: [failed ? _jsx(Text, { ...NOTE, px: 0, pt: 0, pb: 8, children: failed }) : null, _jsxs(XStack, { render: "form", onSubmit: run, items: "center", gap: 12, bg: SURFACE, borderWidth: 1, borderColor: LINE, rounded: 26, pt: 6, pr: 8, pb: 6, pl: 16, children: [_jsx(Input, { ...BARE, "data-hz": "ask", value: draft, onChange: (e) => setDraft(e.target.value), placeholder: bot ? `Message ${bot.name}` : 'Message bot...', "aria-label": "Task", disabled: !bot || running, flex: 1, fontSize: "$3" }), _jsx(Button, { type: "submit", variant: "primary", size: "icon", rounded: 9999, title: "Run this task", "data-hz": "run", disabled: !bot || running || !draft.trim(), "aria-label": "Run this task", children: _jsx(Send, { size: 16 }) })] }), _jsx(Text, { render: "p", mt: 8, fontSize: "$1", color: FAINT, children: running
|
|
374
|
+
? 'Running. The recorded run appears above when the platform answers.'
|
|
420
375
|
: bot
|
|
421
|
-
?
|
|
376
|
+
? `Runs on ${bot.model}, recorded against ${bot.name}.`
|
|
422
377
|
: '' })] })] }), pane && bot ? _jsx(Runtime, { bot: bot }) : null] })] })] }));
|
|
423
378
|
}
|
|
424
379
|
/**
|
|
@@ -434,7 +389,6 @@ export function Bots() {
|
|
|
434
389
|
* difference between a control and a button that appears to work.
|
|
435
390
|
*/
|
|
436
391
|
function Live({ session, onChange }) {
|
|
437
|
-
const { t, locale } = useI18n();
|
|
438
392
|
const { client } = useAi();
|
|
439
393
|
const [said, setSaid] = useState(null);
|
|
440
394
|
const command = async (verb) => {
|
|
@@ -442,23 +396,14 @@ function Live({ session, onChange }) {
|
|
|
442
396
|
return;
|
|
443
397
|
try {
|
|
444
398
|
const r = await steer(client, session.id, verb);
|
|
445
|
-
|
|
446
|
-
const recorded = verb === 'pause'
|
|
447
|
-
? t('pause recorded — no runner is attached to this session')
|
|
448
|
-
: verb === 'resume'
|
|
449
|
-
? t('resume recorded — no runner is attached to this session')
|
|
450
|
-
: t('stop recorded — no runner is attached to this session');
|
|
451
|
-
setSaid(r.forwarded ? delivered : recorded);
|
|
399
|
+
setSaid(r.forwarded ? `${verb} delivered` : `${verb} recorded — no runner is attached to this session`);
|
|
452
400
|
await onChange();
|
|
453
401
|
}
|
|
454
402
|
catch (e) {
|
|
455
|
-
setSaid(say(e,
|
|
403
|
+
setSaid(say(e, 'this session', 'save'));
|
|
456
404
|
}
|
|
457
405
|
};
|
|
458
|
-
return (_jsxs(YStack, { ...CARD, "data-hz": "session", "data-status": session.status, children: [_jsxs(XStack, { items: "baseline", justify: "space-between", gap: 8, children: [_jsx(Text, { fontSize: "$2", fontWeight: "600", color: INK, children: session.title ||
|
|
459
|
-
status: sessionStatus(session.status, t),
|
|
460
|
-
count: session.events ?? 0,
|
|
461
|
-
}) })] }), session.lastEvent?.preview ? (_jsx(Text, { ...CLIP, render: "p", fontSize: "$1", lineHeight: "1.03125rem", fontFamily: "$mono", color: FAINT, children: session.lastEvent.preview })) : null, open(session) ? (_jsxs(XStack, { gap: 6, children: [_jsx(Text, { ...TAB, "data-hz": "pause", onClick: () => command('pause'), children: t('Pause') }), _jsx(Text, { ...TAB, "data-hz": "resume", onClick: () => command('resume'), children: t('Resume') }), _jsx(Text, { ...TAB, "data-hz": "stop", onClick: () => command('stop'), children: t('Stop') })] })) : null, said ? _jsx(Text, { render: "p", fontSize: "$1", color: FAINT, children: said }) : null] }));
|
|
406
|
+
return (_jsxs(YStack, { ...CARD, "data-hz": "session", "data-status": session.status, children: [_jsxs(XStack, { items: "baseline", justify: "space-between", gap: 8, children: [_jsx(Text, { fontSize: "$2", fontWeight: "600", color: INK, children: session.title || 'Session' }), _jsxs(Text, { fontSize: "$1", color: FAINT, children: [session.status, " \u00B7 ", session.events ?? 0, " turns"] })] }), session.lastEvent?.preview ? (_jsx(Text, { ...CLIP, render: "p", fontSize: "$1", lineHeight: "1.03125rem", fontFamily: "$mono", color: FAINT, children: session.lastEvent.preview })) : null, open(session) ? (_jsxs(XStack, { gap: 6, children: [_jsx(Text, { ...TAB, "data-hz": "pause", onClick: () => command('pause'), children: "Pause" }), _jsx(Text, { ...TAB, "data-hz": "resume", onClick: () => command('resume'), children: "Resume" }), _jsx(Text, { ...TAB, "data-hz": "stop", onClick: () => command('stop'), children: "Stop" })] })) : null, said ? _jsx(Text, { render: "p", fontSize: "$1", color: FAINT, children: said }) : null] }));
|
|
462
407
|
}
|
|
463
408
|
/**
|
|
464
409
|
* Keeping a Bot.
|
|
@@ -469,7 +414,6 @@ function Live({ session, onChange }) {
|
|
|
469
414
|
* platform's own sentence is what a reader is shown.
|
|
470
415
|
*/
|
|
471
416
|
function Hire({ onDone, onCancel }) {
|
|
472
|
-
const { t, locale } = useI18n();
|
|
473
417
|
const { client } = useAi();
|
|
474
418
|
const [name, setName] = useState('');
|
|
475
419
|
const [model, setModel] = useState(ENSO);
|
|
@@ -508,5 +452,5 @@ function Hire({ onDone, onCancel }) {
|
|
|
508
452
|
finally {
|
|
509
453
|
setBusy(false);
|
|
510
454
|
}
|
|
511
|
-
}, "data-hz": "hire", mx: 10, mb: 10, p: 12, gap: 8, bg: RAISED, borderWidth: 1, borderColor: LINE, rounded: 10, children: [_jsx(Input, { ...BOXED, "data-hz": "name", value: name, onChange: (e) => setName(e.target.value), placeholder:
|
|
455
|
+
}, "data-hz": "hire", mx: 10, mb: 10, p: 12, gap: 8, bg: RAISED, borderWidth: 1, borderColor: LINE, rounded: 10, children: [_jsx(Input, { ...BOXED, "data-hz": "name", value: name, onChange: (e) => setName(e.target.value), placeholder: "Name", "aria-label": "Bot name", autoFocus: true }), _jsx(Input, { ...BOXED, "data-hz": "model", list: "bot-models", value: model, onChange: (e) => setModel(e.target.value), placeholder: "Model", "aria-label": "Model" }), _jsx("datalist", { id: "bot-models", children: served.map((m) => (_jsx("option", { value: m.id }, m.id))) }), _jsx(Input, { ...BOXED, value: about, onChange: (e) => setAbout(e.target.value), placeholder: "What it is for", "aria-label": "Description" }), _jsx(Input, { ...BOXED, render: "textarea", rows: 2, value: orders, onChange: (e) => setOrders(e.target.value), placeholder: "Standing instruction", "aria-label": "Standing instruction" }), failed ? _jsx(Text, { "data-hz": "hire-failed", fontSize: "$1", color: DIM, children: failed }) : null, _jsxs(XStack, { gap: 6, children: [_jsx(Button, { type: "submit", variant: "primary", size: "sm", "data-hz": "keep", disabled: busy || !name.trim(), flex: 1, children: busy ? 'Keeping…' : 'Keep' }), _jsx(Button, { size: "sm", onClick: onCancel, flex: 1, children: "Cancel" })] })] }));
|
|
512
456
|
}
|