@hanzo/app 0.2.49 → 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.
@@ -0,0 +1,199 @@
1
+ /**
2
+ * A working day in Hanzo Team, as data: what `TeamPreview` plays. It opens on
3
+ * the morning hopping across the organizations a person belongs to — Acme (a
4
+ * sample company), Orbit (an open-source project Acme's people and others
5
+ * maintain together), Friday Club (friends) — before it settles at Acme, where
6
+ * people and their agents fix a bug, answer a customer, clear the inbox, raise
7
+ * a round, review a design, hire and launch; in the evening the switcher flips
8
+ * to Friday Club, where friends build a recipe app and book game night.
9
+ *
10
+ * The script is events, each a room's (`org/channel`): a message, someone
11
+ * typing, a reaction, a thread reply, a card changing state (a pull request
12
+ * merged, a draft sent), a huddle, and the view moving to another room. A
13
+ * message to a room out of view leaves it unread, which is what the next room
14
+ * is opened by. `pace` sets how long each event waits from what came before
15
+ * it: the reading time of the message before, the typing, the pause after a
16
+ * room opens. `frame` folds the events up to a point into what the screen
17
+ * shows, so any beat is a whole frame and the script holds no state.
18
+ *
19
+ * Every authored word is `phrase`d; a person's or agent's name, a channel, a
20
+ * file and a repository stay as written. Nothing here is a measurement: the
21
+ * company, the people and the numbers in a card are sample copy.
22
+ */
23
+ export type Mark = 'thumbs' | 'heart' | 'flame' | 'rocket' | 'eyes' | 'laugh' | 'party' | 'check';
24
+ export type Card =
25
+ /** A pull request: under review, its checks passed, merged. */
26
+ {
27
+ kind: 'pr';
28
+ repo: string;
29
+ number: number;
30
+ title: string;
31
+ add: number;
32
+ del: number;
33
+ state: 'review' | 'passed' | 'merged';
34
+ }
35
+ /** A reply drafted for a person to approve: an email or a support answer. */
36
+ | {
37
+ kind: 'draft';
38
+ to: string;
39
+ body: string;
40
+ sent?: boolean;
41
+ } | {
42
+ kind: 'file';
43
+ name: string;
44
+ type: 'doc' | 'deck' | 'sheet' | 'image';
45
+ detail?: string;
46
+ } | {
47
+ kind: 'meeting';
48
+ title: string;
49
+ when: string;
50
+ } | {
51
+ kind: 'list';
52
+ title: string;
53
+ items: string[];
54
+ done?: number[];
55
+ }
56
+ /** A question an agent stops to ask, with its answers; `picked` once a person answers. */
57
+ | {
58
+ kind: 'ask';
59
+ options: string[];
60
+ picked?: number;
61
+ }
62
+ /** Design directions side by side, one picked. */
63
+ | {
64
+ kind: 'options';
65
+ file: string;
66
+ options: string[];
67
+ picked?: number;
68
+ };
69
+ type Base = {
70
+ wait?: number;
71
+ };
72
+ export type Event = Base & ({
73
+ kind: 'open';
74
+ room: string;
75
+ time: number;
76
+ } | {
77
+ kind: 'say';
78
+ room: string;
79
+ who: string;
80
+ text: string;
81
+ id?: string;
82
+ card?: Card;
83
+ } | {
84
+ kind: 'typing';
85
+ room: string;
86
+ who: string;
87
+ } | {
88
+ kind: 'react';
89
+ to: string;
90
+ mark: Mark;
91
+ n: number;
92
+ } | {
93
+ kind: 'reply';
94
+ to: string;
95
+ who: string;
96
+ text: string;
97
+ }
98
+ /** A card changes: a pull request merges, a draft is sent, an answer is picked. */
99
+ | {
100
+ kind: 'card';
101
+ to: string;
102
+ patch: Partial<Card>;
103
+ }
104
+ /** The thread beside the channel opens on a message, or closes (`to: null`). */
105
+ | {
106
+ kind: 'thread';
107
+ to: string | null;
108
+ }
109
+ /** A huddle starts in a room with these people, or ends (`who: []`). */
110
+ | {
111
+ kind: 'huddle';
112
+ room: string;
113
+ who: string[];
114
+ });
115
+ export type Beat = Event & {
116
+ wait: number;
117
+ };
118
+ export type Who = {
119
+ name: string;
120
+ role?: string;
121
+ };
122
+ /** People wear their initials; agents wear the crew's memoji (`/memoji/<id>.svg`). */
123
+ export declare const PEOPLE: Record<string, Who>;
124
+ export declare const AGENTS: Record<string, Who>;
125
+ export declare const agent: (id: string) => boolean;
126
+ export declare const who: (id: string) => Who;
127
+ export type Channel = {
128
+ id: string;
129
+ topic: string;
130
+ };
131
+ export type Org = {
132
+ id: string;
133
+ name: string;
134
+ /** The org's tile on the rail: its initial. */
135
+ mark: string;
136
+ channels: Channel[];
137
+ /** Direct messages: people, and an agent or two someone talks to one to one. */
138
+ people: string[];
139
+ agents: string[];
140
+ };
141
+ export declare const ORGS: Org[];
142
+ export declare const orgOf: (room: string) => Org;
143
+ export declare const channelOf: (room: string) => string;
144
+ /** A message as the screen draws it. */
145
+ export interface Message {
146
+ id: string;
147
+ who: string;
148
+ text: string;
149
+ time: number;
150
+ card?: Card;
151
+ reactions: {
152
+ mark: Mark;
153
+ n: number;
154
+ }[];
155
+ replies: {
156
+ who: string;
157
+ text: string;
158
+ time: number;
159
+ }[];
160
+ }
161
+ /** Rooms with news before the day starts: their channel is bold, their org's tile marked. */
162
+ export declare const UNREAD: Record<string, number>;
163
+ /**
164
+ * How long each event waits from the one before it: long enough to read what
165
+ * came before (a message, and a card under it), to watch someone type, to
166
+ * take in a room just opened.
167
+ */
168
+ export declare function pace(events: Event[]): Beat[];
169
+ /** The whole day, paced. */
170
+ export declare const DAY: Beat[];
171
+ /** Every room's own scene, paced, for a reader who opens it. */
172
+ export declare const SCENE: Record<string, Beat[]>;
173
+ /** The room an org opens on when its tile is pressed. */
174
+ export declare const HOME: Record<string, string>;
175
+ /**
176
+ * The frame a reader who asked for less motion sees, and the first paint: the
177
+ * end of #eng — the pull request merged, its thread and its reactions — with
178
+ * the next ticket waiting in #support.
179
+ */
180
+ export declare const STILL: number;
181
+ /** How long the day plays before it starts again, in milliseconds (`REST` held at the end not counted). */
182
+ export declare const LENGTH: number;
183
+ /** What the screen shows: the room in view and everything each room holds by then. */
184
+ export interface Frame {
185
+ room: string;
186
+ rooms: Record<string, Message[]>;
187
+ unread: Record<string, number>;
188
+ /** Who is typing, and where. */
189
+ typing: {
190
+ room: string;
191
+ who: string;
192
+ } | null;
193
+ /** The message whose thread stands beside the channel. */
194
+ thread: string | null;
195
+ huddle: Record<string, string[]>;
196
+ }
197
+ /** Folds the first `at` events into a frame. */
198
+ export declare function frame(events: Event[], at: number): Frame;
199
+ export {};