@hanzo/app 0.2.53 → 0.2.55

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.
@@ -1,12 +1,12 @@
1
1
  'use client';
2
2
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { useEffect, useMemo, useRef, useState } from 'react';
4
- import { AtSign, CalendarCheck, Check, ChevronDown, Eye, FileSpreadsheet, FileText, Flame, GitMerge, GitPullRequest, Hash, Headphones, Heart, Image as Picture, Laugh, Mail, Menu, Mic, PartyPopper, Plus, Presentation, Rocket, Search, SendHorizontal, Smile, SquarePen, ThumbsUp, X, } from 'lucide-react';
4
+ import { AtSign, CalendarCheck, Check, ChevronDown, Eye, FileSpreadsheet, FileText, Flame, GitMerge, GitPullRequest, Hash, Headphones, Heart, Image as Picture, Laugh, Mail, Menu, Mic, PartyPopper, Plus, Presentation, Rocket, Search, SendHorizontal, Smile, SquarePen, ThumbsUp, X, CornerDownRight, ShieldCheck, Target, Wallet, UserRound, } from 'lucide-react';
5
5
  import { useI18n } from '@hanzo/i18n/react';
6
6
  import { Avatar as Monogram, Text, View, XStack, YStack } from '@hanzo/ui';
7
7
  import { Face } from './cast.js';
8
8
  import { md, useHost, usePlay, useStage, useStill } from './preview.js';
9
- import { DAY, HOME, ORGS, SCENE, STILL, agent, channelOf, frame, orgOf, pace, who } from './workday.js';
9
+ import { DAY, HOME, LIMITS, MISSIONS, ORGS, SCENE, STILL, agent, channelOf, frame, orgOf, pace, waiting, who } from './workday.js';
10
10
  /**
11
11
  * Hanzo Team, playing: a working day in the workspace, laid out the way a team
12
12
  * chat is read. hanzo.team's landing and hanzo.ai's /team open on it, and
@@ -52,6 +52,8 @@ const ME = 'ada';
52
52
  const DESK = 560;
53
53
  /** The workspace's column: narrower while the preview is. */
54
54
  const breadth = (width) => (width && width < 700 ? 176 : width && width < 820 ? 200 : 232);
55
+ /** How tall a phone's preview must be to list the channels under the orgs (a short one, a landing's card, leaves them to the drawer). */
56
+ const LIST = 560;
55
57
  /** How wide the preview must be for the channel's header to show who is in it. */
56
58
  const FACES = 900;
57
59
  /** "1 reply", "3 replies". */
@@ -152,6 +154,46 @@ function Tile({ org, on, n, size, onPress }) {
152
154
  const { t } = useI18n();
153
155
  return (_jsxs(XStack, { render: _jsx("button", { type: "button", "aria-pressed": on, "aria-label": n ? t('Open {org}, {count} unread', { org: org.name, count: n }) : t('Open {org}', { org: org.name }), onClick: onPress }), position: "relative", shrink: 0, p: 2, rounded: 10, borderWidth: 2, borderColor: on ? '$ink' : 'transparent', bg: "transparent", cursor: "pointer", opacity: on ? 1 : 0.8, hoverStyle: { opacity: 1 }, focusVisibleStyle: ROW.focusVisibleStyle, "$platform-web": { borderRadius: '10px', transition: 'opacity 200ms ease, border-color 260ms ease' }, children: [_jsx(Monogram, { size: size, shape: "rounded", name: org.name, colorSeed: org.id, variant: on ? 'outline' : 'soft' }), n ? (_jsx(View, { position: "absolute", t: -7, insetInlineEnd: -8, children: _jsx(Count, { n: n }) })) : null] }));
154
156
  }
157
+ /** One of the panel's boxes: a title (and what stands at its end), then what it holds. */
158
+ function Box({ icon: Icon, title, aside, children }) {
159
+ return (_jsxs(YStack, { gap: 8, p: 12, rounded: 12, borderWidth: 1, borderColor: "$edge", bg: "$panel", "$platform-web": { borderRadius: '12px' }, children: [_jsxs(XStack, { items: "center", gap: 6, children: [_jsx(Icon, { size: 13, color: "var(--foreground)", "aria-hidden": true }), _jsx(Text, { flex: 1, minW: 0, fontSize: "$1", fontWeight: "700", color: "$ink", numberOfLines: 1, children: title }), aside] }), children] }));
160
+ }
161
+ /**
162
+ * The approval mode, as the app's settings hold it: autonomous (agents run
163
+ * tools on their own and stop for anything risky) or supervised (they ask
164
+ * before each tool, connector or site). Spending limits hold either way.
165
+ */
166
+ function Mode({ supervised, onSet, small = false }) {
167
+ const { t } = useI18n();
168
+ return (_jsx(XStack, { role: "radiogroup", "aria-label": t('How agents act'), p: 2, gap: 2, rounded: 9999, borderWidth: 1, borderColor: "$edge", bg: "$background", self: "flex-start", "$platform-web": { borderRadius: '9999px' }, children: [
169
+ { on: false, label: t('Autonomous') },
170
+ { on: true, label: t('Supervised') },
171
+ ].map((m) => {
172
+ const active = m.on === supervised;
173
+ return (_jsx(XStack, { render: _jsx("button", { type: "button", role: "radio", "aria-checked": active, onClick: () => onSet(m.on) }), px: small ? 9 : 11, height: small ? 24 : 26, items: "center", rounded: 9999, borderWidth: 0, bg: active ? '$ink' : 'transparent', cursor: "pointer", focusVisibleStyle: ROW.focusVisibleStyle, "$platform-web": { borderRadius: '9999px', transition: 'background-color 200ms ease' }, children: _jsx(Text, { fontSize: small ? 11 : '$1', fontWeight: "600", color: active ? '$background' : '$soft', children: m.label }) }, m.label));
174
+ }) }));
175
+ }
176
+ /** A bar of how much of a whole is done. */
177
+ function Progress({ done, total }) {
178
+ return (_jsx(View, { height: 6, rounded: 9999, bg: "$raised", overflow: "hidden", "$platform-web": { borderRadius: '9999px' }, children: _jsx(View, { height: "100%", width: `${total ? Math.round((done / total) * 100) : 0}%`, bg: "$ink", rounded: 9999, "$platform-web": { borderRadius: '9999px', transition: 'width 600ms cubic-bezier(0.2, 0.7, 0.2, 1)' } }) }));
179
+ }
180
+ /**
181
+ * The column beside the channel, from 1000px of the preview's own width: how
182
+ * agents act here, what waits on a person, the org's mission and how far it
183
+ * has come, who handed what to whom, and the agents' spending limits.
184
+ */
185
+ function Panel({ org, supervised, onMode, asks, done, handoffs, onOpen }) {
186
+ const { t } = useI18n();
187
+ const clock = useClock();
188
+ const mission = MISSIONS[org];
189
+ // The four steps shown: the last two done, then what is next.
190
+ const from = mission ? Math.max(0, Math.min(done.length - 2, mission.steps.length - 4)) : 0;
191
+ const agents = ORGS.find((o) => o.id === org)?.agents.filter((a) => LIMITS[a]).slice(0, 3) ?? [];
192
+ return (_jsxs(YStack, { flex: 1, minH: 0, overflow: "hidden", gap: 10, p: 12, bg: "$sunken", "$platform-web": FOOT, children: [_jsxs(Box, { icon: ShieldCheck, title: t('How agents act'), children: [_jsx(Mode, { supervised: supervised, onSet: onMode }), _jsx(Text, { fontSize: "$1", lineHeight: 16, color: "$soft", children: supervised ? t('Agents ask before each tool, connector or site. Spending limits stay on.') : t('Agents run tools on their own and stop for anything risky. Spending limits stay on.') })] }), _jsx(Box, { icon: UserRound, title: t('Needs a person'), aside: _jsx(Text, { "data-motion": "rise", fontSize: "$1", fontWeight: "700", color: "$ink", "data-i18n-ltr": true, children: asks.length }, asks.length), children: asks.length ? (asks.slice(0, 3).map((a) => (_jsxs(XStack, { "data-motion": "rise", render: _jsx("button", { type: "button", "aria-label": t('Open #{channel}', { channel: channelOf(a.room) }), onClick: () => onOpen(a.room) }), items: "center", gap: 8, p: 4, rounded: 8, bg: "transparent", ...ROW, "$platform-web": { borderRadius: '8px', textAlign: 'start' }, children: [_jsx(Avatar, { id: a.who, size: 20 }), _jsx(Text, { flex: 1, minW: 0, fontSize: "$1", lineHeight: 16, color: "$ink", numberOfLines: 2, children: t(a.say, { what: t(a.what) }) })] }, a.id)))) : (_jsx(Text, { fontSize: "$1", color: "$soft", children: t('Nothing right now.') })) }), mission ? (_jsxs(Box, { icon: Target, title: t(mission.title), aside: _jsx(Text, { fontSize: "$1", color: "$soft", "data-i18n-ltr": true, children: t('{done} of {total}', { done: done.length, total: mission.steps.length }) }), children: [_jsx(Progress, { done: done.length, total: mission.steps.length }), _jsx(YStack, { gap: 5, children: mission.steps.map((step, i) => ({ step, i })).slice(from, from + 4).map(({ step, i }) => (_jsxs(XStack, { items: "center", gap: 8, children: [_jsx(Tick, { done: done.includes(i) }), _jsx(Text, { flex: 1, minW: 0, fontSize: "$1", color: done.includes(i) ? '$ink' : '$soft', numberOfLines: 1, children: t(step) })] }, step))) })] })) : null, _jsx(Box, { icon: CornerDownRight, title: t('Handoffs'), children: handoffs.length ? ([...handoffs]
193
+ .reverse()
194
+ .slice(0, 4)
195
+ .map((h) => (_jsxs(XStack, { "data-motion": "rise", items: "center", gap: 6, children: [_jsx(Avatar, { id: h.from, size: 18 }), _jsx(CornerDownRight, { size: 11, color: "var(--muted-foreground)", "aria-hidden": true, "data-i18n-mirror": true }), _jsx(Avatar, { id: h.to, size: 18 }), _jsx(Text, { flex: 1, minW: 0, fontSize: "$1", color: "$ink", numberOfLines: 1, children: t('{from} to {to}', { from: who(h.from).name, to: who(h.to).name }) }), _jsx(Text, { fontSize: 11, color: "$faint", "data-i18n-ltr": true, children: clock(h.time) })] }, `${h.time}/${h.from}/${h.to}`)))) : (_jsx(Text, { fontSize: "$1", color: "$soft", children: t('No handoffs yet today.') })) }), agents.length ? (_jsx(Box, { icon: Wallet, title: t('Spending limits'), children: agents.map((a) => (_jsxs(XStack, { items: "center", gap: 8, children: [_jsx(Avatar, { id: a, size: 18 }), _jsx(Text, { flex: 1, minW: 0, fontSize: "$1", color: "$ink", numberOfLines: 1, children: who(a).name }), _jsx(Text, { fontSize: 11, color: "$soft", "data-i18n-ltr": true, children: t('{week} a week · {task} a task', { week: `$${LIMITS[a].week}`, task: `$${LIMITS[a].task}` }) })] }, a))) })) : null] }));
196
+ }
155
197
  /** Three dots that take turns, beside who is typing. */
156
198
  function Dots() {
157
199
  return (_jsx(XStack, { gap: 3, "aria-hidden": true, children: ['0ms', '200ms', '400ms'].map((delay) => (_jsx(View, { "data-motion": "pulse", width: 4, height: 4, rounded: 9999, bg: "$soft", "$platform-web": { borderRadius: '9999px', animationDelay: delay } }, delay))) }));
@@ -167,7 +209,7 @@ export function TeamPreview(props) {
167
209
  const { compact, phone } = props;
168
210
  const { t } = useI18n();
169
211
  const still = useStill();
170
- const { box, seen, width, visible, held, hold } = useStage();
212
+ const { box, seen, width, height, visible, held, hold } = useStage();
171
213
  const { live, end } = useHost(props);
172
214
  // It always lays itself out by its own width, so it fits a page's column, a
173
215
  // hero's half and a device's screen alike; the window decides only before it
@@ -183,6 +225,8 @@ export function TeamPreview(props) {
183
225
  const [hand, setHand] = useState({});
184
226
  const [threadHand, setThreadHand] = useState(undefined);
185
227
  const [drawer, setDrawer] = useState(false);
228
+ // How agents act: autonomous (the app's Auto approval) or supervised (Manual).
229
+ const [supervised, setSupervised] = useState(false);
186
230
  useEffect(() => {
187
231
  loop.current = !driven;
188
232
  }, [driven]);
@@ -203,8 +247,12 @@ export function TeamPreview(props) {
203
247
  const huddle = f.huddle[here] ?? [];
204
248
  const unread = (room) => (room === here || read.includes(room) ? 0 : (f.unread[room] ?? 0));
205
249
  /** What is unread across an org's channels. */
206
- const waiting = (org) => ORGS.find((x) => x.id === org)?.channels.reduce((n, c) => n + unread(`${org}/${c.id}`), 0) ?? 0;
250
+ const news = (org) => ORGS.find((x) => x.id === org)?.channels.reduce((n, c) => n + unread(`${org}/${c.id}`), 0) ?? 0;
207
251
  const members = [...o.people.slice(0, 2), ...o.agents.slice(0, 2)];
252
+ const asks = waiting(f, supervised).filter((a) => orgOf(a.room).id === o.id);
253
+ const done = f.steps[o.id] ?? [];
254
+ const handoffs = f.handoffs.filter((h) => orgOf(h.room).id === o.id);
255
+ const mission = MISSIONS[o.id];
208
256
  /** The reader takes over: nothing loops over what they set. */
209
257
  const go = (room) => {
210
258
  setDriven(true);
@@ -225,7 +273,7 @@ export function TeamPreview(props) {
225
273
  /** The organizations a person belongs to: the active one marked, "+" under them, the reader at the foot. */
226
274
  const rail = (_jsxs(YStack, { items: "center", gap: 12, py: 12, width: 60, height: "100%", shrink: 0, borderColor: "$edge", borderInlineEndWidth: 1, bg: "$sunken", children: [ORGS.map((x) => {
227
275
  const on = x.id === o.id;
228
- return (_jsxs(XStack, { position: "relative", items: "center", justify: "center", children: [_jsx(View, { position: "absolute", insetInlineStart: -8, width: 4, height: on ? 28 : 0, rounded: 9999, bg: "$ink", "$platform-web": { borderRadius: '9999px', transition: still ? 'none' : 'height 260ms ease' } }), _jsx(Tile, { org: x, on: on, n: on ? 0 : waiting(x.id), size: "xl", onPress: () => go(HOME[x.id]) })] }, x.id));
276
+ return (_jsxs(XStack, { position: "relative", items: "center", justify: "center", children: [_jsx(View, { position: "absolute", insetInlineStart: -8, width: 4, height: on ? 28 : 0, rounded: 9999, bg: "$ink", "$platform-web": { borderRadius: '9999px', transition: still ? 'none' : 'height 260ms ease' } }), _jsx(Tile, { org: x, on: on, n: on ? 0 : news(x.id), size: "xl", onPress: () => go(HOME[x.id]) })] }, x.id));
229
277
  }), _jsx(XStack, { width: 32, height: 32, rounded: 8, items: "center", justify: "center", borderWidth: 1, borderColor: "$edge", "$platform-web": { borderRadius: '8px' }, children: _jsx(Plus, { size: 15, color: "var(--muted-foreground)", "aria-hidden": true }) }), _jsx(View, { flex: 1 }), _jsxs(View, { position: "relative", children: [_jsx(Avatar, { id: ME, size: 30 }), _jsx(View, { position: "absolute", b: -1, insetInlineEnd: -1, rounded: 9999, borderWidth: 2, borderColor: "$sunken", "$platform-web": { borderRadius: '9999px' }, children: _jsx(Here, {}) })] })] }));
230
278
  const heading = (label) => (_jsxs(XStack, { items: "center", gap: 4, px: 8, pt: 12, pb: 3, children: [_jsx(ChevronDown, { size: 12, color: "var(--muted-foreground)", "aria-hidden": true }), _jsx(Text, { fontSize: "$1", fontWeight: "600", color: "$soft", children: label })] }));
231
279
  /** The workspace's column: its name, search, the channels, the direct messages and the agents. */
@@ -247,11 +295,11 @@ export function TeamPreview(props) {
247
295
  const side = parent ? (_jsxs(YStack, { flex: 1, minH: 0, bg: "var(--background)", children: [_jsxs(XStack, { items: "center", gap: 8, px: 14, minH: 52, borderBottomWidth: 1, borderColor: "$edge", children: [_jsxs(YStack, { flex: 1, minW: 0, children: [_jsx(Text, { fontSize: "$3", fontWeight: "700", color: "$ink", children: t('Thread') }), _jsx(Text, { fontSize: "$1", color: "$soft", "data-i18n-ltr": true, children: `#${channel}` })] }), _jsx(XStack, { render: _jsx("button", { type: "button", "aria-label": t('Close the thread'), onClick: () => openThread(null) }), width: 28, height: 28, rounded: 8, items: "center", justify: "center", bg: "transparent", ...ROW, "$platform-web": { borderRadius: '8px' }, children: _jsx(X, { size: 15, color: "var(--muted-foreground)", "aria-hidden": true }) })] }), _jsxs(YStack, { flex: 1, minH: 0, overflow: "hidden", justify: "flex-end", gap: 6, px: 14, pt: 8, pb: 4, "$platform-web": TOP, children: [_jsx(Post, { m: { ...parent, replies: [] }, grouped: false, onPick: pick(parent.id) }), _jsxs(XStack, { items: "center", gap: 8, py: 6, children: [_jsx(Text, { fontSize: "$1", color: "$soft", children: replies(t, parent.replies.length) }), _jsx(View, { flex: 1, height: 1, bg: "$edge" })] }), parent.replies.map((r, i) => (_jsx(Post, { m: { id: `${parent.id}/${i}`, who: r.who, text: r.text, time: r.time, reactions: [], replies: [] }, grouped: false, onPick: () => undefined }, i)))] }), composer(t('Reply…'))] }, parent.id)) : null;
248
296
  return (_jsxs(View, { ref: box, "data-slot": "team-preview", role: "group", "aria-label": t('Hanzo Team, playing a sample workspace'), ...hold, display: "grid", position: "relative", height: compact ? '100%' : 620, overflow: "hidden", bg: "var(--background)", gridTemplateColumns: "minmax(0, 1fr)", ...md(desk, {
249
297
  height: compact ? '100%' : 640,
250
- gridTemplateColumns: `60px ${breadth(width)}px minmax(0, 1fr)${roomy && parent ? ' 300px' : ''}`,
251
- }), "$platform-web": { textAlign: 'start' }, children: [_jsx(YStack, { display: "none", ...md(desk, { display: 'flex' }), minH: 0, children: rail }), _jsx(YStack, { display: "none", ...md(desk, { display: 'flex' }), minH: 0, borderColor: "$edge", borderInlineEndWidth: 1, bg: "$sunken", children: column }), _jsxs(YStack, { minW: 0, minH: 0, position: "relative", children: [_jsxs(XStack, { items: "center", gap: 10, px: 14, minH: 52, borderBottomWidth: 1, borderColor: "$edge", children: [_jsx(XStack, { ...md(desk, { display: 'none' }), children: _jsx(XStack, { render: _jsx("button", { type: "button", "aria-expanded": drawer, "aria-label": t('Channels in {org}', { org: o.name }), onClick: () => setDrawer(!drawer) }), width: 32, height: 32, rounded: 8, items: "center", justify: "center", bg: "transparent", ...ROW, "$platform-web": { borderRadius: '8px' }, children: _jsx(Menu, { size: 17, color: "var(--foreground)", "aria-hidden": true }) }) }), title, _jsxs(XStack, { display: "none", ...(width >= FACES ? { display: 'flex' } : {}), items: "center", children: [members.map((p, i) => (_jsx(View, { marginInlineStart: i ? -6 : 0, rounded: 9999, borderWidth: 2, borderColor: "var(--background)", "$platform-web": { borderRadius: '9999px' }, children: _jsx(Avatar, { id: p, size: 22 }) }, p))), _jsx(Text, { fontSize: "$1", color: "$soft", marginInlineStart: 6, "data-i18n-ltr": true, children: o.people.length + o.agents.length })] }), _jsxs(XStack, { "data-motion": "rise", items: "center", gap: 6, px: 10, height: 30, rounded: 8, borderWidth: 1, borderColor: huddle.length ? '$ink' : '$edge', bg: huddle.length ? '$ink' : 'transparent', "$platform-web": { borderRadius: '8px' }, children: [huddle.length ? _jsx(View, { "data-motion": "pulse", width: 7, height: 7, rounded: 9999, bg: "var(--state-online)", "$platform-web": { borderRadius: '9999px' } }) : null, _jsx(Headphones, { size: 14, color: huddle.length ? 'var(--background)' : 'var(--foreground)', "aria-hidden": true }), _jsx(Text, { display: "none", ...md(desk, { display: 'flex' }), fontSize: "$1", fontWeight: "600", color: huddle.length ? '$background' : '$ink', children: huddle.length ? t('Huddle · {count}', { count: huddle.length }) : t('Huddle') })] }, huddle.length ? 'on' : 'off')] }), _jsxs(YStack, { ...md(desk, { display: 'none' }), gap: 8, pt: 10, pb: 8, borderBottomWidth: 1, borderColor: "$edge", children: [_jsxs(XStack, { items: "center", gap: 10, px: 12, children: [ORGS.map((x) => (_jsx(Tile, { org: x, on: x.id === o.id, n: x.id === o.id ? 0 : waiting(x.id), size: "lg", onPress: () => go(HOME[x.id]) }, x.id))), _jsx(Text, { "data-motion": "rise", flex: 1, minW: 0, fontSize: "$3", fontWeight: "700", color: "$ink", numberOfLines: 1, marginInlineStart: 4, children: o.name }, o.id)] }), _jsx(XStack, { flexWrap: "wrap", gap: 6, px: 12, children: o.channels.map((c) => {
298
+ gridTemplateColumns: `60px ${breadth(width)}px minmax(0, 1fr)${roomy ? ' 290px' : ''}`,
299
+ }), "$platform-web": { textAlign: 'start' }, children: [_jsx(YStack, { display: "none", ...md(desk, { display: 'flex' }), minH: 0, children: rail }), _jsx(YStack, { display: "none", ...md(desk, { display: 'flex' }), minH: 0, borderColor: "$edge", borderInlineEndWidth: 1, bg: "$sunken", children: column }), _jsxs(YStack, { minW: 0, minH: 0, position: "relative", children: [_jsxs(XStack, { items: "center", gap: 10, px: 14, minH: 52, borderBottomWidth: 1, borderColor: "$edge", children: [_jsx(XStack, { ...md(desk, { display: 'none' }), children: _jsx(XStack, { render: _jsx("button", { type: "button", "aria-expanded": drawer, "aria-label": t('Channels in {org}', { org: o.name }), onClick: () => setDrawer(!drawer) }), width: 32, height: 32, rounded: 8, items: "center", justify: "center", bg: "transparent", ...ROW, "$platform-web": { borderRadius: '8px' }, children: _jsx(Menu, { size: 17, color: "var(--foreground)", "aria-hidden": true }) }) }), title, _jsxs(XStack, { display: "none", ...(width >= FACES ? { display: 'flex' } : {}), items: "center", children: [members.map((p, i) => (_jsx(View, { marginInlineStart: i ? -6 : 0, rounded: 9999, borderWidth: 2, borderColor: "var(--background)", "$platform-web": { borderRadius: '9999px' }, children: _jsx(Avatar, { id: p, size: 22 }) }, p))), _jsx(Text, { fontSize: "$1", color: "$soft", marginInlineStart: 6, "data-i18n-ltr": true, children: o.people.length + o.agents.length })] }), _jsxs(XStack, { "data-motion": "rise", items: "center", gap: 6, px: 10, height: 30, rounded: 8, borderWidth: 1, borderColor: huddle.length ? '$ink' : '$edge', bg: huddle.length ? '$ink' : 'transparent', "$platform-web": { borderRadius: '8px' }, children: [huddle.length ? _jsx(View, { "data-motion": "pulse", width: 7, height: 7, rounded: 9999, bg: "var(--state-online)", "$platform-web": { borderRadius: '9999px' } }) : null, _jsx(Headphones, { size: 14, color: huddle.length ? 'var(--background)' : 'var(--foreground)', "aria-hidden": true }), _jsx(Text, { display: "none", ...md(desk, { display: 'flex' }), fontSize: "$1", fontWeight: "600", color: huddle.length ? '$background' : '$ink', children: huddle.length ? t('Huddle · {count}', { count: huddle.length }) : t('Huddle') })] }, huddle.length ? 'on' : 'off')] }), _jsxs(YStack, { ...md(desk, { display: 'none' }), gap: 8, pt: 10, pb: 8, borderBottomWidth: 1, borderColor: "$edge", children: [_jsxs(XStack, { items: "center", gap: 10, px: 12, children: [ORGS.map((x) => (_jsx(Tile, { org: x, on: x.id === o.id, n: x.id === o.id ? 0 : news(x.id), size: "lg", onPress: () => go(HOME[x.id]) }, x.id))), _jsx(Text, { "data-motion": "rise", flex: 1, minW: 0, fontSize: "$3", fontWeight: "700", color: "$ink", numberOfLines: 1, marginInlineStart: 4, children: o.name }, o.id)] }), _jsx(XStack, { flexWrap: "wrap", gap: 6, px: 12, display: height && height < LIST ? 'none' : 'flex', children: o.channels.map((c) => {
252
300
  const room = `${o.id}/${c.id}`;
253
301
  const on = room === here;
254
302
  const n = unread(room);
255
303
  return (_jsxs(XStack, { render: _jsx("button", { type: "button", "aria-pressed": on, "aria-label": t('Open #{channel}', { channel: c.id }), onClick: () => go(room) }), shrink: 0, items: "center", gap: 5, px: 10, height: 28, rounded: 9999, borderWidth: 1, borderColor: on ? '$ink' : '$edge', bg: on ? '$ink' : 'transparent', cursor: "pointer", focusVisibleStyle: ROW.focusVisibleStyle, "$platform-web": { borderRadius: '9999px' }, children: [_jsx(Text, { fontSize: "$1", fontWeight: on || n ? '700' : '500', color: on ? '$background' : n ? '$ink' : '$soft', "data-i18n-ltr": true, children: `#${c.id}` }), n && !on ? _jsx(Count, { n: n }) : null] }, c.id));
256
- }) })] }), list(messages, true), _jsx(XStack, { items: "center", gap: 6, px: 18, minH: 20, children: typing && typing.room === here ? (_jsxs(_Fragment, { children: [_jsx(Dots, {}), _jsx(Text, { fontSize: "$1", color: "$soft", numberOfLines: 1, children: t('{name} is typing…', { name: who(typing.who).name }) })] })) : null }), composer(t('Message #{channel}', { channel })), side && !roomy ? (_jsx(YStack, { "data-motion": "rise", position: "absolute", t: 0, b: 0, insetInlineEnd: 0, width: "100%", maxW: 420, borderColor: "$edge", borderInlineStartWidth: 1, bg: "var(--background)", boxShadow: "0 24px 60px -24px color-mix(in srgb, var(--pure-black) 60%, transparent)", children: side })) : null, drawer && desk !== true ? (_jsxs(XStack, { "data-motion": "rise", position: "absolute", t: 0, b: 0, insetInlineStart: 0, width: "88%", maxW: 340, bg: "var(--background)", borderColor: "$edge", borderInlineEndWidth: 1, boxShadow: "0 24px 60px -24px color-mix(in srgb, var(--pure-black) 60%, transparent)", ...md(desk, { display: 'none' }), children: [rail, _jsx(YStack, { flex: 1, minW: 0, bg: "$sunken", children: column })] })) : null] }), side && roomy ? (_jsx(YStack, { minW: 0, minH: 0, borderColor: "$edge", borderInlineStartWidth: 1, children: side })) : null] }));
304
+ }) })] }), list(messages, true), _jsx(XStack, { items: "center", gap: 6, px: 18, minH: 20, children: typing && typing.room === here ? (_jsxs(_Fragment, { children: [_jsx(Dots, {}), _jsx(Text, { fontSize: "$1", color: "$soft", numberOfLines: 1, children: t('{name} is typing…', { name: who(typing.who).name }) })] })) : null }), roomy || (height && height < LIST) ? null : (_jsxs(XStack, { flexWrap: "wrap", items: "center", gap: 8, px: 12, pb: 8, children: [_jsx(Mode, { supervised: supervised, onSet: setSupervised, small: true }), _jsxs(XStack, { items: "center", gap: 6, px: 10, height: 28, rounded: 9999, borderWidth: 1, borderColor: asks.length ? '$ink' : '$edge', "$platform-web": { borderRadius: '9999px' }, children: [_jsx(UserRound, { size: 12, color: "var(--foreground)", "aria-hidden": true }), _jsx(Text, { "data-motion": "rise", fontSize: 11, fontWeight: "600", color: "$ink", children: asks.length ? t('{count} need a person', { count: asks.length }) : t('Nothing needs a person') }, asks.length)] }), mission ? (_jsxs(XStack, { items: "center", gap: 6, px: 10, height: 28, rounded: 9999, borderWidth: 1, borderColor: "$edge", "$platform-web": { borderRadius: '9999px' }, children: [_jsx(Target, { size: 12, color: "var(--foreground)", "aria-hidden": true }), _jsx(Text, { fontSize: 11, fontWeight: "600", color: "$ink", "data-i18n-ltr": true, children: t('{done} of {total}', { done: done.length, total: mission.steps.length }) }), _jsx(View, { width: 36, children: _jsx(Progress, { done: done.length, total: mission.steps.length }) })] })) : null] })), composer(t('Message #{channel}', { channel })), side && !roomy ? (_jsx(YStack, { "data-motion": "rise", position: "absolute", t: 0, b: 0, insetInlineEnd: 0, width: "100%", maxW: 420, borderColor: "$edge", borderInlineStartWidth: 1, bg: "var(--background)", boxShadow: "0 24px 60px -24px color-mix(in srgb, var(--pure-black) 60%, transparent)", children: side })) : null, drawer && desk !== true ? (_jsxs(XStack, { "data-motion": "rise", position: "absolute", t: 0, b: 0, insetInlineStart: 0, width: "88%", maxW: 340, bg: "var(--background)", borderColor: "$edge", borderInlineEndWidth: 1, boxShadow: "0 24px 60px -24px color-mix(in srgb, var(--pure-black) 60%, transparent)", ...md(desk, { display: 'none' }), children: [rail, _jsx(YStack, { flex: 1, minW: 0, bg: "$sunken", children: column })] })) : null] }), roomy ? (_jsx(YStack, { minW: 0, minH: 0, borderColor: "$edge", borderInlineStartWidth: 1, children: side ?? _jsx(Panel, { org: o.id, supervised: supervised, onMode: setSupervised, asks: asks, done: done, handoffs: handoffs, onOpen: go }) })) : null] }));
257
305
  }
@@ -0,0 +1,49 @@
1
+ export declare const TEAM: {
2
+ readonly name: 'Hanzo Team';
3
+ /** The page's one heading: the owner's words on hanzo.team. */
4
+ readonly title: string;
5
+ readonly lede: string;
6
+ readonly line: string;
7
+ /** Where a reader who wants a person goes. */
8
+ readonly contact: {
9
+ readonly label: string;
10
+ readonly href: "https://hanzo.ai/contact-sales";
11
+ };
12
+ /** Under the preview: what it is, so nobody reads sample data as a claim. */
13
+ readonly note: string;
14
+ readonly how: {
15
+ readonly eyebrow: string;
16
+ readonly title: string;
17
+ readonly sub: string;
18
+ };
19
+ readonly points: readonly [{
20
+ readonly title: string;
21
+ readonly body: string;
22
+ readonly link: {
23
+ readonly label: string;
24
+ readonly href: 'https://hanzo.team/agents';
25
+ };
26
+ }, {
27
+ readonly title: string;
28
+ readonly body: string;
29
+ readonly link: {
30
+ readonly label: string;
31
+ readonly href: 'https://docs.hanzo.bot/docs/concepts/multi-agent';
32
+ };
33
+ }, {
34
+ readonly title: string;
35
+ readonly body: string;
36
+ readonly link: {
37
+ readonly label: string;
38
+ readonly href: 'https://docs.hanzo.ai/docs/concepts/budgets';
39
+ };
40
+ }];
41
+ readonly close: {
42
+ readonly title: string;
43
+ readonly line: string;
44
+ };
45
+ };
46
+ /** The three points, numbered, each ending in where to read more. */
47
+ export declare function TeamPoints(): import("react").JSX.Element;
48
+ /** The line under the preview that says it is sample data. */
49
+ export declare function TeamNote(): import("react").JSX.Element;
@@ -0,0 +1,67 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { ArrowUpRight } from 'lucide-react';
4
+ import { phrase } from '@hanzo/i18n';
5
+ import { useI18n } from '@hanzo/i18n/react';
6
+ import { Text, View, XStack, YStack } from '@hanzo/ui';
7
+ /**
8
+ * Hanzo Team's story, told once for both pages that tell it: hanzo.team's
9
+ * landing and hanzo.ai/team. Each draws it in its own chrome (its bar, its
10
+ * bands, its heading type) around `TeamPreview`; the words, the three points and
11
+ * where each one leads are here, so the two cannot drift.
12
+ *
13
+ * Every sentence states something the product does: organizations and channels
14
+ * (the switcher, the rooms), agents with roles and spending limits (an agent's
15
+ * settings: a period cap and the most one task may spend, docs "Budgets"),
16
+ * agents handing work to agents (Hanzo Bot's multi-agent sessions), and the
17
+ * approval mode (Auto, which the app also calls autonomous, or Manual,
18
+ * supervised). The preview is sample data and says so (`TEAM.note`).
19
+ */
20
+ const CONTACT = 'https://hanzo.ai/contact-sales';
21
+ export const TEAM = {
22
+ name: 'Hanzo Team',
23
+ /** The page's one heading: the owner's words on hanzo.team. */
24
+ title: phrase('The playground for humans + AI'),
25
+ lede: phrase('Your people and your AI agents plan, build, and ship together — in one connected workspace.'),
26
+ line: phrase('Agents pass work to each other in your channels and bring a person in only when a decision is theirs.'),
27
+ /** Where a reader who wants a person goes. */
28
+ contact: { label: phrase('Talk to us'), href: CONTACT },
29
+ /** Under the preview: what it is, so nobody reads sample data as a claim. */
30
+ note: phrase('Illustrative preview: a sample workspace with sample people, agents and companies. Nothing in it runs.'),
31
+ how: {
32
+ eyebrow: phrase('How it works'),
33
+ title: phrase('Agents do the work. People make the calls.'),
34
+ sub: phrase('Every agent works for the people who hand it work. They share your channels, pass work along, and stop for a person when a decision is theirs.'),
35
+ },
36
+ points: [
37
+ {
38
+ title: phrase('A team that works for you'),
39
+ body: phrase('Each agent has a name, a role and its own spending limits, and works in your channels beside the people who hand it work.'),
40
+ link: { label: phrase('Meet the AI teammates'), href: 'https://hanzo.team/agents' },
41
+ },
42
+ {
43
+ title: phrase('Handoffs without a meeting'),
44
+ body: phrase('One agent hands work to another with a message, so the channel is the record. Routine back-and-forth never waits on a person.'),
45
+ link: { label: phrase('How agents work together'), href: 'https://docs.hanzo.bot/docs/concepts/multi-agent' },
46
+ },
47
+ {
48
+ title: phrase('Only the decisions that need you'),
49
+ body: phrase('Choose autonomous, where agents run tools on their own and stop for anything risky, or supervised, where they ask first. Budgets hold either way.'),
50
+ link: { label: phrase('Budgets in the docs'), href: 'https://docs.hanzo.ai/docs/concepts/budgets' },
51
+ },
52
+ ],
53
+ close: {
54
+ title: phrase('One place for your team and its agents.'),
55
+ line: phrase('Every organization you belong to, every channel, every agent, on one rail.'),
56
+ },
57
+ };
58
+ /** The three points, numbered, each ending in where to read more. */
59
+ export function TeamPoints() {
60
+ const { t } = useI18n();
61
+ return (_jsx(View, { render: "ol", display: "grid", gridTemplateColumns: "minmax(0, 1fr)", gap: 32, m: 0, p: 0, $md: { gridTemplateColumns: 'repeat(3, minmax(0, 1fr))', gap: 24 }, "$platform-web": { listStyle: 'none', textAlign: 'start' }, children: TEAM.points.map((p, i) => (_jsxs(YStack, { render: "li", gap: 10, pt: 16, borderTopWidth: 1, borderColor: "$edge", children: [_jsx(Text, { fontFamily: "$mono", fontSize: "$2", color: "$soft", "data-i18n-ltr": true, children: String(i + 1).padStart(2, '0') }), _jsx(Text, { render: "h3", m: 0, fontSize: "$6", lineHeight: "$6", fontWeight: "600", color: "$ink", children: t(p.title) }), _jsx(Text, { render: "p", m: 0, fontSize: "$3", lineHeight: "$4", color: "$soft", children: t(p.body) }), _jsxs(XStack, { render: _jsx("a", { href: p.link.href }), items: "center", gap: 6, mt: 4, self: "flex-start", hoverStyle: { opacity: 0.8 }, "$platform-web": { textDecoration: 'none' }, children: [_jsx(Text, { fontSize: "$2", fontWeight: "600", color: "$ink", children: t(p.link.label) }), _jsx(ArrowUpRight, { size: 14, color: "var(--foreground)", "aria-hidden": true, "data-i18n-mirror": true })] })] }, p.title))) }));
62
+ }
63
+ /** The line under the preview that says it is sample data. */
64
+ export function TeamNote() {
65
+ const { t } = useI18n();
66
+ return (_jsx(Text, { render: "p", m: 0, mt: 12, fontSize: "$1", lineHeight: "$2", color: "$soft", "$platform-web": { textAlign: 'center' }, children: t(TEAM.note) }));
67
+ }
package/dist/preview.d.ts CHANGED
@@ -10,14 +10,15 @@ export declare const REST = 4200;
10
10
  /**
11
11
  * Where a preview stands: whether it has been on screen (`seen`), whether it is
12
12
  * now (`visible`), whether the pointer is over it (`held`, kept by the `hold`
13
- * handlers the preview spreads on its box), and how wide it is (`width`, 0
14
- * until measured), which is how a preview decides its own layout wherever it
15
- * is placed.
13
+ * handlers the preview spreads on its box), and how wide and tall it is
14
+ * (`width`, `height`, 0 until measured), which is how a preview decides its own
15
+ * layout wherever it is placed.
16
16
  */
17
17
  export declare function useStage(): {
18
18
  box: import("react").RefObject<GuiElement>;
19
19
  seen: boolean;
20
20
  width: number;
21
+ height: number;
21
22
  visible: import("react").RefObject<boolean>;
22
23
  held: import("react").RefObject<boolean>;
23
24
  hold: {
package/dist/preview.js CHANGED
@@ -21,14 +21,14 @@ export const REST = 4200;
21
21
  /**
22
22
  * Where a preview stands: whether it has been on screen (`seen`), whether it is
23
23
  * now (`visible`), whether the pointer is over it (`held`, kept by the `hold`
24
- * handlers the preview spreads on its box), and how wide it is (`width`, 0
25
- * until measured), which is how a preview decides its own layout wherever it
26
- * is placed.
24
+ * handlers the preview spreads on its box), and how wide and tall it is
25
+ * (`width`, `height`, 0 until measured), which is how a preview decides its own
26
+ * layout wherever it is placed.
27
27
  */
28
28
  export function useStage() {
29
29
  const box = useRef(null);
30
30
  const [seen, setSeen] = useState(false);
31
- const [width, setWidth] = useState(0);
31
+ const [{ width, height }, setSize] = useState({ width: 0, height: 0 });
32
32
  const visible = useRef(false);
33
33
  const held = useRef(false);
34
34
  useEffect(() => {
@@ -41,7 +41,7 @@ export function useStage() {
41
41
  setSeen(true);
42
42
  }, { threshold: 0.25 });
43
43
  io.observe(el);
44
- const fit = new ResizeObserver(([e]) => setWidth(Math.round(e?.contentRect.width ?? 0)));
44
+ const fit = new ResizeObserver(([e]) => setSize({ width: Math.round(e?.contentRect.width ?? 0), height: Math.round(e?.contentRect.height ?? 0) }));
45
45
  fit.observe(el);
46
46
  return () => {
47
47
  io.disconnect();
@@ -49,7 +49,7 @@ export function useStage() {
49
49
  };
50
50
  }, []);
51
51
  const hold = useMemo(() => ({ onPointerEnter: () => void (held.current = true), onPointerLeave: () => void (held.current = false) }), []);
52
- return { box, seen, width, visible, held, hold };
52
+ return { box, seen, width, height, visible, held, hold };
53
53
  }
54
54
  /**
55
55
  * How many of `beats` are drawn. All of them until `run`; then none, and one
package/dist/workday.d.ts CHANGED
@@ -31,6 +31,7 @@ export type Card =
31
31
  add: number;
32
32
  del: number;
33
33
  state: 'review' | 'passed' | 'merged';
34
+ reviewer?: string;
34
35
  }
35
36
  /** A reply drafted for a person to approve: an email or a support answer. */
36
37
  | {
@@ -38,6 +39,7 @@ export type Card =
38
39
  to: string;
39
40
  body: string;
40
41
  sent?: boolean;
42
+ approver?: string;
41
43
  } | {
42
44
  kind: 'file';
43
45
  name: string;
@@ -58,6 +60,7 @@ export type Card =
58
60
  kind: 'ask';
59
61
  options: string[];
60
62
  picked?: number;
63
+ asks?: string;
61
64
  }
62
65
  /** Design directions side by side, one picked. */
63
66
  | {
@@ -111,6 +114,12 @@ export type Event = Base & ({
111
114
  kind: 'huddle';
112
115
  room: string;
113
116
  who: string[];
117
+ }
118
+ /** A step of an org's mission is done. */
119
+ | {
120
+ kind: 'step';
121
+ org: string;
122
+ n: number;
114
123
  });
115
124
  export type Beat = Event & {
116
125
  wait: number;
@@ -139,6 +148,11 @@ export type Org = {
139
148
  agents: string[];
140
149
  };
141
150
  export declare const ORGS: Org[];
151
+ /** What each organization is working toward this week: a title and its steps, done as the day goes. */
152
+ export declare const MISSIONS: Record<string, {
153
+ title: string;
154
+ steps: string[];
155
+ }>;
142
156
  export declare const orgOf: (room: string) => Org;
143
157
  export declare const channelOf: (room: string) => string;
144
158
  /** A message as the screen draws it. */
@@ -193,7 +207,41 @@ export interface Frame {
193
207
  /** The message whose thread stands beside the channel. */
194
208
  thread: string | null;
195
209
  huddle: Record<string, string[]>;
210
+ /** The steps of each org's mission done so far. */
211
+ steps: Record<string, number[]>;
212
+ /** Work handed from one teammate to another by a mention, newest last. */
213
+ handoffs: Handoff[];
214
+ }
215
+ /** One teammate handing work to another by mentioning them. */
216
+ export interface Handoff {
217
+ from: string;
218
+ to: string;
219
+ room: string;
220
+ time: number;
221
+ text: string;
196
222
  }
197
223
  /** Folds the first `at` events into a frame. */
198
224
  export declare function frame(events: Event[], at: number): Frame;
225
+ /** Something an agent left for a person: a reply to send, a question to answer, a pull request to review, or (supervised) a step to approve. */
226
+ export interface Ask {
227
+ id: string;
228
+ room: string;
229
+ /** The person it waits on. */
230
+ who: string;
231
+ /** What the agent asked for, as a phrase with `{what}` filled from the card. */
232
+ say: string;
233
+ what: string;
234
+ }
235
+ /**
236
+ * What waits on a person in a frame. Always: a draft not yet sent, a question
237
+ * not yet answered, a pull request still under review. Supervised, also every
238
+ * agent's work a person has not answered yet in its room: an agent asks before
239
+ * each tool, connector or site (the app's Manual approval).
240
+ */
241
+ export declare function waiting(f: Frame, supervised: boolean): Ask[];
242
+ /** Each agent's spending limits, as the agent's settings hold them: a weekly cap and the most one task may spend (sample values). */
243
+ export declare const LIMITS: Record<string, {
244
+ week: number;
245
+ task: number;
246
+ }>;
199
247
  export {};
package/dist/workday.js CHANGED
@@ -89,6 +89,24 @@ export const ORGS = [
89
89
  agents: ['sci', 'data', 'dev'],
90
90
  },
91
91
  ];
92
+ /** What each organization is working toward this week: a title and its steps, done as the day goes. */
93
+ export const MISSIONS = {
94
+ acme: {
95
+ title: phrase('Launch on Thursday'),
96
+ steps: [
97
+ phrase('Fix the double charge'),
98
+ phrase('Answer the Safari ticket'),
99
+ phrase('Clear the inbox'),
100
+ phrase('Deck, model and intros'),
101
+ phrase('Sign off the plan cards'),
102
+ phrase('Book the designer interviews'),
103
+ phrase('Publish the launch post'),
104
+ ],
105
+ },
106
+ orbit: { title: phrase('Ship 2.4'), steps: [phrase('Land the retry fix'), phrase('Document how retries back off'), phrase('Audit dependencies'), phrase('Tag the release')] },
107
+ friday: { title: phrase('A recipe app by Sunday'), steps: [phrase('Set up the board'), phrase('Search by ingredient'), phrase('Pick a logo'), phrase('Book game night')] },
108
+ lab: { title: phrase('A first prototype'), steps: [phrase('Boot it'), phrase('Plan a week with it'), phrase('Write up what broke')] },
109
+ };
92
110
  export const orgOf = (room) => ORGS.find((o) => o.id === room.split('/')[0]) ?? ORGS[0];
93
111
  export const channelOf = (room) => room.split('/')[1] ?? 'general';
94
112
  /** Minutes after midnight. */
@@ -155,6 +173,8 @@ const react = (to, mark, n) => ({ kind: 'react', to, mark, n });
155
173
  const reply = (to, who, text) => ({ kind: 'reply', to, who, text });
156
174
  const card = (to, patch) => ({ kind: 'card', to, patch });
157
175
  const thread = (to) => ({ kind: 'thread', to });
176
+ /** A step of an org's mission is done. */
177
+ const step = (org, n) => ({ kind: 'step', org, n });
158
178
  /** A message that arrives in another room while this one is open: it goes unread, and it is the next room's first line. */
159
179
  const elsewhere = (room, who, text, more = {}) => ({ kind: 'say', room, who, text, ...more });
160
180
  /**
@@ -171,9 +191,10 @@ const ORBIT = room('orbit/contributors', hm(9, 4), (r) => [
171
191
  r.typing('dev'),
172
192
  r.say('dev', phrase('Glad it helped. I opened a follow-up so the docs say how retries back off.'), {
173
193
  id: 'followup',
174
- card: { kind: 'pr', repo: 'orbit/orbit', number: 1187, title: phrase('Docs: how retries back off'), add: 42, del: 6, state: 'review' },
194
+ card: { kind: 'pr', repo: 'orbit/orbit', number: 1187, title: phrase('Docs: how retries back off'), add: 42, del: 6, state: 'review', reviewer: 'priya' },
175
195
  }),
176
196
  react('upstream', 'heart', 4),
197
+ step('orbit', 0),
177
198
  elsewhere('friday/side-project', 'omar', phrase("Tonight's build still on?")),
178
199
  ]);
179
200
  /** Friends, in the morning: tonight is on. */
@@ -192,7 +213,7 @@ const ENG = room('acme/eng', hm(9, 12), (r) => [
192
213
  r.typing('dev'),
193
214
  r.say('dev', phrase('Pull request is up. A new test presses Pay twice and expects one charge.'), {
194
215
  id: 'pr',
195
- card: { kind: 'pr', repo: 'acme/web', number: 482, title: phrase('Disable Pay while a charge is pending'), add: 18, del: 3, state: 'review' },
216
+ card: { kind: 'pr', repo: 'acme/web', number: 482, title: phrase('Disable Pay while a charge is pending'), add: 18, del: 3, state: 'review', reviewer: 'theo' },
196
217
  }),
197
218
  thread('pr'),
198
219
  reply('pr', 'theo', phrase('Reviewing. Could the button show a spinner too? A grey button looks broken.')),
@@ -206,6 +227,7 @@ const ENG = room('acme/eng', hm(9, 12), (r) => [
206
227
  r.typing('dev'),
207
228
  card('pr', { state: 'merged' }),
208
229
  r.say('dev', phrase('Merged and deployed. Checkout is live with the fix.')),
230
+ step('acme', 0),
209
231
  r.say('mina', phrase('Pressed Pay four times on purpose. Charged once.'), { id: 'tried' }),
210
232
  react('tried', 'party', 3),
211
233
  r.say('sam', phrase('Pressing Pay twice is no longer a personality trait we support.'), { id: 'trait' }),
@@ -217,7 +239,7 @@ const SUPPORT = room('acme/support', hm(10, 4), (r) => [
217
239
  r.typing('su'),
218
240
  r.say('su', phrase('Drafted a reply.'), {
219
241
  id: 'answer',
220
- card: { kind: 'draft', to: phrase('Ticket #1042'), body: phrase('Sorry about the blank invoices. Safari blocks the download; this link opens them now, and a fix ships today.') },
242
+ card: { kind: 'draft', to: phrase('Ticket #1042'), body: phrase('Sorry about the blank invoices. Safari blocks the download; this link opens them now, and a fix ships today.'), approver: 'nia' },
221
243
  }),
222
244
  r.say('nia', phrase("Warmer first line, please. And let's not blame Safari in writing.")),
223
245
  r.typing('su'),
@@ -232,6 +254,7 @@ const SUPPORT = room('acme/support', hm(10, 4), (r) => [
232
254
  react('links', 'laugh', 3),
233
255
  r.say('su', phrase('The customer wrote back: “That was fast. Thank you.”'), { id: 'thanks' }),
234
256
  react('thanks', 'heart', 5),
257
+ step('acme', 1),
235
258
  elsewhere('acme/inbox', 'opera', phrase('Morning sort is done.'), {
236
259
  id: 'sort',
237
260
  card: {
@@ -243,7 +266,7 @@ const SUPPORT = room('acme/support', hm(10, 4), (r) => [
243
266
  ]);
244
267
  /** Email: the agent triages and drafts, a person approves a batch, a lawyer catches a clause. */
245
268
  const INBOX = room('acme/inbox', hm(10, 41), (r) => [
246
- r.say('opera', phrase('Six replies are drafted in your voice. Approve them as a batch?'), { id: 'batch', card: { kind: 'ask', options: [phrase('Approve all'), phrase('One by one')] } }),
269
+ r.say('opera', phrase('Six replies are drafted in your voice. Approve them as a batch?'), { id: 'batch', card: { kind: 'ask', options: [phrase('Approve all'), phrase('One by one')], asks: 'ada' } }),
247
270
  r.typing('ada'),
248
271
  card('batch', { picked: 0 }),
249
272
  r.say('ada', phrase('Approve all. You know how I write by now.')),
@@ -254,9 +277,10 @@ const INBOX = room('acme/inbox', hm(10, 41), (r) => [
254
277
  react('clause', 'eyes', 2),
255
278
  r.say('ada', phrase('Good catch. Ask for one, nicely.')),
256
279
  r.typing('opera'),
257
- r.say('opera', phrase('Drafted.'), { id: 'renewal', card: { kind: 'draft', to: phrase('The vendor, about our renewal'), body: phrase('Happy to renew. Could we make the term one year, with the option to extend?') } }),
280
+ r.say('opera', phrase('Drafted.'), { id: 'renewal', card: { kind: 'draft', to: phrase('The vendor, about our renewal'), body: phrase('Happy to renew. Could we make the term one year, with the option to extend?'), approver: 'ada' } }),
258
281
  r.say('ada', phrase('Nicely done. Send.')),
259
282
  card('renewal', { sent: true }),
283
+ step('acme', 2),
260
284
  r.say('opera', phrase('Sent. The inbox is at zero, except for the newsletter you keep meaning to read.'), { id: 'zero' }),
261
285
  react('zero', 'laugh', 2),
262
286
  elsewhere('acme/fundraise', 'zoe', phrase('@fin we need a seed deck by Friday.')),
@@ -269,6 +293,7 @@ const FUNDRAISE = room('acme/fundraise', hm(11, 20), (r) => [
269
293
  r.typing('fin'),
270
294
  r.say('fin', phrase('Deck v1 is in Drive.'), { id: 'deck', card: { kind: 'file', name: 'Acme seed deck.pdf', type: 'deck', detail: phrase('12 slides') } }),
271
295
  r.say('fin', phrase('And the model.'), { id: 'model', card: { kind: 'file', name: 'Acme model.xlsx', type: 'sheet', detail: phrase('Three scenarios, sources linked') } }),
296
+ r.say('fin', phrase('@sal the deck is ready for the intros.')),
272
297
  r.say('zoe', phrase('Slide 4 says “synergy”. Remove it with prejudice.')),
273
298
  r.typing('fin'),
274
299
  r.say('fin', phrase('Removed. Slide 4 now says what the product does.'), { id: 'synergy' }),
@@ -291,6 +316,7 @@ const FUNDRAISE = room('acme/fundraise', hm(11, 20), (r) => [
291
316
  r.say('theo', phrase('Prep doc?')),
292
317
  r.typing('fin'),
293
318
  r.say('fin', phrase('In the deck folder: the questions they are likely to ask, with our answers.')),
319
+ step('acme', 3),
294
320
  elsewhere('acme/design', 'sam', phrase('@des the plan cards feel crowded.')),
295
321
  ]);
296
322
  /** A design review: two directions, a pick, a handoff. */
@@ -305,6 +331,7 @@ const DESIGN = room('acme/design', hm(13, 15), (r) => [
305
331
  r.typing('dev'),
306
332
  r.say('dev', phrase('Picked it up. It will be on the preview link in ten minutes.'), { id: 'handoff' }),
307
333
  react('handoff', 'heart', 3),
334
+ step('acme', 4),
308
335
  elsewhere('acme/hiring', 'huma', phrase('Designer role: the shortlist is ready, with a note on each.'), {
309
336
  id: 'shortlist',
310
337
  card: { kind: 'list', title: phrase('Shortlist'), items: [phrase('Product designer, strong systems work'), phrase('Brand designer, moving to product'), phrase('Design engineer, ships in code')] },
@@ -318,6 +345,7 @@ const HIRING = room('acme/hiring', hm(14, 2), (r) => [
318
345
  r.say('mina', phrase('Thank you for respecting weekends.'), { id: 'weekends' }),
319
346
  react('weekends', 'heart', 4),
320
347
  r.say('des', phrase('One screen, two hours, no trick questions.')),
348
+ step('acme', 5),
321
349
  elsewhere('acme/launch', 'mark', phrase('The launch post is drafted.'), { id: 'post', card: { kind: 'file', name: 'launch-post.md', type: 'doc', detail: phrase('Draft') } }),
322
350
  ]);
323
351
  /** The launch: the post cut, translated, the checklist closed, a huddle, live. */
@@ -326,9 +354,10 @@ const LAUNCH = room('acme/launch', hm(15, 30), (r) => [
326
354
  r.typing('mark'),
327
355
  r.say('mark', phrase('Cut to three paragraphs. Paragraph four is now a footnote nobody will read either.'), { id: 'cut' }),
328
356
  react('cut', 'laugh', 5),
357
+ r.say('mark', phrase('@lang can you take it into Japanese and Spanish?')),
329
358
  r.typing('lang'),
330
359
  r.say('lang', phrase('Translated into Japanese and Spanish. The terms match the glossary.')),
331
- r.say('mana', phrase('Everything is done but the docs pass.'), {
360
+ r.say('mana', phrase('Everything is done but the docs pass. @doc it is yours.'), {
332
361
  id: 'checklist',
333
362
  card: { kind: 'list', title: phrase('Launch checklist'), items: [phrase('Launch post'), phrase('Translations'), phrase('Pricing page'), phrase('Docs pass'), phrase('Status page')], done: [0, 1, 2, 4] },
334
363
  }),
@@ -341,6 +370,7 @@ const LAUNCH = room('acme/launch', hm(15, 30), (r) => [
341
370
  r.say('mark', phrase('Posted. It is live.'), { id: 'live' }),
342
371
  react('live', 'rocket', 8),
343
372
  react('live', 'party', 6),
373
+ step('acme', 6),
344
374
  r.huddle(),
345
375
  elsewhere('acme/general', 'vi', phrase("Today's notes are ready."), {
346
376
  id: 'notes',
@@ -368,15 +398,18 @@ const SIDE = room('friday/side-project', hm(19, 10), (r) => [
368
398
  id: 'board',
369
399
  card: { kind: 'list', title: phrase('Board'), items: [phrase('Sign-in'), phrase('Save a recipe'), phrase("Search by what's in the fridge")] },
370
400
  }),
401
+ step('friday', 0),
371
402
  r.say('jun', phrase("I'll take search. @dev pair with me?")),
372
403
  r.typing('dev'),
373
404
  r.say('dev', phrase('Pairing. Search works on ingredients now: “leftover pizza” returns pizza.'), { id: 'pizza' }),
374
405
  card('board', { done: [2] }),
406
+ step('friday', 1),
375
407
  react('pizza', 'laugh', 4),
376
408
  r.say('leo', phrase('Bringing snacks and opinions.')),
377
409
  r.typing('art'),
378
410
  r.say('art', phrase('Logo sketches, in case anyone wants a logo before a product.'), { id: 'logos', card: { kind: 'file', name: 'logo-sketches.png', type: 'image', detail: phrase('Three options') } }),
379
411
  react('logos', 'heart', 5),
412
+ step('friday', 2),
380
413
  elsewhere('friday/game-night', 'omar', phrase('Game night Thursday?')),
381
414
  ]);
382
415
  /** Game night, booked by an agent that is now in charge of scheduling forever. */
@@ -388,6 +421,7 @@ const GAME = room('friday/game-night', hm(19, 42), (r) => [
388
421
  r.typing('vi'),
389
422
  r.say('vi', phrase('Accepted. I will be fair.')),
390
423
  react('forever', 'laugh', 3),
424
+ step('friday', 3),
391
425
  ]);
392
426
  /** Rooms the day does not pass through, played when a reader opens them. */
393
427
  const EXTRA = {
@@ -463,6 +497,8 @@ export function pace(events) {
463
497
  wait = 1100;
464
498
  else if (before.kind === 'react')
465
499
  wait = 1000;
500
+ else if (before.kind === 'step')
501
+ wait = 1200;
466
502
  return { ...e, wait };
467
503
  });
468
504
  }
@@ -480,6 +516,8 @@ export const HOME = { acme: 'acme/eng', orbit: 'orbit/contributors', friday: 'fr
480
516
  export const STILL = MORNING.length + ORBIT.length + PLANS.length + ENG.length;
481
517
  /** How long the day plays before it starts again, in milliseconds (`REST` held at the end not counted). */
482
518
  export const LENGTH = DAY.reduce((n, b) => n + b.wait, 0);
519
+ /** The handoffs a frame keeps: the newest. */
520
+ const HANDOFFS = 8;
483
521
  /** How many messages a room keeps on screen: the oldest leave the top. */
484
522
  const KEEP = 14;
485
523
  /** Folds the first `at` events into a frame. */
@@ -494,6 +532,8 @@ export function frame(events, at) {
494
532
  };
495
533
  const unread = { ...UNREAD };
496
534
  const huddle = {};
535
+ const steps = {};
536
+ const handoffs = [];
497
537
  let view = events.find((e) => e.kind === 'open')?.room ?? 'acme/eng';
498
538
  let clock = hm(9, 0);
499
539
  let thread = null;
@@ -514,6 +554,9 @@ export function frame(events, at) {
514
554
  const m = { id: e.id ?? `${e.room}@${i}`, who: e.who, text: e.text, time: clock, card: e.card, reactions: [], replies: [] };
515
555
  seat(e.room).push(m);
516
556
  where.set(m.id, m);
557
+ for (const [, to] of e.text.matchAll(/@([a-z]+)/g))
558
+ if (to !== e.who && (to in AGENTS || to in PEOPLE))
559
+ handoffs.push({ from: e.who, to, room: e.room, time: clock, text: e.text });
517
560
  if (e.room !== view)
518
561
  unread[e.room] = (unread[e.room] ?? 0) + 1;
519
562
  break;
@@ -552,10 +595,48 @@ export function frame(events, at) {
552
595
  case 'huddle':
553
596
  huddle[e.room] = e.who;
554
597
  break;
598
+ case 'step':
599
+ steps[e.org] = [...new Set([...(steps[e.org] ?? []), e.n])];
600
+ break;
555
601
  }
556
602
  });
557
603
  seat(view);
558
604
  for (const id of Object.keys(rooms))
559
605
  rooms[id] = rooms[id].slice(-KEEP);
560
- return { room: view, rooms, unread, typing, thread, huddle };
606
+ return { room: view, rooms, unread, typing, thread, huddle, steps, handoffs: handoffs.slice(-HANDOFFS) };
607
+ }
608
+ /**
609
+ * What waits on a person in a frame. Always: a draft not yet sent, a question
610
+ * not yet answered, a pull request still under review. Supervised, also every
611
+ * agent's work a person has not answered yet in its room: an agent asks before
612
+ * each tool, connector or site (the app's Manual approval).
613
+ */
614
+ export function waiting(f, supervised) {
615
+ const out = [];
616
+ for (const [room, list] of Object.entries(f.rooms)) {
617
+ list.forEach((m, i) => {
618
+ const c = m.card;
619
+ if (c?.kind === 'draft' && !c.sent)
620
+ out.push({ id: m.id, room, who: c.approver ?? 'ada', say: phrase('Send the reply to {what}'), what: c.to });
621
+ else if (c?.kind === 'ask' && c.picked === undefined)
622
+ out.push({ id: m.id, room, who: c.asks ?? 'ada', say: phrase('Answer: {what}'), what: m.text });
623
+ else if (c?.kind === 'pr' && c.state === 'review')
624
+ out.push({ id: m.id, room, who: c.reviewer ?? 'theo', say: phrase('Review {what}'), what: `#${c.number}` });
625
+ else if (supervised && c && agent(m.who) && !list.slice(i + 1).some((n) => !agent(n.who))) {
626
+ const owner = orgOf(room).people[0];
627
+ out.push({ id: m.id, room, who: owner, say: phrase('Approve {what}'), what: c.kind === 'file' ? c.name : c.kind === 'meeting' || c.kind === 'list' ? c.title : m.text });
628
+ }
629
+ });
630
+ }
631
+ return out;
561
632
  }
633
+ /** Each agent's spending limits, as the agent's settings hold them: a weekly cap and the most one task may spend (sample values). */
634
+ export const LIMITS = {
635
+ dev: { week: 60, task: 8 },
636
+ su: { week: 20, task: 2 },
637
+ opera: { week: 20, task: 2 },
638
+ fin: { week: 30, task: 5 },
639
+ sal: { week: 25, task: 3 },
640
+ des: { week: 40, task: 6 },
641
+ mark: { week: 20, task: 3 },
642
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hanzo/app",
3
- "version": "0.2.53",
3
+ "version": "0.2.55",
4
4
  "description": "Hanzo's app: the shell and its apps (Home, Chat, Inbox, Contacts, Meet, Calendar, Drive, Board, Work, Bots), once, for every Hanzo surface.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",