@miadi/chronicle-tui 0.4.2 → 0.6.0

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,250 @@
1
+ /**
2
+ * Talking circles from the terminal (jgwill/Miadi#706, P3).
3
+ *
4
+ * The browser takes part in a circle the way the web pages do
5
+ * (`app/circles/[id]/page.tsx`, `app/ceremony/[id]/page.tsx`), through the
6
+ * same routes and nothing else:
7
+ *
8
+ * - `GET /api/circles` and `GET /api/circles/{id}`: the circles, and one circle
9
+ * with its members and the ceremonies it held.
10
+ * - `GET /api/chronicle/episodes/{ref}/wheel`: the ceremonies held in an
11
+ * episode, as this reader may see them.
12
+ * - `GET /api/ceremony/{id}`: one ceremony whole, its turns and diary, and
13
+ * `can`, what the routes would accept from this reader.
14
+ * - `POST …/turns`, `…/turns/{beat}/witness`, `…/diary`, `…/close`, and
15
+ * `POST /api/circles/{id}/ceremonies`: speaking, witnessing, the diary,
16
+ * closing, and opening a ceremony.
17
+ *
18
+ * Each of these is a person's act. The routes refuse the writer token
19
+ * ("Sign in as a person to speak"), so every write here goes as
20
+ * `MIADI_PERSON_TOKEN` and nothing else (`MiadiApi.postAsPerson`). The browser
21
+ * offers an act only where `can` says the route would take it.
22
+ *
23
+ * A turn is a person's words. It is shown inside its ceremony to a reader the
24
+ * app lets read that ceremony, as the ceremony page shows it, and never on a
25
+ * card or in a list (jgwill/Miadi#680, D3).
26
+ */
27
+ import { type MiadiApi } from "./api.js";
28
+ export declare const DIRECTIONS: readonly ["east", "south", "west", "north"];
29
+ /** What `POST /api/circles/{id}/ceremonies` opens. A closing is made by closing a ceremony. */
30
+ export declare const CEREMONY_TYPES: readonly ["talking_circle", "opening", "smudging", "spirit_feeding"];
31
+ /** The diary's phases and kinds, as the ceremony page offers them. */
32
+ export declare const DIARY_PHASES: readonly ["miigwechiwendam", "nindokendaan", "ningwaab", "nindoodam", "migwech"];
33
+ export declare const PHASE_LABELS: Record<string, string>;
34
+ export declare const ENTRY_TYPES: readonly ["intention", "observation", "hypothesis", "data", "synthesis", "action", "reflection", "learning"];
35
+ /** `talking_circle` as people say it. */
36
+ export declare const typeLabel: (type: string | undefined) => string;
37
+ export interface CeremonyRecord {
38
+ id: string;
39
+ type: string;
40
+ direction?: string;
41
+ intentions?: string[];
42
+ timestamp?: string;
43
+ circle_id?: string;
44
+ episode_path?: string;
45
+ episode_number?: number;
46
+ /** On a closing: the ceremony it closes. */
47
+ closes?: string;
48
+ participants?: string[];
49
+ }
50
+ export interface HeldCeremony {
51
+ ceremony: CeremonyRecord;
52
+ open: boolean;
53
+ /** The latest closing that names it. */
54
+ closing?: CeremonyRecord;
55
+ }
56
+ /**
57
+ * Fold closings into the ceremonies they close: open ones first, then closed,
58
+ * each newest first. The same fold as the web's `holdCeremonies`
59
+ * (`lib/ceremony-view.ts`); a closing whose ceremony is not listed is not shown.
60
+ */
61
+ export declare function holdCeremonies(records: readonly CeremonyRecord[]): HeldCeremony[];
62
+ /** The words a ceremony goes by in a list: its first intention, else its kind. */
63
+ export declare function ceremonyHeadline(ceremony: CeremonyRecord): string;
64
+ /** When, as a mail client dates a message: the time today, the day this year, the date before. */
65
+ export declare function whenOf(iso: string | undefined, now?: Date): string;
66
+ export interface CircleRow {
67
+ id: string;
68
+ name: string;
69
+ intention?: string;
70
+ direction?: string;
71
+ type?: string;
72
+ active: boolean;
73
+ /** The reader sits in it. */
74
+ member: boolean;
75
+ facilitator?: string;
76
+ /** The episode it was opened for. */
77
+ episode?: string;
78
+ /** It was opened for, or held a ceremony in, the episode in focus. */
79
+ forEpisode: boolean;
80
+ }
81
+ export interface CirclesIndex {
82
+ /** The episode in focus, as the wheel names it. */
83
+ episode?: {
84
+ path: string;
85
+ number?: number;
86
+ title?: string;
87
+ };
88
+ /** The ceremonies held in that episode which this reader may read. */
89
+ held: HeldCeremony[];
90
+ /** The circles this reader sees: the episode's first, then theirs, then the others. */
91
+ circles: CircleRow[];
92
+ }
93
+ /** The circles this reader sees and, when an episode is in focus, what it held. */
94
+ export declare function loadCircles(api: MiadiApi, episodePath?: string): Promise<CirclesIndex>;
95
+ export type CircleEntry = {
96
+ kind: "heading";
97
+ text: string;
98
+ } | {
99
+ kind: "ceremony";
100
+ held: HeldCeremony;
101
+ } | {
102
+ kind: "circle";
103
+ circle: CircleRow;
104
+ };
105
+ /** The circles overlay as rows: the episode's ceremonies, then the circles, each group under a heading. */
106
+ export declare function circleEntries(index: CirclesIndex): CircleEntry[];
107
+ export interface CircleView {
108
+ circle: CircleRow;
109
+ members: Array<{
110
+ name: string;
111
+ role: string;
112
+ }>;
113
+ /** The reader's seat, when they sit here. */
114
+ seat?: string;
115
+ can: {
116
+ open_ceremony: boolean;
117
+ invite: boolean;
118
+ manage: boolean;
119
+ };
120
+ held: HeldCeremony[];
121
+ /** Episode numbers and titles for the ceremonies' rows. */
122
+ episodes: Record<string, {
123
+ number?: number;
124
+ title?: string;
125
+ }>;
126
+ }
127
+ export declare function readCircle(api: MiadiApi, id: string): Promise<CircleView>;
128
+ export interface Turn {
129
+ id: string;
130
+ speaker?: string;
131
+ speakerName: string;
132
+ title?: string;
133
+ said: string;
134
+ timestamp?: string;
135
+ witnesses: string[];
136
+ witnessNames: string[];
137
+ /** A facilitator of the circle witnessed it. */
138
+ facilitatorWitnessed: boolean;
139
+ }
140
+ export interface DiaryEntry {
141
+ id: string;
142
+ who: string;
143
+ phase: string;
144
+ kind: string;
145
+ content: string;
146
+ timestamp?: string;
147
+ }
148
+ export interface CeremonyView {
149
+ id: string;
150
+ type: string;
151
+ direction?: string;
152
+ intentions: string[];
153
+ timestamp?: string;
154
+ episode?: {
155
+ path: string;
156
+ number?: number;
157
+ };
158
+ subject?: {
159
+ name: string;
160
+ url?: string;
161
+ };
162
+ circle?: {
163
+ id: string;
164
+ name: string;
165
+ members: Array<{
166
+ name: string;
167
+ role: string;
168
+ }>;
169
+ };
170
+ present: string[];
171
+ turns: Turn[];
172
+ diary: DiaryEntry[];
173
+ closing?: {
174
+ learnings: string[];
175
+ timestamp?: string;
176
+ };
177
+ closed: boolean;
178
+ me?: {
179
+ id: string;
180
+ name: string;
181
+ member: boolean;
182
+ facilitator: boolean;
183
+ };
184
+ /** What the routes would take from this reader now, as the app says. */
185
+ can: {
186
+ speak: boolean;
187
+ witness: boolean;
188
+ diary: boolean;
189
+ close: boolean;
190
+ };
191
+ }
192
+ export declare function readCeremony(api: MiadiApi, id: string): Promise<CeremonyView>;
193
+ /** Whether this reader may witness this turn now, as the ceremony page decides: not their own, not twice, not once closed. */
194
+ export declare function mayWitness(view: CeremonyView, turn: Turn): boolean;
195
+ /** Learnings as typed or pasted: one per line, or separated by ` | `. */
196
+ export declare function splitLearnings(text: string): string[];
197
+ export declare function speak(api: MiadiApi, id: string, said: string): Promise<{
198
+ turn?: {
199
+ id: string;
200
+ };
201
+ }>;
202
+ export declare function witness(api: MiadiApi, id: string, turnId: string): Promise<{
203
+ turn?: {
204
+ id: string;
205
+ };
206
+ }>;
207
+ export declare function writeDiary(api: MiadiApi, id: string, entry: {
208
+ phase: string;
209
+ entryType: string;
210
+ content: string;
211
+ }): Promise<{
212
+ entry?: {
213
+ id: string;
214
+ };
215
+ }>;
216
+ export declare function closeCeremony(api: MiadiApi, id: string, learnings: string[]): Promise<{
217
+ closing?: {
218
+ id: string;
219
+ };
220
+ already?: boolean;
221
+ }>;
222
+ export declare function openCeremony(api: MiadiApi, circleId: string, input: {
223
+ type: string;
224
+ direction: string;
225
+ intention: string;
226
+ episode_path?: string;
227
+ }): Promise<{
228
+ ceremony: CeremonyRecord;
229
+ }>;
230
+ export type Tone = "mark" | "name" | "meta" | "text" | "title" | "witness";
231
+ export interface CeremonyLine {
232
+ parts: Array<{
233
+ text: string;
234
+ tone: Tone;
235
+ }>;
236
+ /** The turn or diary entry this line belongs to. */
237
+ item?: number;
238
+ }
239
+ export interface CeremonyScreen {
240
+ lines: CeremonyLine[];
241
+ /** The first line of each item. */
242
+ starts: number[];
243
+ /** The line after each item's last. */
244
+ ends: number[];
245
+ }
246
+ /** The turns (with their witnesses and the closing), or the diary, as lines no wider than `width`. */
247
+ export declare function ceremonyLines(view: CeremonyView, tab: "turns" | "diary", width: number, now?: Date): CeremonyScreen;
248
+ /** The scroll that keeps item `selected` in a window of `room` lines, starting from `scroll`. */
249
+ export declare function scrollTo(screen: CeremonyScreen, selected: number, scroll: number, room: number): number;
250
+ //# sourceMappingURL=circles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"circles.d.ts","sourceRoot":"","sources":["../src/circles.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAGH,OAAO,EAAY,KAAK,QAAQ,EAAE,MAAM,UAAU,CAAA;AAGlD,eAAO,MAAM,UAAU,6CAA8C,CAAA;AAErE,+FAA+F;AAC/F,eAAO,MAAM,cAAc,sEAAuE,CAAA;AAElG,sEAAsE;AACtE,eAAO,MAAM,YAAY,kFAAmF,CAAA;AAC5G,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAM/C,CAAA;AACD,eAAO,MAAM,WAAW,8GAA+G,CAAA;AAEvI,yCAAyC;AACzC,eAAO,MAAM,SAAS,GAAI,MAAM,MAAM,GAAG,SAAS,WAAuD,CAAA;AAMzG,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAA;IACrB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,4CAA4C;IAC5C,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,YAAY,CAAC,EAAE,MAAM,EAAE,CAAA;CACxB;AAED,MAAM,WAAW,YAAY;IAC3B,Q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AAE,MAAM,GAAG,MAAM,CASvG"}
@@ -0,0 +1,308 @@
1
+ /**
2
+ * Talking circles from the terminal (jgwill/Miadi#706, P3).
3
+ *
4
+ * The browser takes part in a circle the way the web pages do
5
+ * (`app/circles/[id]/page.tsx`, `app/ceremony/[id]/page.tsx`), through the
6
+ * same routes and nothing else:
7
+ *
8
+ * - `GET /api/circles` and `GET /api/circles/{id}`: the circles, and one circle
9
+ * with its members and the ceremonies it held.
10
+ * - `GET /api/chronicle/episodes/{ref}/wheel`: the ceremonies held in an
11
+ * episode, as this reader may see them.
12
+ * - `GET /api/ceremony/{id}`: one ceremony whole, its turns and diary, and
13
+ * `can`, what the routes would accept from this reader.
14
+ * - `POST …/turns`, `…/turns/{beat}/witness`, `…/diary`, `…/close`, and
15
+ * `POST /api/circles/{id}/ceremonies`: speaking, witnessing, the diary,
16
+ * closing, and opening a ceremony.
17
+ *
18
+ * Each of these is a person's act. The routes refuse the writer token
19
+ * ("Sign in as a person to speak"), so every write here goes as
20
+ * `MIADI_PERSON_TOKEN` and nothing else (`MiadiApi.postAsPerson`). The browser
21
+ * offers an act only where `can` says the route would take it.
22
+ *
23
+ * A turn is a person's words. It is shown inside its ceremony to a reader the
24
+ * app lets read that ceremony, as the ceremony page shows it, and never on a
25
+ * card or in a list (jgwill/Miadi#680, D3).
26
+ */
27
+ import { wrapSegments } from "./model.js";
28
+ import { ApiError } from "./api.js";
29
+ import { clean, cleanLine } from "./text.js";
30
+ export const DIRECTIONS = ["east", "south", "west", "north"];
31
+ /** What `POST /api/circles/{id}/ceremonies` opens. A closing is made by closing a ceremony. */
32
+ export const CEREMONY_TYPES = ["talking_circle", "opening", "smudging", "spirit_feeding"];
33
+ /** The diary's phases and kinds, as the ceremony page offers them. */
34
+ export const DIARY_PHASES = ["miigwechiwendam", "nindokendaan", "ningwaab", "nindoodam", "migwech"];
35
+ export const PHASE_LABELS = {
36
+ miigwechiwendam: "Miigwechiwendam · sacred space",
37
+ nindokendaan: "Nindokendaan · gathering",
38
+ ningwaab: "Ningwaab · integration",
39
+ nindoodam: "Nindoodam · creative expression",
40
+ migwech: "Migwech · closing",
41
+ };
42
+ export const ENTRY_TYPES = ["intention", "observation", "hypothesis", "data", "synthesis", "action", "reflection", "learning"];
43
+ /** `talking_circle` as people say it. */
44
+ export const typeLabel = (type) => cleanLine((type ?? "ceremony").replace(/_/g, " "));
45
+ const time = (iso) => {
46
+ const t = iso ? Date.parse(iso) : NaN;
47
+ return Number.isNaN(t) ? 0 : t;
48
+ };
49
+ /**
50
+ * Fold closings into the ceremonies they close: open ones first, then closed,
51
+ * each newest first. The same fold as the web's `holdCeremonies`
52
+ * (`lib/ceremony-view.ts`); a closing whose ceremony is not listed is not shown.
53
+ */
54
+ export function holdCeremonies(records) {
55
+ const closings = new Map();
56
+ for (const record of records) {
57
+ if (record.type !== "closing" || !record.closes)
58
+ continue;
59
+ const seen = closings.get(record.closes);
60
+ if (!seen || time(record.timestamp) > time(seen.timestamp))
61
+ closings.set(record.closes, record);
62
+ }
63
+ return records
64
+ .filter((record) => record.type !== "closing")
65
+ .map((ceremony) => {
66
+ const closing = closings.get(ceremony.id);
67
+ return closing ? { ceremony, open: false, closing } : { ceremony, open: true };
68
+ })
69
+ .sort((a, b) => Number(b.open) - Number(a.open) || time(b.ceremony.timestamp) - time(a.ceremony.timestamp));
70
+ }
71
+ /** The words a ceremony goes by in a list: its first intention, else its kind. */
72
+ export function ceremonyHeadline(ceremony) {
73
+ const intention = (ceremony.intentions ?? []).map((line) => cleanLine(line).replace(/\s+/g, " ").trim()).find(Boolean);
74
+ return intention ?? typeLabel(ceremony.type);
75
+ }
76
+ const MONTHS = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
77
+ /** When, as a mail client dates a message: the time today, the day this year, the date before. */
78
+ export function whenOf(iso, now = new Date()) {
79
+ const t = iso ? new Date(iso) : null;
80
+ if (!t || Number.isNaN(t.getTime()))
81
+ return "";
82
+ const hm = `${String(t.getHours()).padStart(2, "0")}:${String(t.getMinutes()).padStart(2, "0")}`;
83
+ const day = `${MONTHS[t.getMonth()]} ${t.getDate()}`;
84
+ if (t.toDateString() === now.toDateString())
85
+ return hm;
86
+ if (t.getFullYear() === now.getFullYear())
87
+ return `${day} ${hm}`;
88
+ return `${day}, ${t.getFullYear()}`;
89
+ }
90
+ const circleRow = (circle, forEpisode = false) => ({
91
+ id: circle.id,
92
+ name: cleanLine(circle.name),
93
+ intention: circle.intention ? cleanLine(circle.intention).replace(/\s+/g, " ").trim() : undefined,
94
+ direction: circle.direction,
95
+ type: circle.circle_type,
96
+ active: circle.active !== false,
97
+ member: circle.member === true,
98
+ facilitator: circle.facilitator_name ? cleanLine(circle.facilitator_name) : undefined,
99
+ episode: circle.episode_path,
100
+ forEpisode,
101
+ });
102
+ /** The circles this reader sees and, when an episode is in focus, what it held. */
103
+ export async function loadCircles(api, episodePath) {
104
+ const [list, wheel] = await Promise.all([
105
+ api.get("/api/circles"),
106
+ episodePath
107
+ ? api
108
+ .get(`/api/chronicle/episodes/${encodeURIComponent(episodePath)}/wheel`)
109
+ .catch((error) => {
110
+ // A community episode answers 404 to a reader it is hidden from: then it held nothing for them.
111
+ if (error instanceof ApiError && error.status === 404)
112
+ return null;
113
+ throw error;
114
+ })
115
+ : Promise.resolve(null),
116
+ ]);
117
+ const forEpisode = new Set((wheel?.circles ?? []).map((circle) => circle.id));
118
+ const circles = (list.circles ?? []).map((circle) => circleRow(circle, forEpisode.has(circle.id)));
119
+ const rank = (row) => (row.forEpisode ? 0 : row.member ? 1 : 2);
120
+ return {
121
+ episode: wheel?.episode ? { ...wheel.episode, title: wheel.episode.title ? cleanLine(wheel.episode.title) : undefined } : undefined,
122
+ held: holdCeremonies(wheel?.ceremonies ?? []),
123
+ // A stable sort keeps the app's order (newest circle first) inside each group.
124
+ circles: circles.map((row, index) => ({ row, index })).sort((a, b) => rank(a.row) - rank(b.row) || a.index - b.index).map(({ row }) => row),
125
+ };
126
+ }
127
+ /** The circles overlay as rows: the episode's ceremonies, then the circles, each group under a heading. */
128
+ export function circleEntries(index) {
129
+ const entries = [];
130
+ if (index.episode) {
131
+ const label = index.episode.number !== undefined ? `ep ${index.episode.number}` : index.episode.path;
132
+ entries.push({ kind: "heading", text: index.held.length ? `Held in ${label}` : `No ceremony held in ${label} that you may read` });
133
+ for (const held of index.held)
134
+ entries.push({ kind: "ceremony", held });
135
+ }
136
+ const groups = [
137
+ [index.episode ? "Gathered for this episode" : "", index.circles.filter((c) => c.forEpisode)],
138
+ ["Your circles", index.circles.filter((c) => !c.forEpisode && c.member)],
139
+ ["Other circles", index.circles.filter((c) => !c.forEpisode && !c.member)],
140
+ ];
141
+ for (const [heading, rows] of groups) {
142
+ if (rows.length === 0)
143
+ continue;
144
+ entries.push({ kind: "heading", text: heading });
145
+ for (const circle of rows)
146
+ entries.push({ kind: "circle", circle });
147
+ }
148
+ return entries;
149
+ }
150
+ export async function readCircle(api, id) {
151
+ const view = await api.get(`/api/circles/${encodeURIComponent(id)}`);
152
+ return {
153
+ circle: circleRow({ ...view.circle, member: Boolean(view.me) }),
154
+ members: (view.members ?? []).map((member) => ({ name: cleanLine(member.person?.name ?? member.person_id ?? "someone"), role: cleanLine(member.role ?? "member") })),
155
+ seat: view.me?.role ? cleanLine(view.me.role) : undefined,
156
+ can: { open_ceremony: view.can?.open_ceremony === true, invite: view.can?.invite === true, manage: view.can?.manage === true },
157
+ held: holdCeremonies(view.ceremonies ?? []),
158
+ episodes: view.context?.episodes ?? {},
159
+ };
160
+ }
161
+ export async function readCeremony(api, id) {
162
+ const view = await api.get(`/api/ceremony/${encodeURIComponent(id)}`);
163
+ const names = view.names ?? {};
164
+ const name = (pid) => cleanLine(names[pid] ?? pid);
165
+ const closed = Boolean(view.closed);
166
+ return {
167
+ // A reference may name a ceremony by the start of its id: every write goes under the whole one.
168
+ id: view.ceremony.id,
169
+ type: view.ceremony.type,
170
+ direction: view.ceremony.direction,
171
+ intentions: (view.ceremony.intentions ?? []).map((line) => clean(line).trim()).filter(Boolean),
172
+ timestamp: view.ceremony.timestamp,
173
+ episode: view.episode ? { path: view.episode.episode_path, number: view.episode.episode_number } : undefined,
174
+ subject: view.subject?.name ? { name: cleanLine(view.subject.name), url: view.subject.url } : undefined,
175
+ circle: view.circle
176
+ ? {
177
+ id: view.circle.id,
178
+ name: cleanLine(view.circle.name),
179
+ members: (view.circle.members ?? []).map((m) => ({ name: cleanLine(m.name ?? m.person_id ?? "someone"), role: cleanLine(m.role ?? "member") })),
180
+ }
181
+ : undefined,
182
+ present: (view.ceremony.participants ?? []).map(name),
183
+ turns: (view.turns ?? []).map((turn) => ({
184
+ id: turn.id,
185
+ speaker: turn.speaker,
186
+ speakerName: cleanLine(turn.speaker_name ?? turn.speaker ?? "someone"),
187
+ title: turn.title ? cleanLine(turn.title) : undefined,
188
+ said: clean(turn.prose ?? turn.description ?? ""),
189
+ timestamp: turn.timestamp,
190
+ witnesses: turn.witnesses ?? [],
191
+ witnessNames: (turn.witness_names ?? (turn.witnesses ?? []).map(name)).map((w) => cleanLine(w)),
192
+ facilitatorWitnessed: turn.facilitator_witnessed === true,
193
+ })),
194
+ diary: (view.diary ?? []).map((entry) => ({
195
+ id: entry.id,
196
+ who: cleanLine(entry.metadata?.participant_name ?? (entry.participant ? name(entry.participant) : "someone")),
197
+ phase: cleanLine(entry.phase ?? ""),
198
+ kind: cleanLine(entry.entryType ?? ""),
199
+ content: clean(entry.content ?? ""),
200
+ timestamp: entry.timestamp,
201
+ })),
202
+ closing: view.closing ? { learnings: (view.closing.intentions ?? []).map((line) => clean(line).trim()).filter(Boolean), timestamp: view.closing.timestamp } : undefined,
203
+ closed,
204
+ me: view.me
205
+ ? { id: view.me.id, name: cleanLine(view.me.name), member: view.me.member === true, facilitator: view.me.facilitator === true }
206
+ : undefined,
207
+ can: {
208
+ speak: view.can?.speak === true && !closed,
209
+ witness: view.can?.witness === true && !closed,
210
+ diary: view.can?.diary === true,
211
+ close: view.can?.close === true && !closed,
212
+ },
213
+ };
214
+ }
215
+ /** Whether this reader may witness this turn now, as the ceremony page decides: not their own, not twice, not once closed. */
216
+ export function mayWitness(view, turn) {
217
+ return view.can.witness && Boolean(view.me) && turn.speaker !== view.me.id && !turn.witnesses.includes(view.me.id);
218
+ }
219
+ /** Learnings as typed or pasted: one per line, or separated by ` | `. */
220
+ export function splitLearnings(text) {
221
+ return text
222
+ .split(/\n| \| /)
223
+ .map((line) => line.trim())
224
+ .filter(Boolean);
225
+ }
226
+ // ---------------------------------------------------------------------------
227
+ // The person's acts
228
+ // ---------------------------------------------------------------------------
229
+ const ceremonyPath = (id) => `/api/ceremony/${encodeURIComponent(id)}`;
230
+ export function speak(api, id, said) {
231
+ return api.postAsPerson(`${ceremonyPath(id)}/turns`, { said });
232
+ }
233
+ export function witness(api, id, turnId) {
234
+ return api.postAsPerson(`${ceremonyPath(id)}/turns/${encodeURIComponent(turnId)}/witness`, {});
235
+ }
236
+ export function writeDiary(api, id, entry) {
237
+ return api.postAsPerson(`${ceremonyPath(id)}/diary`, entry);
238
+ }
239
+ export function closeCeremony(api, id, learnings) {
240
+ return api.postAsPerson(`${ceremonyPath(id)}/close`, { learnings });
241
+ }
242
+ export function openCeremony(api, circleId, input) {
243
+ return api.postAsPerson(`/api/circles/${encodeURIComponent(circleId)}/ceremonies`, input);
244
+ }
245
+ function wrapped(text, width, indent, tone, item) {
246
+ const lines = [];
247
+ for (const paragraph of text.split("\n")) {
248
+ for (const segments of wrapSegments([{ text: paragraph, style: "text" }], Math.max(8, width - indent.length))) {
249
+ lines.push({ parts: [{ text: indent + segments.map((s) => s.text).join(""), tone }], item });
250
+ }
251
+ }
252
+ return lines;
253
+ }
254
+ /** The turns (with their witnesses and the closing), or the diary, as lines no wider than `width`. */
255
+ export function ceremonyLines(view, tab, width, now = new Date()) {
256
+ const lines = [];
257
+ const starts = [];
258
+ const ends = [];
259
+ const item = (index, head, body) => {
260
+ if (index > 0)
261
+ lines.push({ parts: [{ text: " ", tone: "text" }] });
262
+ starts.push(lines.length);
263
+ lines.push({ parts: head, item: index }, ...body);
264
+ ends.push(lines.length);
265
+ };
266
+ if (tab === "turns") {
267
+ if (view.turns.length === 0)
268
+ lines.push({ parts: [{ text: "No one has spoken yet.", tone: "meta" }] });
269
+ view.turns.forEach((turn, index) => {
270
+ const body = turn.title && turn.title !== `${turn.speakerName} speaks` ? wrapped(turn.title, width, " ", "title", index) : [];
271
+ body.push(...wrapped(turn.said, width, " ", "text", index));
272
+ if (turn.witnessNames.length) {
273
+ const by = `witnessed by ${turn.witnessNames.join(", ")}${turn.facilitatorWitnessed ? " · a facilitator" : ""}`;
274
+ body.push(...wrapped(by, width, " ", "witness", index));
275
+ }
276
+ item(index, [{ text: `${index + 1} `, tone: "mark" }, { text: turn.speakerName, tone: "name" }, { text: ` · ${whenOf(turn.timestamp, now)}`, tone: "meta" }], body);
277
+ });
278
+ if (view.closing) {
279
+ lines.push({ parts: [{ text: " ", tone: "text" }] });
280
+ lines.push({ parts: [{ text: `Closed ${whenOf(view.closing.timestamp, now)}`, tone: "name" }] });
281
+ for (const learning of view.closing.learnings)
282
+ lines.push(...wrapped(`· ${learning}`, width, " ", "text"));
283
+ }
284
+ }
285
+ else {
286
+ if (view.diary.length === 0)
287
+ lines.push({ parts: [{ text: "The diary is empty.", tone: "meta" }] });
288
+ view.diary.forEach((entry, index) => {
289
+ item(index, [{ text: entry.who, tone: "name" }, { text: ` · ${entry.phase} · ${entry.kind} · ${whenOf(entry.timestamp, now)}`, tone: "meta" }], wrapped(entry.content, width, " ", "text", index));
290
+ });
291
+ }
292
+ return { lines, starts, ends };
293
+ }
294
+ /** The scroll that keeps item `selected` in a window of `room` lines, starting from `scroll`. */
295
+ export function scrollTo(screen, selected, scroll, room) {
296
+ const start = screen.starts[selected];
297
+ if (start === undefined)
298
+ return 0;
299
+ const end = screen.ends[selected] ?? start + 1;
300
+ const max = Math.max(0, screen.lines.length - room);
301
+ if (start < scroll)
302
+ return Math.min(start, max);
303
+ // An item taller than the window shows from its first line.
304
+ if (end > scroll + room)
305
+ return Math.min(max, end - start > room ? start : end - room);
306
+ return Math.min(scroll, max);
307
+ }
308
+ //# sourceMappingURL=circles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"circles.js","sourceRoot":"","sources":["../src/circles.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AACzC,OAAO,EAAE,QAAQ,EAAiB,MAAM,UAAU,CAAA;AAClD,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AAE5C,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,CAAU,CAAA;AAErE,+FAA+F;AAC/F,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,gBAAgB,EAAE,SAAS,EAAE,UAAU,EAAE,gBAAgB,CAAU,CAAA;AAElG,sEAAsE;AACtE,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,iBAAiB,EAAE,cAAc,EAAE,UAAU,EAAE,WAAW,EAAE,SAAS,CAAU,CAAA;AAC5G,MAAM,CAAC,MAAM,YAAY,GAA2B;IAClD,eAAe,EAAE,gCAAgC;IACjD,YAAY,EAAE,0BAA0B;IACxC,QAAQ,EAAE,wBAAwB;IAClC,SAAS,EAAE,iCAAiC;IAC5C,OAAO,EAAE,mBAAmB;CAC7B,CAAA;AACD,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,WAAW,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,EAAE,WAAW,EAAE,QAAQ,EAAE,YAAY,EAAE,UAAU,CAAU,CAAA;AAEvI,yCAAyC;AACzC,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,IAAwB,EAAE,EAAE,CAAC,SAAS,CAAC,CAAC,IAAI,IAAI,UAAU,CAAC,CAAC,OAAO,CAAC,IAAI,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,OAAO,CAAC,CAAA;IACjC,MAAM,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,KAAK,GAAG,CAAC,CAAA;IAC9C,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC,CAAA;IACnD,IAAI,KAAK,GAAG,MAAM;QAAE,OAAO,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,CAAC,CAAA;IAC/C,4DAA4D;IAC5D,IAAI,GAAG,GAAG,MAAM,GAAG,IAAI;QAAE,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,GAAG,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,GAAG,IAAI,CAAC,CAAA;IACtF,OAAO,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;AAC9B,CAAC"}
package/dist/data.d.ts CHANGED
@@ -68,6 +68,8 @@ export declare function episodeDoors(chronicle: Chronicle, name: string, file?:
68
68
  * anyone, so it is never offered here (D9; jgwill/Miadi#706 security review, F6).
69
69
  */
70
70
  export declare function referenceDoors(chronicle: Chronicle, ref: TextReference, rows: readonly EpisodeRow[]): Promise<Doors>;
71
+ /** The pages of a ceremony or circle, by its `miadi-ceremony:` / `miadi-circle:` address or its id. */
72
+ export declare function wheelDoors(kind: "ceremony" | "circle", idOrUri: string): Promise<Doors>;
71
73
  /** The door a phone can open: the tailnet room, then the public one, then the first. */
72
74
  export declare function phoneDoor(doors: readonly Destination[]): Destination | undefined;
73
75
  export declare function qrLines(url: string, invert?: boolean): string[];
@@ -1 +1 @@
1
- {"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../src/data.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAKH,OAAO,EAUL,KAAK,WAAW,EAChB,KAAK,aAAa,EAElB,KAAK,aAAa,EACnB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AAS,CAAC,KAAK,EAAE,SAAS,WAAW,EAAE,GAAG,WAAW,GAAG,SAAS,CAOhF;AAED,wBAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,UAAQ,GAAG,MAAM,EAAE,CAE7D;AAED,wBAAsB,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,CAG9E;AAgBD;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAsBrE;AAED;;;GAGG;AACH,wBAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,GAAE,SAAS,MAAM,EAAO,GAAG;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,CAmB7H"}
package/dist/data.js CHANGED
@@ -130,11 +130,16 @@ export async function referenceDoors(chronicle, ref, rows) {
130
130
  const result = await resolveFoundationRefForTerminal(ref.uri, { bases: readWebBases() });
131
131
  return { title: ref.uri, doors: result?.destinations ?? [] };
132
132
  }
133
- const result = await resolveWheelRefForTerminal(ref.uri, { bases: readWebBases() });
133
+ return wheelDoors(ref.kind === "circle" ? "circle" : "ceremony", ref.uri);
134
+ }
135
+ /** The pages of a ceremony or circle, by its `miadi-ceremony:` / `miadi-circle:` address or its id. */
136
+ export async function wheelDoors(kind, idOrUri) {
137
+ const uri = /^miadi-(ceremony|circle):/i.test(idOrUri) ? idOrUri : `miadi-${kind}:${idOrUri}`;
138
+ const result = await resolveWheelRefForTerminal(uri, { bases: readWebBases() });
134
139
  return {
135
- title: ref.uri,
140
+ title: uri,
136
141
  doors: (result?.destinations ?? []).filter((door) => door.kind === "room"),
137
- note: `A ${ref.kind} is private until its page sees your seat. Only its pages are offered here.`,
142
+ note: `A ${kind} is private until its page sees your seat. Only its pages are offered here.`,
138
143
  };
139
144
  }
140
145
  /** The door a phone can open: the tailnet room, then the public one, then the first. */