@hanzo/app 0.2.50 → 0.2.51
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/memoji/art.svg +22 -0
- package/assets/memoji/cyber.svg +22 -0
- package/assets/memoji/data.svg +22 -0
- package/assets/memoji/des.svg +22 -0
- package/assets/memoji/dev.svg +22 -0
- package/assets/memoji/doc.svg +22 -0
- package/assets/memoji/edu.svg +22 -0
- package/assets/memoji/fin.svg +22 -0
- package/assets/memoji/gov.svg +22 -0
- package/assets/memoji/huma.svg +22 -0
- package/assets/memoji/lang.svg +22 -0
- package/assets/memoji/law.svg +22 -0
- package/assets/memoji/mana.svg +22 -0
- package/assets/memoji/mark.svg +22 -0
- package/assets/memoji/mu.svg +22 -0
- package/assets/memoji/opera.svg +22 -0
- package/assets/memoji/rev.svg +22 -0
- package/assets/memoji/sal.svg +22 -0
- package/assets/memoji/sci.svg +22 -0
- package/assets/memoji/su.svg +22 -0
- package/assets/memoji/vi.svg +22 -0
- package/dist/Chat.js +1 -1
- package/dist/TeamPreview.d.ts +3 -3
- package/dist/TeamPreview.js +230 -167
- package/dist/bots/Bots.js +1 -1
- package/dist/workday.d.ts +199 -0
- package/dist/workday.js +561 -0
- package/package.json +1 -1
package/dist/workday.js
ADDED
|
@@ -0,0 +1,561 @@
|
|
|
1
|
+
import { phrase } from '@hanzo/i18n';
|
|
2
|
+
/** People wear their initials; agents wear the crew's memoji (`/memoji/<id>.svg`). */
|
|
3
|
+
export const PEOPLE = {
|
|
4
|
+
zoe: { name: 'Zoe Iyer' },
|
|
5
|
+
ada: { name: 'Ada Park' },
|
|
6
|
+
sam: { name: 'Sam Ortiz' },
|
|
7
|
+
theo: { name: 'Theo Brandt' },
|
|
8
|
+
mina: { name: 'Mina Chen' },
|
|
9
|
+
nia: { name: 'Nia Okafor' },
|
|
10
|
+
leo: { name: 'Leo Varga' },
|
|
11
|
+
omar: { name: 'Omar Haddad' },
|
|
12
|
+
jun: { name: 'Jun Mori' },
|
|
13
|
+
priya: { name: 'Priya Nair' },
|
|
14
|
+
};
|
|
15
|
+
export const AGENTS = {
|
|
16
|
+
vi: { name: 'Vi', role: phrase('Visionary') },
|
|
17
|
+
fin: { name: 'Fin', role: phrase('Finance') },
|
|
18
|
+
dev: { name: 'Dev', role: phrase('Software') },
|
|
19
|
+
mark: { name: 'Mark', role: phrase('Marketing') },
|
|
20
|
+
opera: { name: 'Opera', role: phrase('Operations') },
|
|
21
|
+
des: { name: 'Des', role: phrase('Designer') },
|
|
22
|
+
sal: { name: 'Sal', role: phrase('Sales') },
|
|
23
|
+
su: { name: 'Su', role: phrase('Support') },
|
|
24
|
+
cyber: { name: 'Cyber', role: phrase('Security') },
|
|
25
|
+
sci: { name: 'Sci', role: phrase('Research') },
|
|
26
|
+
huma: { name: 'Huma', role: phrase('People') },
|
|
27
|
+
mana: { name: 'Mana', role: phrase('Product') },
|
|
28
|
+
data: { name: 'Data', role: phrase('Analytics') },
|
|
29
|
+
lang: { name: 'Lang', role: phrase('Translation') },
|
|
30
|
+
art: { name: 'Art', role: phrase('Art & video') },
|
|
31
|
+
law: { name: 'Law', role: phrase('Legal') },
|
|
32
|
+
mu: { name: 'Mu', role: phrase('Music') },
|
|
33
|
+
doc: { name: 'Doc', role: phrase('Docs') },
|
|
34
|
+
};
|
|
35
|
+
export const agent = (id) => id in AGENTS;
|
|
36
|
+
export const who = (id) => AGENTS[id] ?? PEOPLE[id] ?? { name: id };
|
|
37
|
+
export const ORGS = [
|
|
38
|
+
{
|
|
39
|
+
id: 'acme',
|
|
40
|
+
name: 'Acme',
|
|
41
|
+
mark: 'A',
|
|
42
|
+
channels: [
|
|
43
|
+
{ id: 'general', topic: phrase('Everything Acme') },
|
|
44
|
+
{ id: 'launch', topic: phrase('Shipping Thursday') },
|
|
45
|
+
{ id: 'eng', topic: phrase('Code, reviews and deploys') },
|
|
46
|
+
{ id: 'support', topic: phrase('Customers first') },
|
|
47
|
+
{ id: 'inbox', topic: phrase('Email, sorted and drafted') },
|
|
48
|
+
{ id: 'fundraise', topic: phrase('The seed round') },
|
|
49
|
+
{ id: 'design', topic: phrase('Screens, mocks and taste') },
|
|
50
|
+
{ id: 'hiring', topic: phrase('Who joins next') },
|
|
51
|
+
{ id: 'random', topic: phrase('Everything else') },
|
|
52
|
+
],
|
|
53
|
+
people: ['zoe', 'theo', 'mina', 'sam', 'nia'],
|
|
54
|
+
agents: ['dev', 'su', 'opera', 'fin', 'sal', 'des', 'huma', 'mark', 'lang', 'law', 'doc', 'mana', 'vi'],
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
id: 'friday',
|
|
58
|
+
name: 'Friday Club',
|
|
59
|
+
mark: 'F',
|
|
60
|
+
channels: [
|
|
61
|
+
{ id: 'side-project', topic: phrase('A recipe app, for fun') },
|
|
62
|
+
{ id: 'game-night', topic: phrase('Who is in this week') },
|
|
63
|
+
{ id: 'ideas', topic: phrase('Half-baked, on purpose') },
|
|
64
|
+
],
|
|
65
|
+
people: ['mina', 'leo', 'omar', 'jun'],
|
|
66
|
+
agents: ['mana', 'dev', 'art', 'vi', 'mu'],
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
id: 'orbit',
|
|
70
|
+
name: 'Orbit',
|
|
71
|
+
mark: 'O',
|
|
72
|
+
channels: [
|
|
73
|
+
{ id: 'general', topic: phrase('An open-source project, maintained together') },
|
|
74
|
+
{ id: 'contributors', topic: phrase('Pull requests and reviews') },
|
|
75
|
+
{ id: 'releases', topic: phrase('What ships, and when') },
|
|
76
|
+
],
|
|
77
|
+
people: ['priya', 'theo', 'jun'],
|
|
78
|
+
agents: ['dev', 'doc', 'cyber'],
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
id: 'lab',
|
|
82
|
+
name: 'Night Lab',
|
|
83
|
+
mark: 'N',
|
|
84
|
+
channels: [
|
|
85
|
+
{ id: 'general', topic: phrase('Late ideas, early prototypes') },
|
|
86
|
+
{ id: 'ideas', topic: phrase('Filed under someday') },
|
|
87
|
+
],
|
|
88
|
+
people: ['theo', 'priya'],
|
|
89
|
+
agents: ['sci', 'data', 'dev'],
|
|
90
|
+
},
|
|
91
|
+
];
|
|
92
|
+
export const orgOf = (room) => ORGS.find((o) => o.id === room.split('/')[0]) ?? ORGS[0];
|
|
93
|
+
export const channelOf = (room) => room.split('/')[1] ?? 'general';
|
|
94
|
+
/** Minutes after midnight. */
|
|
95
|
+
const hm = (h, m) => h * 60 + m;
|
|
96
|
+
/** What each room already holds when the day begins, so none opens empty. */
|
|
97
|
+
const SEED = {
|
|
98
|
+
'acme/general': [
|
|
99
|
+
{ who: 'zoe', text: phrase('Welcome to Acme. Agents are teammates here: mention one to hand it work.'), time: hm(8, 30) },
|
|
100
|
+
{ who: 'vi', text: phrase("Yesterday's notes are pinned: what shipped, what is waiting on whom."), time: hm(8, 40) },
|
|
101
|
+
{ who: 'sam', text: phrase('The coffee machine is fixed. Dev did not fix it, to be clear.'), time: hm(8, 52) },
|
|
102
|
+
],
|
|
103
|
+
'acme/eng': [
|
|
104
|
+
{ who: 'theo', text: phrase('Morning. Main is green.'), time: hm(8, 58) },
|
|
105
|
+
{ who: 'dev', text: phrase('Overnight tests passed. The two flaky ones are steady now; they were racing the clock.'), time: hm(9, 1) },
|
|
106
|
+
],
|
|
107
|
+
'acme/support': [{ who: 'su', text: phrase('Overnight questions are answered, each with a link to the page in the docs.'), time: hm(8, 40) }],
|
|
108
|
+
'acme/inbox': [{ who: 'opera', text: phrase('Every reply that needed you went out after your ok.'), time: hm(8, 45) }],
|
|
109
|
+
'acme/fundraise': [{ who: 'zoe', text: phrase('The investor list lives in the pinned doc.'), time: hm(8, 50) }],
|
|
110
|
+
'acme/design': [{ who: 'des', text: phrase('New icons are in the library.'), time: hm(9, 5) }],
|
|
111
|
+
'acme/hiring': [{ who: 'huma', text: phrase('The interview loop is in the handbook.'), time: hm(9, 10) }],
|
|
112
|
+
'acme/launch': [{ who: 'mana', text: phrase('Launch is Thursday. The checklist is pinned.'), time: hm(9, 15) }],
|
|
113
|
+
'acme/random': [
|
|
114
|
+
{ who: 'sam', text: phrase('Who left a croissant on the printer?'), time: hm(9, 20) },
|
|
115
|
+
{ who: 'vi', text: phrase('It was there before me.'), time: hm(9, 21) },
|
|
116
|
+
],
|
|
117
|
+
'friday/side-project': [
|
|
118
|
+
{ who: 'leo', text: phrase("Last week's build is still running. Somehow."), time: hm(8, 30) },
|
|
119
|
+
{ who: 'jun', text: phrase('I named the database after my cat. It is too late to change it.'), time: hm(8, 41) },
|
|
120
|
+
],
|
|
121
|
+
'friday/game-night': [{ who: 'jun', text: phrase('Rematch pending.'), time: hm(8, 40) }],
|
|
122
|
+
'friday/ideas': [{ who: 'omar', text: phrase('A playlist that matches the recipe.'), time: hm(8, 45) }],
|
|
123
|
+
'orbit/general': [{ who: 'priya', text: phrase('Welcome, new contributors. Start with the issues marked good first.'), time: hm(8, 10) }],
|
|
124
|
+
'orbit/contributors': [
|
|
125
|
+
{ who: 'jun', text: phrase('Reviews this week: two from Acme, one from us.'), time: hm(8, 20) },
|
|
126
|
+
{ who: 'cyber', text: phrase('Every open pull request passed the dependency check overnight.'), time: hm(8, 35) },
|
|
127
|
+
],
|
|
128
|
+
'orbit/releases': [{ who: 'doc', text: phrase('The changelog for 2.4 is drafted.'), time: hm(8, 25) }],
|
|
129
|
+
'lab/general': [{ who: 'priya', text: phrase('The prototype boots. That is all it does.'), time: hm(21, 0) }],
|
|
130
|
+
'lab/ideas': [{ who: 'theo', text: phrase('A bot that waters the plants.'), time: hm(21, 5) }],
|
|
131
|
+
};
|
|
132
|
+
/** Rooms with news before the day starts: their channel is bold, their org's tile marked. */
|
|
133
|
+
export const UNREAD = { 'acme/random': 2, 'orbit/releases': 3, 'friday/ideas': 1, 'lab/ideas': 1 };
|
|
134
|
+
/** The events of one room's scene, in the room's own words. */
|
|
135
|
+
function room(id, time, build) {
|
|
136
|
+
return [{ kind: 'open', room: id, time }, ...build(new Room(id))];
|
|
137
|
+
}
|
|
138
|
+
/** Writes a room's events without naming the room each time. */
|
|
139
|
+
class Room {
|
|
140
|
+
id;
|
|
141
|
+
constructor(id) {
|
|
142
|
+
this.id = id;
|
|
143
|
+
}
|
|
144
|
+
say(who, text, more = {}) {
|
|
145
|
+
return { kind: 'say', room: this.id, who, text, ...more };
|
|
146
|
+
}
|
|
147
|
+
typing(who) {
|
|
148
|
+
return { kind: 'typing', room: this.id, who };
|
|
149
|
+
}
|
|
150
|
+
huddle(...who) {
|
|
151
|
+
return { kind: 'huddle', room: this.id, who };
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
const react = (to, mark, n) => ({ kind: 'react', to, mark, n });
|
|
155
|
+
const reply = (to, who, text) => ({ kind: 'reply', to, who, text });
|
|
156
|
+
const card = (to, patch) => ({ kind: 'card', to, patch });
|
|
157
|
+
const thread = (to) => ({ kind: 'thread', to });
|
|
158
|
+
/** 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
|
+
const elsewhere = (room, who, text, more = {}) => ({ kind: 'say', room, who, text, ...more });
|
|
160
|
+
/**
|
|
161
|
+
* The morning, across organizations: Acme's #general, a thank-you from the
|
|
162
|
+
* open-source project that took Acme's fix, friends planning tonight's build,
|
|
163
|
+
* and back to Acme, where #eng has news. Three switches in under thirty seconds.
|
|
164
|
+
*/
|
|
165
|
+
const MORNING = room('acme/general', hm(9, 2), (r) => [
|
|
166
|
+
r.say('zoe', phrase("Morning. Launch is Thursday, and Orbit's maintainers are helping us test it.")),
|
|
167
|
+
elsewhere('orbit/contributors', 'priya', phrase('@dev your retry fix from Acme landed upstream. Thank you.'), { id: 'upstream' }),
|
|
168
|
+
]);
|
|
169
|
+
/** Orbit: people from different teams, and an agent that works for more than one. */
|
|
170
|
+
const ORBIT = room('orbit/contributors', hm(9, 4), (r) => [
|
|
171
|
+
r.typing('dev'),
|
|
172
|
+
r.say('dev', phrase('Glad it helped. I opened a follow-up so the docs say how retries back off.'), {
|
|
173
|
+
id: 'followup',
|
|
174
|
+
card: { kind: 'pr', repo: 'orbit/orbit', number: 1187, title: phrase('Docs: how retries back off'), add: 42, del: 6, state: 'review' },
|
|
175
|
+
}),
|
|
176
|
+
react('upstream', 'heart', 4),
|
|
177
|
+
elsewhere('friday/side-project', 'omar', phrase("Tonight's build still on?")),
|
|
178
|
+
]);
|
|
179
|
+
/** Friends, in the morning: tonight is on. */
|
|
180
|
+
const PLANS = room('friday/side-project', hm(9, 6), (r) => [
|
|
181
|
+
r.say('leo', phrase('On. @mu a playlist for it?')),
|
|
182
|
+
elsewhere('acme/eng', 'theo', phrase('Heads up: checkout looks odd on main.')),
|
|
183
|
+
]);
|
|
184
|
+
/** Coding together: a bug report, a pull request, a review, the checks, the merge. */
|
|
185
|
+
const ENG = room('acme/eng', hm(9, 12), (r) => [
|
|
186
|
+
r.say('mina', phrase('Checkout charges twice if you press Pay twice. Steps are in the thread.'), { id: 'bug' }),
|
|
187
|
+
reply('bug', 'mina', phrase('Card form, press Pay, press Pay again before it answers. Two charges.')),
|
|
188
|
+
react('bug', 'eyes', 2),
|
|
189
|
+
r.say('sam', phrase('@dev can you take this one?')),
|
|
190
|
+
r.typing('dev'),
|
|
191
|
+
r.say('dev', phrase('On it. The Pay button stays live until the charge answers, so a second press is a second charge.')),
|
|
192
|
+
r.typing('dev'),
|
|
193
|
+
r.say('dev', phrase('Pull request is up. A new test presses Pay twice and expects one charge.'), {
|
|
194
|
+
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' },
|
|
196
|
+
}),
|
|
197
|
+
thread('pr'),
|
|
198
|
+
reply('pr', 'theo', phrase('Reviewing. Could the button show a spinner too? A grey button looks broken.')),
|
|
199
|
+
r.typing('dev'),
|
|
200
|
+
reply('pr', 'dev', phrase('Added a spinner, and the button now says Paying.')),
|
|
201
|
+
card('pr', { state: 'passed' }),
|
|
202
|
+
reply('pr', 'theo', phrase('Approved.')),
|
|
203
|
+
thread(null),
|
|
204
|
+
elsewhere('friday/side-project', 'mu', phrase('Playlist is ready: forty minutes, no lyrics, nothing that sounds like a deadline.')),
|
|
205
|
+
react('pr', 'rocket', 3),
|
|
206
|
+
r.typing('dev'),
|
|
207
|
+
card('pr', { state: 'merged' }),
|
|
208
|
+
r.say('dev', phrase('Merged and deployed. Checkout is live with the fix.')),
|
|
209
|
+
r.say('mina', phrase('Pressed Pay four times on purpose. Charged once.'), { id: 'tried' }),
|
|
210
|
+
react('tried', 'party', 3),
|
|
211
|
+
r.say('sam', phrase('Pressing Pay twice is no longer a personality trait we support.'), { id: 'trait' }),
|
|
212
|
+
react('trait', 'laugh', 4),
|
|
213
|
+
elsewhere('acme/support', 'su', phrase('New ticket: invoices download as blank PDFs in Safari.')),
|
|
214
|
+
]);
|
|
215
|
+
/** Support together: an agent drafts, a person makes it warmer, it is sent, the cause is fixed. */
|
|
216
|
+
const SUPPORT = room('acme/support', hm(10, 4), (r) => [
|
|
217
|
+
r.typing('su'),
|
|
218
|
+
r.say('su', phrase('Drafted a reply.'), {
|
|
219
|
+
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.') },
|
|
221
|
+
}),
|
|
222
|
+
r.say('nia', phrase("Warmer first line, please. And let's not blame Safari in writing.")),
|
|
223
|
+
r.typing('su'),
|
|
224
|
+
card('answer', { body: phrase('Thanks for telling us, and sorry for the blank invoices. This link opens them now, and a fix ships today.') }),
|
|
225
|
+
r.say('su', phrase('Updated.')),
|
|
226
|
+
r.say('nia', phrase('Perfect. Send it.')),
|
|
227
|
+
card('answer', { sent: true }),
|
|
228
|
+
react('answer', 'check', 1),
|
|
229
|
+
r.say('su', phrase('Sent. @dev the download link expires before Safari opens it.')),
|
|
230
|
+
r.typing('dev'),
|
|
231
|
+
r.say('dev', phrase('Found it. Links last five minutes now instead of five seconds. The fix is in #483.'), { id: 'links' }),
|
|
232
|
+
react('links', 'laugh', 3),
|
|
233
|
+
r.say('su', phrase('The customer wrote back: “That was fast. Thank you.”'), { id: 'thanks' }),
|
|
234
|
+
react('thanks', 'heart', 5),
|
|
235
|
+
elsewhere('acme/inbox', 'opera', phrase('Morning sort is done.'), {
|
|
236
|
+
id: 'sort',
|
|
237
|
+
card: {
|
|
238
|
+
kind: 'list',
|
|
239
|
+
title: phrase('Morning sort'),
|
|
240
|
+
items: [phrase('Needs you: a partnership intro'), phrase('Needs you: a press question'), phrase('Needs you: a contract renewal'), phrase('Drafted: six replies in your voice'), phrase('Archived: newsletters and receipts')],
|
|
241
|
+
},
|
|
242
|
+
}),
|
|
243
|
+
]);
|
|
244
|
+
/** Email: the agent triages and drafts, a person approves a batch, a lawyer catches a clause. */
|
|
245
|
+
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')] } }),
|
|
247
|
+
r.typing('ada'),
|
|
248
|
+
card('batch', { picked: 0 }),
|
|
249
|
+
r.say('ada', phrase('Approve all. You know how I write by now.')),
|
|
250
|
+
r.typing('opera'),
|
|
251
|
+
r.say('opera', phrase("Sent all six. The renewal needs a lawyer's eye, so I asked @law.")),
|
|
252
|
+
r.typing('law'),
|
|
253
|
+
r.say('law', phrase('Read it. It renews itself for three years. I would ask for one.'), { id: 'clause' }),
|
|
254
|
+
react('clause', 'eyes', 2),
|
|
255
|
+
r.say('ada', phrase('Good catch. Ask for one, nicely.')),
|
|
256
|
+
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?') } }),
|
|
258
|
+
r.say('ada', phrase('Nicely done. Send.')),
|
|
259
|
+
card('renewal', { sent: true }),
|
|
260
|
+
r.say('opera', phrase('Sent. The inbox is at zero, except for the newsletter you keep meaning to read.'), { id: 'zero' }),
|
|
261
|
+
react('zero', 'laugh', 2),
|
|
262
|
+
elsewhere('acme/fundraise', 'zoe', phrase('@fin we need a seed deck by Friday.')),
|
|
263
|
+
]);
|
|
264
|
+
/** Fundraising: the deck and the model, the intros, a meeting booked. */
|
|
265
|
+
const FUNDRAISE = room('acme/fundraise', hm(11, 20), (r) => [
|
|
266
|
+
r.typing('fin'),
|
|
267
|
+
r.say('fin', phrase('On it: a deck, and a model with three scenarios where every number links to its source.')),
|
|
268
|
+
r.say('zoe', phrase("No hockey sticks we can't explain.")),
|
|
269
|
+
r.typing('fin'),
|
|
270
|
+
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
|
+
r.say('fin', phrase('And the model.'), { id: 'model', card: { kind: 'file', name: 'Acme model.xlsx', type: 'sheet', detail: phrase('Three scenarios, sources linked') } }),
|
|
272
|
+
r.say('zoe', phrase('Slide 4 says “synergy”. Remove it with prejudice.')),
|
|
273
|
+
r.typing('fin'),
|
|
274
|
+
r.say('fin', phrase('Removed. Slide 4 now says what the product does.'), { id: 'synergy' }),
|
|
275
|
+
react('synergy', 'laugh', 4),
|
|
276
|
+
r.typing('sal'),
|
|
277
|
+
r.say('sal', phrase('I found four investors who back developer tools. The intros are drafted in your voice.'), {
|
|
278
|
+
id: 'intros',
|
|
279
|
+
card: {
|
|
280
|
+
kind: 'list',
|
|
281
|
+
title: phrase('Intros'),
|
|
282
|
+
items: [phrase('A seed fund that backs developer tools'), phrase('An angel who built a developer tools company'), phrase('A partner who wrote about agents last week'), phrase('A fund Theo knows from his last company')],
|
|
283
|
+
},
|
|
284
|
+
}),
|
|
285
|
+
r.say('zoe', phrase('Send all four.')),
|
|
286
|
+
card('intros', { done: [0, 1, 2, 3] }),
|
|
287
|
+
r.say('sal', phrase('Sent.')),
|
|
288
|
+
r.typing('sal'),
|
|
289
|
+
r.say('sal', phrase('One replied already. Thursday at 2 works for them.'), { id: 'meeting', card: { kind: 'meeting', title: phrase('Acme and a seed fund'), when: phrase('Thursday, 2:00 PM') } }),
|
|
290
|
+
react('meeting', 'flame', 5),
|
|
291
|
+
r.say('theo', phrase('Prep doc?')),
|
|
292
|
+
r.typing('fin'),
|
|
293
|
+
r.say('fin', phrase('In the deck folder: the questions they are likely to ask, with our answers.')),
|
|
294
|
+
elsewhere('acme/design', 'sam', phrase('@des the plan cards feel crowded.')),
|
|
295
|
+
]);
|
|
296
|
+
/** A design review: two directions, a pick, a handoff. */
|
|
297
|
+
const DESIGN = room('acme/design', hm(13, 15), (r) => [
|
|
298
|
+
r.typing('des'),
|
|
299
|
+
r.say('des', phrase('Two directions. A keeps every feature; B keeps the five people compare.'), { id: 'options', card: { kind: 'options', file: 'plan-cards.fig', options: ['A', 'B'] } }),
|
|
300
|
+
r.say('ada', phrase('B. Fewer words, same truth.')),
|
|
301
|
+
r.say('sam', phrase('B, and the prices on one baseline.')),
|
|
302
|
+
card('options', { picked: 1 }),
|
|
303
|
+
r.typing('des'),
|
|
304
|
+
r.say('des', phrase('B it is, prices aligned. @dev the handoff is in the file.')),
|
|
305
|
+
r.typing('dev'),
|
|
306
|
+
r.say('dev', phrase('Picked it up. It will be on the preview link in ten minutes.'), { id: 'handoff' }),
|
|
307
|
+
react('handoff', 'heart', 3),
|
|
308
|
+
elsewhere('acme/hiring', 'huma', phrase('Designer role: the shortlist is ready, with a note on each.'), {
|
|
309
|
+
id: 'shortlist',
|
|
310
|
+
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')] },
|
|
311
|
+
}),
|
|
312
|
+
]);
|
|
313
|
+
/** Hiring: a shortlist, interviews booked, an exercise that respects weekends. */
|
|
314
|
+
const HIRING = room('acme/hiring', hm(14, 2), (r) => [
|
|
315
|
+
r.say('mina', phrase("Let's talk to all three.")),
|
|
316
|
+
r.typing('huma'),
|
|
317
|
+
r.say('huma', phrase('Booked for Tuesday and Wednesday. Des wrote the exercise: two hours, not a weekend.')),
|
|
318
|
+
r.say('mina', phrase('Thank you for respecting weekends.'), { id: 'weekends' }),
|
|
319
|
+
react('weekends', 'heart', 4),
|
|
320
|
+
r.say('des', phrase('One screen, two hours, no trick questions.')),
|
|
321
|
+
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
|
+
]);
|
|
323
|
+
/** The launch: the post cut, translated, the checklist closed, a huddle, live. */
|
|
324
|
+
const LAUNCH = room('acme/launch', hm(15, 30), (r) => [
|
|
325
|
+
r.say('zoe', phrase('Shorter, please. Nobody reads paragraph four.')),
|
|
326
|
+
r.typing('mark'),
|
|
327
|
+
r.say('mark', phrase('Cut to three paragraphs. Paragraph four is now a footnote nobody will read either.'), { id: 'cut' }),
|
|
328
|
+
react('cut', 'laugh', 5),
|
|
329
|
+
r.typing('lang'),
|
|
330
|
+
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.'), {
|
|
332
|
+
id: 'checklist',
|
|
333
|
+
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
|
+
}),
|
|
335
|
+
r.typing('doc'),
|
|
336
|
+
r.say('doc', phrase('Docs pass is done. The quickstart links the new pages.')),
|
|
337
|
+
card('checklist', { done: [0, 1, 2, 3, 4] }),
|
|
338
|
+
r.huddle('zoe', 'ada', 'sam'),
|
|
339
|
+
r.say('ada', phrase('Ship it.')),
|
|
340
|
+
r.typing('mark'),
|
|
341
|
+
r.say('mark', phrase('Posted. It is live.'), { id: 'live' }),
|
|
342
|
+
react('live', 'rocket', 8),
|
|
343
|
+
react('live', 'party', 6),
|
|
344
|
+
r.huddle(),
|
|
345
|
+
elsewhere('acme/general', 'vi', phrase("Today's notes are ready."), {
|
|
346
|
+
id: 'notes',
|
|
347
|
+
card: {
|
|
348
|
+
kind: 'list',
|
|
349
|
+
title: phrase('Today'),
|
|
350
|
+
items: [phrase('Double charge fixed and shipped'), phrase('A customer answered, then thanked us'), phrase('Inbox at zero'), phrase('A deck, a model and four intros'), phrase('Designer interviews booked'), phrase('Launched')],
|
|
351
|
+
done: [0, 1, 2, 3, 4, 5],
|
|
352
|
+
},
|
|
353
|
+
}),
|
|
354
|
+
]);
|
|
355
|
+
/** The day closes in #general. */
|
|
356
|
+
const GENERAL = room('acme/general', hm(17, 50), (r) => [
|
|
357
|
+
r.say('zoe', phrase('And nobody worked the weekend.')),
|
|
358
|
+
r.say('vi', phrase("Tomorrow's plan is on the board. Good evening, everyone."), { id: 'evening' }),
|
|
359
|
+
react('notes', 'heart', 9),
|
|
360
|
+
react('evening', 'thumbs', 5),
|
|
361
|
+
]);
|
|
362
|
+
/** Friends after work: a recipe app, a board, pairing, a logo before a product. */
|
|
363
|
+
const SIDE = room('friday/side-project', hm(19, 10), (r) => [
|
|
364
|
+
r.say('mina', phrase('Recipe app tonight?')),
|
|
365
|
+
r.say('omar', phrase('In. @mana set up a board?')),
|
|
366
|
+
r.typing('mana'),
|
|
367
|
+
r.say('mana', phrase('Board is ready: a card each.'), {
|
|
368
|
+
id: 'board',
|
|
369
|
+
card: { kind: 'list', title: phrase('Board'), items: [phrase('Sign-in'), phrase('Save a recipe'), phrase("Search by what's in the fridge")] },
|
|
370
|
+
}),
|
|
371
|
+
r.say('jun', phrase("I'll take search. @dev pair with me?")),
|
|
372
|
+
r.typing('dev'),
|
|
373
|
+
r.say('dev', phrase('Pairing. Search works on ingredients now: “leftover pizza” returns pizza.'), { id: 'pizza' }),
|
|
374
|
+
card('board', { done: [2] }),
|
|
375
|
+
react('pizza', 'laugh', 4),
|
|
376
|
+
r.say('leo', phrase('Bringing snacks and opinions.')),
|
|
377
|
+
r.typing('art'),
|
|
378
|
+
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
|
+
react('logos', 'heart', 5),
|
|
380
|
+
elsewhere('friday/game-night', 'omar', phrase('Game night Thursday?')),
|
|
381
|
+
]);
|
|
382
|
+
/** Game night, booked by an agent that is now in charge of scheduling forever. */
|
|
383
|
+
const GAME = room('friday/game-night', hm(19, 42), (r) => [
|
|
384
|
+
r.say('mina', phrase('Yes. @vi can you find a time that works for everyone?')),
|
|
385
|
+
r.typing('vi'),
|
|
386
|
+
r.say('vi', phrase('Thursday at 8 works for all four of you. It is on your calendars.'), { id: 'slot', card: { kind: 'meeting', title: phrase('Game night'), when: phrase('Thursday, 8:00 PM') } }),
|
|
387
|
+
r.say('jun', phrase('Vi is now in charge of all scheduling, forever.'), { id: 'forever' }),
|
|
388
|
+
r.typing('vi'),
|
|
389
|
+
r.say('vi', phrase('Accepted. I will be fair.')),
|
|
390
|
+
react('forever', 'laugh', 3),
|
|
391
|
+
]);
|
|
392
|
+
/** Rooms the day does not pass through, played when a reader opens them. */
|
|
393
|
+
const EXTRA = {
|
|
394
|
+
'acme/random': room('acme/random', hm(12, 30), (r) => [
|
|
395
|
+
r.say('theo', phrase('Lunch?')),
|
|
396
|
+
r.say('vi', phrase('The noodle place is quiet until 12:45. I booked a table for five.')),
|
|
397
|
+
r.say('theo', phrase('I said lunch, not a plan.'), { id: 'lunch' }),
|
|
398
|
+
react('lunch', 'laugh', 3),
|
|
399
|
+
]),
|
|
400
|
+
'friday/ideas': room('friday/ideas', hm(20, 5), (r) => [
|
|
401
|
+
r.say('leo', phrase('@mu a song for when the timer rings?')),
|
|
402
|
+
r.typing('mu'),
|
|
403
|
+
r.say('mu', phrase('Eight seconds, upbeat, and it stops when you open the oven.'), { id: 'song', card: { kind: 'file', name: 'timer.mp3', type: 'doc', detail: phrase('0:08') } }),
|
|
404
|
+
react('song', 'heart', 3),
|
|
405
|
+
]),
|
|
406
|
+
'orbit/general': room('orbit/general', hm(9, 40), (r) => [
|
|
407
|
+
r.say('jun', phrase('First-time contributor here. Where do I start?')),
|
|
408
|
+
r.typing('doc'),
|
|
409
|
+
r.say('doc', phrase('The contributing guide, then any issue marked good first. I linked three that fit a first afternoon.')),
|
|
410
|
+
r.say('priya', phrase('Welcome aboard.'), { id: 'aboard' }),
|
|
411
|
+
react('aboard', 'party', 3),
|
|
412
|
+
]),
|
|
413
|
+
'orbit/releases': room('orbit/releases', hm(10, 15), (r) => [
|
|
414
|
+
r.say('theo', phrase('Is 2.4 ready to tag?')),
|
|
415
|
+
r.typing('cyber'),
|
|
416
|
+
r.say('cyber', phrase('The dependency audit is clean. Nothing new needs a patch.')),
|
|
417
|
+
r.say('doc', phrase('Changelog is final.'), { id: 'tag', card: { kind: 'file', name: 'CHANGELOG.md', type: 'doc', detail: phrase('2.4') } }),
|
|
418
|
+
react('tag', 'rocket', 5),
|
|
419
|
+
]),
|
|
420
|
+
'lab/general': room('lab/general', hm(21, 10), (r) => [
|
|
421
|
+
r.say('theo', phrase('What if the app planned the week for you?')),
|
|
422
|
+
r.typing('sci'),
|
|
423
|
+
r.say('sci', phrase('I will try it on our own calendars first and write up what happens.')),
|
|
424
|
+
r.say('priya', phrase('@data how often does a plan survive Tuesday?')),
|
|
425
|
+
r.typing('data'),
|
|
426
|
+
r.say('data', phrase('I can count that once we have a few weeks of plans to look at.'), { id: 'tuesday' }),
|
|
427
|
+
react('tuesday', 'eyes', 2),
|
|
428
|
+
]),
|
|
429
|
+
'lab/ideas': room('lab/ideas', hm(21, 20), (r) => [r.say('priya', phrase('A plant that texts when it is thirsty.')), r.say('theo', phrase('Filed under someday, next to the bot that waters it.'))]),
|
|
430
|
+
};
|
|
431
|
+
/** The day, in order. */
|
|
432
|
+
const SCENES = [MORNING, ORBIT, PLANS, ENG, SUPPORT, INBOX, FUNDRAISE, DESIGN, HIRING, LAUNCH, GENERAL, SIDE, GAME];
|
|
433
|
+
/** What a reader opening a room plays: each room's own scene (the morning's two passes are the day's, not a room's). */
|
|
434
|
+
const OWN = [ORBIT, ENG, SUPPORT, INBOX, FUNDRAISE, DESIGN, HIRING, LAUNCH, GENERAL, SIDE, GAME];
|
|
435
|
+
/** Words a line holds: how long it takes to read. */
|
|
436
|
+
const words = (text) => text.split(/\s+/).filter(Boolean).length;
|
|
437
|
+
/**
|
|
438
|
+
* How long each event waits from the one before it: long enough to read what
|
|
439
|
+
* came before (a message, and a card under it), to watch someone type, to
|
|
440
|
+
* take in a room just opened.
|
|
441
|
+
*/
|
|
442
|
+
export function pace(events) {
|
|
443
|
+
return events.map((e, i) => {
|
|
444
|
+
if (e.wait !== undefined)
|
|
445
|
+
return { ...e, wait: e.wait };
|
|
446
|
+
const before = events[i - 1];
|
|
447
|
+
if (!before)
|
|
448
|
+
return { ...e, wait: 1200 };
|
|
449
|
+
let wait = 900;
|
|
450
|
+
if (before.kind === 'say')
|
|
451
|
+
wait = Math.min(5200, 1300 + words(before.text) * 210 + (before.card ? 1600 : 0));
|
|
452
|
+
else if (before.kind === 'reply')
|
|
453
|
+
wait = Math.min(4400, 1200 + words(before.text) * 200);
|
|
454
|
+
else if (before.kind === 'typing')
|
|
455
|
+
wait = 1500;
|
|
456
|
+
else if (before.kind === 'open')
|
|
457
|
+
wait = 1700;
|
|
458
|
+
else if (before.kind === 'card')
|
|
459
|
+
wait = 1500;
|
|
460
|
+
else if (before.kind === 'huddle')
|
|
461
|
+
wait = 1600;
|
|
462
|
+
else if (before.kind === 'thread')
|
|
463
|
+
wait = 1100;
|
|
464
|
+
else if (before.kind === 'react')
|
|
465
|
+
wait = 1000;
|
|
466
|
+
return { ...e, wait };
|
|
467
|
+
});
|
|
468
|
+
}
|
|
469
|
+
/** The whole day, paced. */
|
|
470
|
+
export const DAY = pace(SCENES.flat());
|
|
471
|
+
/** Every room's own scene, paced, for a reader who opens it. */
|
|
472
|
+
export const SCENE = Object.fromEntries([...OWN, ...Object.values(EXTRA)].map((s) => [s[0].room, pace(s)]));
|
|
473
|
+
/** The room an org opens on when its tile is pressed. */
|
|
474
|
+
export const HOME = { acme: 'acme/eng', orbit: 'orbit/contributors', friday: 'friday/side-project', lab: 'lab/general' };
|
|
475
|
+
/**
|
|
476
|
+
* The frame a reader who asked for less motion sees, and the first paint: the
|
|
477
|
+
* end of #eng — the pull request merged, its thread and its reactions — with
|
|
478
|
+
* the next ticket waiting in #support.
|
|
479
|
+
*/
|
|
480
|
+
export const STILL = MORNING.length + ORBIT.length + PLANS.length + ENG.length;
|
|
481
|
+
/** How long the day plays before it starts again, in milliseconds (`REST` held at the end not counted). */
|
|
482
|
+
export const LENGTH = DAY.reduce((n, b) => n + b.wait, 0);
|
|
483
|
+
/** How many messages a room keeps on screen: the oldest leave the top. */
|
|
484
|
+
const KEEP = 14;
|
|
485
|
+
/** Folds the first `at` events into a frame. */
|
|
486
|
+
export function frame(events, at) {
|
|
487
|
+
const rooms = {};
|
|
488
|
+
const where = new Map();
|
|
489
|
+
const seat = (id) => {
|
|
490
|
+
if (!rooms[id]) {
|
|
491
|
+
rooms[id] = (SEED[id] ?? []).map((s, i) => ({ id: `${id}#${i}`, who: s.who, text: s.text, time: s.time, reactions: [], replies: [] }));
|
|
492
|
+
}
|
|
493
|
+
return rooms[id];
|
|
494
|
+
};
|
|
495
|
+
const unread = { ...UNREAD };
|
|
496
|
+
const huddle = {};
|
|
497
|
+
let view = events.find((e) => e.kind === 'open')?.room ?? 'acme/eng';
|
|
498
|
+
let clock = hm(9, 0);
|
|
499
|
+
let thread = null;
|
|
500
|
+
let typing = null;
|
|
501
|
+
events.slice(0, at).forEach((e, i) => {
|
|
502
|
+
if (e.kind !== 'typing')
|
|
503
|
+
typing = null;
|
|
504
|
+
switch (e.kind) {
|
|
505
|
+
case 'open':
|
|
506
|
+
view = e.room;
|
|
507
|
+
clock = Math.max(clock, e.time);
|
|
508
|
+
unread[e.room] = 0;
|
|
509
|
+
thread = null;
|
|
510
|
+
seat(e.room);
|
|
511
|
+
break;
|
|
512
|
+
case 'say': {
|
|
513
|
+
clock += Math.max(1, Math.round(words(e.text) / 10));
|
|
514
|
+
const m = { id: e.id ?? `${e.room}@${i}`, who: e.who, text: e.text, time: clock, card: e.card, reactions: [], replies: [] };
|
|
515
|
+
seat(e.room).push(m);
|
|
516
|
+
where.set(m.id, m);
|
|
517
|
+
if (e.room !== view)
|
|
518
|
+
unread[e.room] = (unread[e.room] ?? 0) + 1;
|
|
519
|
+
break;
|
|
520
|
+
}
|
|
521
|
+
case 'typing':
|
|
522
|
+
typing = { room: e.room, who: e.who };
|
|
523
|
+
break;
|
|
524
|
+
case 'react': {
|
|
525
|
+
const m = where.get(e.to);
|
|
526
|
+
if (!m)
|
|
527
|
+
break;
|
|
528
|
+
const r = m.reactions.find((x) => x.mark === e.mark);
|
|
529
|
+
if (r)
|
|
530
|
+
r.n += e.n;
|
|
531
|
+
else
|
|
532
|
+
m.reactions.push({ mark: e.mark, n: e.n });
|
|
533
|
+
break;
|
|
534
|
+
}
|
|
535
|
+
case 'reply': {
|
|
536
|
+
const m = where.get(e.to);
|
|
537
|
+
if (!m)
|
|
538
|
+
break;
|
|
539
|
+
clock += 1;
|
|
540
|
+
m.replies.push({ who: e.who, text: e.text, time: clock });
|
|
541
|
+
break;
|
|
542
|
+
}
|
|
543
|
+
case 'card': {
|
|
544
|
+
const m = where.get(e.to);
|
|
545
|
+
if (m?.card)
|
|
546
|
+
m.card = { ...m.card, ...e.patch };
|
|
547
|
+
break;
|
|
548
|
+
}
|
|
549
|
+
case 'thread':
|
|
550
|
+
thread = e.to;
|
|
551
|
+
break;
|
|
552
|
+
case 'huddle':
|
|
553
|
+
huddle[e.room] = e.who;
|
|
554
|
+
break;
|
|
555
|
+
}
|
|
556
|
+
});
|
|
557
|
+
seat(view);
|
|
558
|
+
for (const id of Object.keys(rooms))
|
|
559
|
+
rooms[id] = rooms[id].slice(-KEEP);
|
|
560
|
+
return { room: view, rooms, unread, typing, thread, huddle };
|
|
561
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hanzo/app",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.51",
|
|
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",
|