@hanzo/app 0.2.55 → 0.2.57

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