@startsimpli/integrations 0.2.200 → 0.2.202
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/package.json +7 -7
- package/src/__tests__/briefing-actions.test.ts +11 -0
- package/src/__tests__/briefing-edits.test.ts +98 -0
- package/src/__tests__/briefing-markdown.test.ts +64 -0
- package/src/__tests__/converse-brain.test.ts +64 -1
- package/src/__tests__/converse-cards.test.ts +53 -0
- package/src/__tests__/converse-handoff.test.ts +8 -0
- package/src/__tests__/converse-meeting-brief.test.ts +72 -8
- package/src/__tests__/converse-meeting-duplex.test.ts +132 -0
- package/src/__tests__/converse-meeting-keep-speech.test.ts +87 -0
- package/src/__tests__/converse-meeting-vad.test.ts +1 -1
- package/src/__tests__/converse-page.test.tsx +148 -37
- package/src/__tests__/converse-roci.test.ts +22 -0
- package/src/__tests__/converse-spoken-form.test.ts +10 -0
- package/src/__tests__/converse-spoken-summary.test.ts +27 -6
- package/src/__tests__/converse-structure.test.ts +27 -0
- package/src/__tests__/converse-view.test.ts +46 -0
- package/src/__tests__/converse.test.ts +29 -2
- package/src/__tests__/corpus-ask.test.ts +22 -0
- package/src/__tests__/corpus-tracker.test.tsx +42 -174
- package/src/__tests__/data-table-logic.test.ts +75 -0
- package/src/__tests__/data-table.test.tsx +133 -0
- package/src/__tests__/extract-classify.test.ts +17 -0
- package/src/__tests__/fleet-page.test.tsx +57 -0
- package/src/__tests__/fleet-view.test.ts +149 -0
- package/src/__tests__/home-brief.test.tsx +25 -40
- package/src/__tests__/library-call-shape.test.tsx +164 -0
- package/src/__tests__/load-error.test.tsx +1 -1
- package/src/__tests__/mini-markdown.test.tsx +24 -0
- package/src/__tests__/overview-page.test.tsx +36 -6
- package/src/__tests__/plan-shell.test.tsx +6 -4
- package/src/__tests__/project-basis-entity.test.ts +19 -0
- package/src/__tests__/project-basis.test.ts +21 -0
- package/src/__tests__/relay-cli.test.ts +10 -1
- package/src/__tests__/task-detail-project-guess.test.tsx +46 -0
- package/src/__tests__/timeline-events.test.ts +65 -0
- package/src/__tests__/timeline-table.test.tsx +66 -0
- package/src/__tests__/todo-table-model.test.ts +75 -0
- package/src/__tests__/todo-table.test.tsx +202 -0
- package/src/__tests__/tracker-timeline-component.test.tsx +4 -4
- package/src/__tests__/tracker-timeline-reader.test.ts +1 -1
- package/src/comms/__tests__/app-sends-page.test.tsx +69 -0
- package/src/comms/api/comms.ts +23 -0
- package/src/comms/components/ResultsPanel.tsx +2 -2
- package/src/comms/components/SendLog.tsx +20 -8
- package/src/comms/components/index.ts +1 -0
- package/src/comms/components/pages/AppSendsPage.tsx +58 -0
- package/src/comms/hooks/index.ts +8 -3
- package/src/components/FolderTree.tsx +12 -3
- package/src/components/index.ts +4 -1
- package/src/components/pages/ConversePage.tsx +114 -105
- package/src/components/pages/FleetPage.tsx +115 -0
- package/src/components/pages/LibraryPage.tsx +63 -24
- package/src/components/pages/TaskDetailPage.tsx +27 -1
- package/src/components/pages/TrackerPage.tsx +170 -474
- package/src/components/pages/converse/CardView.tsx +72 -0
- package/src/components/pages/converse/SettingsMenu.tsx +37 -0
- package/src/components/pages/converse/Thread.tsx +48 -33
- package/src/components/pages/converse/useNeedsYou.ts +60 -0
- package/src/components/pages/home/BriefCard.tsx +16 -7
- package/src/components/pages/home/HomeBriefPage.tsx +6 -91
- package/src/components/pages/home/MiniMarkdown.tsx +51 -0
- package/src/components/pages/home/{DueSoonLine.tsx → dueSoonText.ts} +2 -11
- package/src/components/pages/home/index.ts +1 -1
- package/src/components/pages/overview/OverviewPage.tsx +46 -83
- package/src/components/pages/plan/TalkPage.tsx +5 -14
- package/src/components/pages/plan/TimelinePage.tsx +4 -2
- package/src/components/pages/task-tracker/ProjectGuess.tsx +42 -0
- package/src/components/pages/tracker/SweepPanel.tsx +108 -0
- package/src/components/pages/tracker/TimelineTable.tsx +70 -0
- package/src/components/pages/tracker/TrackerTimeline.tsx +32 -15
- package/src/components/table/DataTable.tsx +92 -0
- package/src/components/table/RowMenu.tsx +35 -0
- package/src/components/table/TablePagination.tsx +63 -0
- package/src/components/table/TableToolbar.tsx +56 -0
- package/src/components/table/TodoTable.tsx +142 -0
- package/src/components/table/index.ts +10 -0
- package/src/components/table/table-logic.ts +60 -0
- package/src/components/table/todo-model.ts +93 -0
- package/src/corpus/ask-items.ts +7 -4
- package/src/corpus/ask.ts +1 -1
- package/src/corpus/briefing/actions/confirm.ts +9 -1
- package/src/corpus/briefing/actions/execute.ts +71 -11
- package/src/corpus/briefing/actions/log.ts +1 -1
- package/src/corpus/briefing/actions/seam.ts +18 -2
- package/src/corpus/briefing/actions/types.ts +14 -0
- package/src/corpus/briefing/generate-weekly.ts +4 -0
- package/src/corpus/briefing/generate.ts +4 -0
- package/src/corpus/briefing/index.ts +1 -0
- package/src/corpus/briefing/intent/describe.ts +5 -1
- package/src/corpus/briefing/intent/edits.ts +92 -0
- package/src/corpus/briefing/intent/grammar.ts +3 -0
- package/src/corpus/briefing/intent/ground.ts +5 -1
- package/src/corpus/briefing/intent/match.ts +3 -1
- package/src/corpus/briefing/intent/model.ts +36 -3
- package/src/corpus/briefing/intent/resolve.ts +12 -1
- package/src/corpus/briefing/intent/types.ts +8 -0
- package/src/corpus/briefing/markdown.ts +71 -0
- package/src/corpus/briefing/speak.ts +13 -0
- package/src/corpus/client.ts +40 -146
- package/src/corpus/converse/brain.ts +41 -13
- package/src/corpus/converse/briefing-queue.ts +105 -27
- package/src/corpus/converse/cards.ts +69 -0
- package/src/corpus/converse/client.ts +6 -0
- package/src/corpus/converse/fleet-view.ts +126 -0
- package/src/corpus/converse/fleet.ts +18 -5
- package/src/corpus/converse/followups.ts +12 -2
- package/src/corpus/converse/handle.ts +21 -12
- package/src/corpus/converse/handoff.ts +7 -2
- package/src/corpus/converse/index.ts +11 -3
- package/src/corpus/converse/meeting-config.ts +8 -4
- package/src/corpus/converse/meeting.ts +66 -11
- package/src/corpus/converse/respond.ts +14 -2
- package/src/corpus/converse/roci.ts +13 -0
- package/src/corpus/converse/spoken-form.ts +9 -2
- package/src/corpus/converse/spoken-summary.ts +30 -8
- package/src/corpus/converse/store.ts +2 -0
- package/src/corpus/converse/structure.ts +39 -0
- package/src/corpus/converse/types.ts +14 -1
- package/src/corpus/converse/view.ts +34 -0
- package/src/corpus/entities.ts +2 -0
- package/src/corpus/extract.ts +9 -4
- package/src/corpus/index.ts +2 -0
- package/src/corpus/participants.ts +220 -0
- package/src/corpus/project-basis.ts +23 -0
- package/src/corpus/timeline-events.ts +83 -0
- package/src/corpus/tracker-sort.ts +9 -3
- package/src/corpus/tracker-timeline-client.ts +2 -0
- package/src/corpus/tracker-timeline.ts +4 -0
- package/src/corpus/types.ts +38 -5
- package/src/native/app/__tests__/plan-talk-registry.test.tsx +2 -1
- package/src/native/app/converseServices.ts +5 -3
- package/src/native/app/device.ts +2 -0
- package/src/native/converse/ConverseScreen.tsx +30 -4
- package/src/native/converse/__tests__/liveScreen.test.tsx +35 -2
- package/src/native/converse/__tests__/meetingIO.test.ts +55 -1
- package/src/native/converse/format.ts +2 -2
- package/src/native/converse/io.ts +15 -5
- package/src/native/home/HomeScreen.tsx +1 -1
- package/src/native/home/tab.tsx +1 -2
- package/src/native/plan/PlanTab.tsx +1 -2
- package/src/native/plan/__tests__/plan-tab.test.tsx +5 -5
- package/src/native/talk/TalkTab.tsx +1 -1
- package/src/native/talk/__tests__/talk-tab.test.tsx +1 -1
- package/src/__tests__/home-needs-your-call.test.tsx +0 -65
- package/src/components/pages/tracker/TrackerBoard.tsx +0 -45
- package/src/components/pages/tracker/TrackerToolbar.tsx +0 -44
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* THE PARTICIPANT GRAPH — who is on a record — read out of the tenant's edges
|
|
3
|
+
* (bd startsim-768w.38.18, startsim-o0o6o.2), split out of `client.ts` so that
|
|
4
|
+
* file stops growing and so the Library can ask for it AFTER the rows are up.
|
|
5
|
+
*
|
|
6
|
+
* THE ROWS DO NOT WAIT FOR THIS. It is an edge read plus a walk of the whole
|
|
7
|
+
* party roster, and on a loaded or distant backend that chain was the page: the
|
|
8
|
+
* Library's first rows sat behind relationships and then six serial roster
|
|
9
|
+
* pages (measured, 2026-11-20). `createCorpusApi` therefore lets a caller list
|
|
10
|
+
* documents WITHOUT participants and fetch them separately, and this module
|
|
11
|
+
* reads the roster's tail in PARALLEL once page one has said how long it is.
|
|
12
|
+
*/
|
|
13
|
+
import type { CorpusHttp } from './client';
|
|
14
|
+
import { MAX_ID_LIST, indexParticipants, toParty } from './entities';
|
|
15
|
+
import type { TenantEntity, TenantRelationship, CorpusTypeKeys } from './entities';
|
|
16
|
+
import type { CorpusScope, Party, PartyRef } from './types';
|
|
17
|
+
|
|
18
|
+
interface DrfPage<T> {
|
|
19
|
+
count: number;
|
|
20
|
+
next: string | null;
|
|
21
|
+
previous: string | null;
|
|
22
|
+
results: T[];
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
interface ServerFilterReport {
|
|
26
|
+
applied_filters?: string[];
|
|
27
|
+
appliedFilters?: string[];
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface ParticipantReaderOptions {
|
|
31
|
+
http: CorpusHttp;
|
|
32
|
+
entities: string;
|
|
33
|
+
relationships: string;
|
|
34
|
+
types: CorpusTypeKeys;
|
|
35
|
+
scope: CorpusScope;
|
|
36
|
+
participantEdges: readonly string[];
|
|
37
|
+
maxGraphPages: number;
|
|
38
|
+
graphTtlMs: number;
|
|
39
|
+
resolveParticipants: boolean;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/** Rows asked for per roster read; the tenant caps it, so this is a ceiling. */
|
|
43
|
+
const ROSTER_PAGE_SIZE = 100;
|
|
44
|
+
|
|
45
|
+
export function createParticipantReader(options: ParticipantReaderOptions) {
|
|
46
|
+
const {
|
|
47
|
+
http, entities, relationships, types, scope,
|
|
48
|
+
participantEdges, maxGraphPages, graphTtlMs, resolveParticipants,
|
|
49
|
+
} = options;
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Every page of a DRF list, the TAIL IN PARALLEL: page one says how many rows
|
|
53
|
+
* there are, so pages two to N are asked for together instead of each waiting
|
|
54
|
+
* for the one before. Six serial roster reads were the longest chain on the
|
|
55
|
+
* Library's critical path (273 parties, 50 a page); at 100 a page and in
|
|
56
|
+
* parallel it is two round trips however long the roster gets.
|
|
57
|
+
*
|
|
58
|
+
* Falls back to the serial walk when page one does not report a usable
|
|
59
|
+
* `count`, or when the server hands back fewer rows than the page it was asked
|
|
60
|
+
* for without having said it was the last — a tenant that caps `page_size`
|
|
61
|
+
* lower than requested still walks correctly, just slower.
|
|
62
|
+
*/
|
|
63
|
+
async function readAllParallel<T>(path: string, extra: Record<string, unknown>): Promise<T[]> {
|
|
64
|
+
const first = await http.get<DrfPage<T>>(path, {
|
|
65
|
+
params: { ...extra, page: 1, page_size: ROSTER_PAGE_SIZE },
|
|
66
|
+
});
|
|
67
|
+
const rows: T[] = [...(first?.results ?? [])];
|
|
68
|
+
if (!first?.next || rows.length === 0) return rows;
|
|
69
|
+
const total = Number(first.count);
|
|
70
|
+
const per = rows.length;
|
|
71
|
+
if (!Number.isFinite(total) || total <= per) {
|
|
72
|
+
// No count to plan from: keep walking, one page after the other.
|
|
73
|
+
for (let index = 2; index <= maxGraphPages; index += 1) {
|
|
74
|
+
const response = await http.get<DrfPage<T>>(path, {
|
|
75
|
+
params: { ...extra, page: index, page_size: ROSTER_PAGE_SIZE },
|
|
76
|
+
});
|
|
77
|
+
const results = response?.results ?? [];
|
|
78
|
+
rows.push(...results);
|
|
79
|
+
if (!response?.next || results.length === 0) break;
|
|
80
|
+
}
|
|
81
|
+
return rows;
|
|
82
|
+
}
|
|
83
|
+
const last = Math.min(maxGraphPages, Math.ceil(total / per));
|
|
84
|
+
const rest = await Promise.all(
|
|
85
|
+
Array.from({ length: Math.max(0, last - 1) }, (_, offset) =>
|
|
86
|
+
http.get<DrfPage<T>>(path, {
|
|
87
|
+
params: { ...extra, page: offset + 2, page_size: ROSTER_PAGE_SIZE },
|
|
88
|
+
}),
|
|
89
|
+
),
|
|
90
|
+
);
|
|
91
|
+
for (const response of rest) rows.push(...(response?.results ?? []));
|
|
92
|
+
return rows;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// ---------------------------------------------------------------------
|
|
96
|
+
// the participant graph
|
|
97
|
+
// ---------------------------------------------------------------------
|
|
98
|
+
//
|
|
99
|
+
// THE EDGES OF THE RECORDS ON SCREEN, AND NO OTHERS (bd startsim-o0o6o.2).
|
|
100
|
+
// This used to be `readAll(relationships, {})` — every edge in the workspace,
|
|
101
|
+
// twenty pages of it, on a comment saying the endpoint had no filters. It has
|
|
102
|
+
// them: `entity__in` takes the ids of one page, bounded at `MAX_ID_LIST`,
|
|
103
|
+
// which is the shape `RelationshipQuery`'s own docstring says it exists for.
|
|
104
|
+
//
|
|
105
|
+
// ONE read for a page of records, not one per record — and cached per record,
|
|
106
|
+
// so a screen that lists, opens a row and then asks a question spends it once.
|
|
107
|
+
// It FAILS SOFT: a tenant whose relationships endpoint is missing or refused
|
|
108
|
+
// renders exactly what it rendered before this existed, rather than an error
|
|
109
|
+
// where a Library used to be.
|
|
110
|
+
let roster: { at: number; value: Promise<Party[]> } | null = null;
|
|
111
|
+
const known = new Map<string, { at: number; value: PartyRef[] }>();
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* The people an edge can point AT, read once and reused.
|
|
115
|
+
*
|
|
116
|
+
* Still a walked list, because there is no id filter on `/entities/`: the
|
|
117
|
+
* recognised set is `search`, `source`, `party`, the occurred window,
|
|
118
|
+
* `related_*`, `order` and `attr.*`, and an unrecognised `id__in` would be
|
|
119
|
+
* swept into `ignored_filters` and answered with the whole page. It is at
|
|
120
|
+
* least a TYPED read — `?type=party` is applied server-side — and it is only
|
|
121
|
+
* reached when the narrowed edge read came back with edges to resolve.
|
|
122
|
+
*/
|
|
123
|
+
function partyRoster(): Promise<Party[]> {
|
|
124
|
+
const now = Date.now();
|
|
125
|
+
if (!roster || now - roster.at > graphTtlMs) {
|
|
126
|
+
roster = {
|
|
127
|
+
at: now,
|
|
128
|
+
value: readAllParallel<TenantEntity>(entities, { type: types.party })
|
|
129
|
+
.then((rows) => rows.map((entity) => toParty(entity, scope)))
|
|
130
|
+
.catch(() => []),
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
return roster.value;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* The edges touching these records, or `null` when the server did not confirm
|
|
138
|
+
* it narrowed by them.
|
|
139
|
+
*
|
|
140
|
+
* `null` IS NOT "NO EDGES", and the difference is the whole point. A fork
|
|
141
|
+
* without `RelationshipQuery` accepts `entity__in`, names it in
|
|
142
|
+
* `ignored_filters` and answers with an arbitrary page of the WHOLE edge table
|
|
143
|
+
* (bd startsim-768w.38.39) — rows that look exactly like a narrow answer and
|
|
144
|
+
* would put the wrong people, or a fraction of the right ones, on a record.
|
|
145
|
+
* start-simpli#154 settled what to do with a result the server did not
|
|
146
|
+
* confirm: do not use it. So this reports that it could not ask, and the
|
|
147
|
+
* caller renders what it rendered before the join existed.
|
|
148
|
+
*
|
|
149
|
+
* `rel_type` rides along unchecked on purpose: it only ever makes the answer
|
|
150
|
+
* SMALLER, and `indexParticipants` ranks by edge type anyway. A fork that
|
|
151
|
+
* ignores it pays in PAGES rather than in correctness — a record with many
|
|
152
|
+
* non-participant edges can push its people onto a second page, and the walk
|
|
153
|
+
* below follows `next` until it has them.
|
|
154
|
+
*/
|
|
155
|
+
async function edgesFor(recordIds: string[]): Promise<TenantRelationship[] | null> {
|
|
156
|
+
const rows: TenantRelationship[] = [];
|
|
157
|
+
for (let start = 0; start < recordIds.length; start += MAX_ID_LIST) {
|
|
158
|
+
// CHUNKED, because `_uuid_list` answers a longer list with a 400 rather
|
|
159
|
+
// than truncating it. Truncating here instead would drop the people off
|
|
160
|
+
// the tail of a wide page silently, which is the failure being undone.
|
|
161
|
+
const chunk = recordIds.slice(start, start + MAX_ID_LIST);
|
|
162
|
+
const extra: Record<string, unknown> = {
|
|
163
|
+
entity__in: chunk.join(','),
|
|
164
|
+
page_size: MAX_ID_LIST,
|
|
165
|
+
};
|
|
166
|
+
if (participantEdges.length) extra.rel_type = participantEdges.join(',');
|
|
167
|
+
for (let index = 1; index <= maxGraphPages; index += 1) {
|
|
168
|
+
const response = await http.get<DrfPage<TenantRelationship> & ServerFilterReport>(
|
|
169
|
+
relationships,
|
|
170
|
+
{ params: { ...extra, page: index } },
|
|
171
|
+
);
|
|
172
|
+
const applied = response.applied_filters ?? response.appliedFilters;
|
|
173
|
+
if (!applied?.includes('entity__in')) return null;
|
|
174
|
+
const results = response.results ?? [];
|
|
175
|
+
rows.push(...results);
|
|
176
|
+
if (!response.next || results.length === 0) break;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
return rows;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
async function participantsFor(
|
|
183
|
+
records: Array<string | number>,
|
|
184
|
+
): Promise<Map<string, PartyRef[]>> {
|
|
185
|
+
const out = new Map<string, PartyRef[]>();
|
|
186
|
+
if (!resolveParticipants) return out;
|
|
187
|
+
const now = Date.now();
|
|
188
|
+
const wanted: string[] = [];
|
|
189
|
+
for (const record of records) {
|
|
190
|
+
const id = String(record ?? '').trim();
|
|
191
|
+
if (!id || out.has(id) || wanted.includes(id)) continue;
|
|
192
|
+
const cached = known.get(id);
|
|
193
|
+
if (cached && now - cached.at <= graphTtlMs) out.set(id, cached.value);
|
|
194
|
+
else wanted.push(id);
|
|
195
|
+
}
|
|
196
|
+
if (wanted.length === 0) return out;
|
|
197
|
+
try {
|
|
198
|
+
const edges = await edgesFor(wanted);
|
|
199
|
+
// Could not ask. Nothing is cached, so the next page asks again rather
|
|
200
|
+
// than remembering an answer that was never given.
|
|
201
|
+
if (!edges) return out;
|
|
202
|
+
const parties = edges.length ? await partyRoster() : [];
|
|
203
|
+
const indexed = edges.length
|
|
204
|
+
? indexParticipants(edges, parties, participantEdges)
|
|
205
|
+
: new Map<string, PartyRef[]>();
|
|
206
|
+
for (const id of wanted) {
|
|
207
|
+
// A record the server confirmed has no participant edges is REMEMBERED
|
|
208
|
+
// as having none — otherwise every page re-asks for the same silence.
|
|
209
|
+
const people = indexed.get(id) ?? [];
|
|
210
|
+
known.set(id, { at: now, value: people });
|
|
211
|
+
out.set(id, people);
|
|
212
|
+
}
|
|
213
|
+
} catch {
|
|
214
|
+
// The Library renders without its Parties block rather than not at all.
|
|
215
|
+
}
|
|
216
|
+
return out;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
return { participantsFor };
|
|
220
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WHEN A PROJECT WAS ONLY GUESSED (bd startsim-tmrvi.22).
|
|
3
|
+
*
|
|
4
|
+
* The classifier files each new to-do under the project its topic fits. That is right about two times in
|
|
5
|
+
* three on real notes, and no cheap signal tells the wrong third apart. So instead of asking about every
|
|
6
|
+
* item, the item carries a plain marker and the UI shows the project as a guess with a one-tap change.
|
|
7
|
+
* A project the speaker or the item actually named is not a guess and stays unmarked.
|
|
8
|
+
*/
|
|
9
|
+
export const PROJECT_GUESSED = 'guessed from the topic';
|
|
10
|
+
|
|
11
|
+
export interface ProjectBasisItem {
|
|
12
|
+
title: string;
|
|
13
|
+
detail?: string;
|
|
14
|
+
mentions?: Array<{ quote?: string }>;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/** The basis to store for an item the classifier placed under `projectTitle`, or undefined when it was named. */
|
|
18
|
+
export function projectBasisFor(item: ProjectBasisItem, projectTitle: string, sourceText: string): string | undefined {
|
|
19
|
+
const name = projectTitle.trim().toLowerCase();
|
|
20
|
+
if (!name) return undefined;
|
|
21
|
+
const said = [item.title, item.detail ?? '', ...(item.mentions ?? []).map((m) => m.quote ?? ''), sourceText].join('\n').toLowerCase();
|
|
22
|
+
return said.includes(name) ? undefined : PROJECT_GUESSED;
|
|
23
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* THE TIMELINE TABLE'S ROWS: one plain-language event per thing that happened to a to-do (created, finished,
|
|
3
|
+
* went overdue), with when, who or what did it, and the to-do's CURRENT status. Pure: no clock reads (the caller
|
|
4
|
+
* passes `now`) and no HTTP. The events are derived from the bounded server read; `truncated` says when it was capped.
|
|
5
|
+
*/
|
|
6
|
+
import { dayOf } from './tracker-timeline';
|
|
7
|
+
import type { TimelineKind } from './tracker-timeline';
|
|
8
|
+
import type { TimelineRead } from './tracker-timeline-client';
|
|
9
|
+
import type { CommitmentStatus } from './types';
|
|
10
|
+
|
|
11
|
+
export interface TimelineRow {
|
|
12
|
+
id: string;
|
|
13
|
+
kind: TimelineKind;
|
|
14
|
+
/** "To-do created" / "To-do finished" / "To-do went overdue". */
|
|
15
|
+
what: string;
|
|
16
|
+
title: string;
|
|
17
|
+
/** The to-do's `externalId`, for the link; null when the row did not carry one. */
|
|
18
|
+
externalId: string | null;
|
|
19
|
+
/** Epoch ms of the event (a date-only value is read as midnight UTC). */
|
|
20
|
+
at: number;
|
|
21
|
+
/** The completion day is a guess (no completion stamp). */
|
|
22
|
+
estimated: boolean;
|
|
23
|
+
actor: string;
|
|
24
|
+
status: CommitmentStatus;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export const EVENT_FILTERS = [
|
|
28
|
+
{ value: 'all', label: 'All events' },
|
|
29
|
+
{ value: 'created', label: 'Created' },
|
|
30
|
+
{ value: 'done', label: 'Finished' },
|
|
31
|
+
{ value: 'overdue', label: 'Overdue' },
|
|
32
|
+
] as const;
|
|
33
|
+
|
|
34
|
+
const WHAT: Record<TimelineKind, string> = { created: 'To-do created', done: 'To-do finished', overdue: 'To-do went overdue' };
|
|
35
|
+
const DAY = 86_400_000;
|
|
36
|
+
|
|
37
|
+
/** Who or what did it, in words. An overdue event is nobody's act. */
|
|
38
|
+
export function actorOf(kind: TimelineKind, origin: string | null | undefined): string {
|
|
39
|
+
if (kind === 'overdue') return 'Automatic';
|
|
40
|
+
const o = (origin ?? '').toLowerCase();
|
|
41
|
+
if (o === 'human' || o === 'user') return 'You';
|
|
42
|
+
if (o.includes('extraction') || o.includes('meeting')) return 'Meeting import';
|
|
43
|
+
if (o.includes('sync') || o.includes('linear')) return 'Tracker sync';
|
|
44
|
+
if (o.includes('roci')) return 'Roci';
|
|
45
|
+
if (o.includes('agent')) return 'An agent';
|
|
46
|
+
return 'Tandem';
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/** "3 days ago", "Yesterday", or a short date once it is more than a month back. */
|
|
50
|
+
export function relativeWhen(at: number, now: number): string {
|
|
51
|
+
const ms = now - at;
|
|
52
|
+
if (ms < 10_000) return 'Just now';
|
|
53
|
+
const plural = (n: number, unit: string) => `${n} ${unit}${n === 1 ? '' : 's'} ago`;
|
|
54
|
+
if (ms < 3_600_000) return plural(Math.max(1, Math.floor(ms / 60_000)), 'minute');
|
|
55
|
+
if (ms < DAY) return plural(Math.floor(ms / 3_600_000), 'hour');
|
|
56
|
+
const days = Math.floor(ms / DAY);
|
|
57
|
+
if (days === 1) return 'Yesterday';
|
|
58
|
+
if (days <= 30) return plural(days, 'day');
|
|
59
|
+
return new Date(at).toLocaleDateString('en-US', { month: 'short', day: 'numeric', timeZone: 'UTC' });
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export function timelineEvents(read: TimelineRead, now: number, timeZone: string, rangeDays: number): TimelineRow[] {
|
|
63
|
+
const cutoff = now - rangeDays * DAY;
|
|
64
|
+
const out: TimelineRow[] = [];
|
|
65
|
+
const push = (kind: TimelineKind, item: TimelineRead['items'][number], when: string | null, estimated = false) => {
|
|
66
|
+
if (!when || !dayOf(when, timeZone)) return;
|
|
67
|
+
const at = Date.parse(when);
|
|
68
|
+
if (!Number.isFinite(at) || at < cutoff || at > now + DAY) return;
|
|
69
|
+
out.push({
|
|
70
|
+
id: `${kind}:${item.id}`, kind, what: WHAT[kind], title: item.title, externalId: item.externalId ?? null, at, estimated,
|
|
71
|
+
actor: actorOf(kind, item.origin), status: item.status,
|
|
72
|
+
});
|
|
73
|
+
};
|
|
74
|
+
for (const item of read.items) {
|
|
75
|
+
push('created', item, item.firstSeenAt);
|
|
76
|
+
if (item.status === 'done') {
|
|
77
|
+
if (item.resolvedAt) push('done', item, item.resolvedAt);
|
|
78
|
+
else push('done', item, item.updatedAt, true);
|
|
79
|
+
}
|
|
80
|
+
if (item.status !== 'done' && item.status !== 'dropped' && item.dueAt && Date.parse(item.dueAt) < now) push('overdue', item, item.dueAt);
|
|
81
|
+
}
|
|
82
|
+
return out.sort((a, b) => b.at - a.at);
|
|
83
|
+
}
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
*/
|
|
10
10
|
import type { Commitment, CommitmentSort } from './types';
|
|
11
11
|
|
|
12
|
-
type Sortable = Pick<Commitment, 'title' | 'ownerName' | 'dueAt' | 'lastSeenAt' | 'firstSeenAt'> & { priority?: number };
|
|
12
|
+
type Sortable = Pick<Commitment, 'title' | 'ownerName' | 'dueAt' | 'lastSeenAt' | 'firstSeenAt' | 'status'> & { priority?: number };
|
|
13
13
|
|
|
14
14
|
export const DEFAULT_TRACKER_SORT: CommitmentSort = 'due';
|
|
15
15
|
|
|
@@ -19,11 +19,15 @@ export const TRACKER_SORTS: ReadonlyArray<{ key: CommitmentSort; label: string;
|
|
|
19
19
|
{ key: 'newest', label: 'Newest first', order: '-attr.first_seen_at' },
|
|
20
20
|
{ key: 'title', label: 'Title (A to Z)', order: 'attr.title' },
|
|
21
21
|
{ key: 'owner', label: 'Owner (A to Z)', order: 'attr.owner_name' },
|
|
22
|
+
{ key: 'status', label: 'Status', order: 'attr.status' },
|
|
22
23
|
];
|
|
23
24
|
|
|
24
25
|
/** The server `order=` value for a sort key. */
|
|
25
|
-
export function commitmentOrder(sort: CommitmentSort = DEFAULT_TRACKER_SORT): string {
|
|
26
|
-
|
|
26
|
+
export function commitmentOrder(sort: CommitmentSort = DEFAULT_TRACKER_SORT, dir?: 'asc' | 'desc'): string {
|
|
27
|
+
const order = (TRACKER_SORTS.find((s) => s.key === sort) ?? TRACKER_SORTS[0]).order;
|
|
28
|
+
if (!dir) return order;
|
|
29
|
+
const bare = order.replace(/^-/, '');
|
|
30
|
+
return dir === 'desc' ? `-${bare}` : bare;
|
|
27
31
|
}
|
|
28
32
|
|
|
29
33
|
const text = (v: string | undefined | null) => (v ?? '').trim().toLowerCase();
|
|
@@ -42,6 +46,8 @@ export function compareCommitments(sort: CommitmentSort = DEFAULT_TRACKER_SORT)
|
|
|
42
46
|
return (b.firstSeenAt ?? '').localeCompare(a.firstSeenAt ?? '') || byDue;
|
|
43
47
|
case 'title':
|
|
44
48
|
return text(a.title).localeCompare(text(b.title)) || byDue;
|
|
49
|
+
case 'status':
|
|
50
|
+
return text(a.status).localeCompare(text(b.status)) || byDue;
|
|
45
51
|
case 'owner':
|
|
46
52
|
return blankLast(text(a.ownerName), text(b.ownerName)) || byDue;
|
|
47
53
|
default:
|
|
@@ -55,6 +55,8 @@ function toItem(row: Wire) {
|
|
|
55
55
|
const status = String(data.status ?? 'open');
|
|
56
56
|
return {
|
|
57
57
|
id: String(row.id),
|
|
58
|
+
externalId: text(row as Record<string, unknown>, 'external_id', 'externalId'),
|
|
59
|
+
origin: text(data, '_origin'),
|
|
58
60
|
title: text(data, 'title') ?? (typeof row.name === 'string' && row.name ? row.name : 'Untitled item'),
|
|
59
61
|
status: (STATUSES.includes(status) ? status : 'open') as CommitmentStatus,
|
|
60
62
|
dueAt: text(data, 'due_at', 'dueAt'),
|
|
@@ -34,6 +34,10 @@ export interface ValueCount { value: string | null; count: number }
|
|
|
34
34
|
/** The slice of a to-do the timeline needs; dates are as stored. */
|
|
35
35
|
export interface TimelineItem {
|
|
36
36
|
id: string;
|
|
37
|
+
/** The to-do's own `externalId`, the key the detail page opens by. */
|
|
38
|
+
externalId?: string | null;
|
|
39
|
+
/** `_origin`: who wrote the row (human, tenant-extraction, a sync...). */
|
|
40
|
+
origin?: string | null;
|
|
37
41
|
title: string;
|
|
38
42
|
status: CommitmentStatus;
|
|
39
43
|
dueAt: string | null;
|
package/src/corpus/types.ts
CHANGED
|
@@ -389,16 +389,41 @@ export interface FolderQuery {
|
|
|
389
389
|
pageSize?: number;
|
|
390
390
|
}
|
|
391
391
|
|
|
392
|
+
export interface ListDocumentsOptions {
|
|
393
|
+
/** `false`: skip the people read and return the rows alone. Default `true`. */
|
|
394
|
+
participants?: boolean;
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
export interface ListSourcesOptions {
|
|
398
|
+
/** Receives `source key -> document count` once the counts have been read. */
|
|
399
|
+
onCounts?: (counts: Map<string, number | null>) => void;
|
|
400
|
+
}
|
|
401
|
+
|
|
392
402
|
/**
|
|
393
403
|
* What the composers are handed. An app implements it over its own HTTP client;
|
|
394
404
|
* `createCorpusApi` in `./client` does that for the tenant `/api/v1/*` endpoints.
|
|
395
405
|
*/
|
|
396
406
|
export interface CorpusApi {
|
|
397
|
-
|
|
407
|
+
/**
|
|
408
|
+
* One page of documents. `options.participants: false` returns the rows WITHOUT
|
|
409
|
+
* resolving who is on them, so the first paint waits for one read and not for
|
|
410
|
+
* an edge read plus the party roster; pair it with `participantsFor` to fill
|
|
411
|
+
* the people in afterwards. Omitted, behaviour is unchanged.
|
|
412
|
+
*/
|
|
413
|
+
listDocuments(query: DocumentQuery, options?: ListDocumentsOptions): Promise<CorpusPage<SourceDocument>>;
|
|
414
|
+
/**
|
|
415
|
+
* The people on these records, by record id. Optional: an adapter without it
|
|
416
|
+
* simply never defers, and `listDocuments` keeps returning them inline.
|
|
417
|
+
*/
|
|
418
|
+
participantsFor?(recordIds: Array<string | number>): Promise<Map<string, PartyRef[]>>;
|
|
398
419
|
getDocument(id: string): Promise<SourceDocument>;
|
|
399
420
|
listParties(query?: { search?: string; page?: number; pageSize?: number }): Promise<CorpusPage<Party>>;
|
|
400
|
-
/**
|
|
401
|
-
|
|
421
|
+
/**
|
|
422
|
+
* Per-source freshness, for the strip at the top of the Library. With
|
|
423
|
+
* `options.onCounts` the cards come back as soon as the connections do, with
|
|
424
|
+
* `documentCount: null`, and the per-source totals arrive through the callback.
|
|
425
|
+
*/
|
|
426
|
+
listSources(options?: ListSourcesOptions): Promise<SourceFreshness[]>;
|
|
402
427
|
/**
|
|
403
428
|
* THE CHILD FOLDERS of one container, paginated (bd startsim-ei8gm.5).
|
|
404
429
|
*
|
|
@@ -717,6 +742,8 @@ export interface Commitment {
|
|
|
717
742
|
estimateMinutes?: number;
|
|
718
743
|
/** Why `dueAt` is what it is: what was said, or the plan it was assumed from. */
|
|
719
744
|
dueBasis?: string;
|
|
745
|
+
/** Set when the project this item is filed under was only guessed from its topic; cleared once a person confirms or changes it. */
|
|
746
|
+
projectBasis?: string;
|
|
720
747
|
/** 0..1 */
|
|
721
748
|
dueConfidence?: number;
|
|
722
749
|
/**
|
|
@@ -882,13 +909,15 @@ export interface ResolutionClaim {
|
|
|
882
909
|
|
|
883
910
|
/** Server-side filters for the tracking surface (CLAUDE.md rule 8). */
|
|
884
911
|
/** How the tracker orders a page of to-dos; see `tracker-sort.ts`. */
|
|
885
|
-
export type CommitmentSort = 'due' | 'updated' | 'newest' | 'title' | 'owner';
|
|
912
|
+
export type CommitmentSort = 'due' | 'updated' | 'newest' | 'title' | 'owner' | 'status';
|
|
886
913
|
|
|
887
914
|
export interface CommitmentQuery {
|
|
888
915
|
/** Server-side order. Default `due`. */
|
|
889
916
|
sort?: CommitmentSort;
|
|
917
|
+
/** Flip the order of `sort`. Absent: the sort's own natural direction. */
|
|
918
|
+
sortDir?: 'asc' | 'desc';
|
|
890
919
|
status?: CommitmentStatus | CommitmentStatus[];
|
|
891
|
-
subtype?: CommitmentSubtype;
|
|
920
|
+
subtype?: CommitmentSubtype | CommitmentSubtype[];
|
|
892
921
|
owner?: string;
|
|
893
922
|
/** ISO instants over `dueAt`. */
|
|
894
923
|
dueBefore?: string;
|
|
@@ -951,6 +980,10 @@ export interface CommitmentApi {
|
|
|
951
980
|
visibility?: 'private' | null;
|
|
952
981
|
/** `null` clears it (undoing a voice-set priority). */
|
|
953
982
|
priority?: number | null;
|
|
983
|
+
/** `null` clears the "project was guessed" marker once a person has confirmed or changed it. */
|
|
984
|
+
projectBasis?: string | null;
|
|
985
|
+
/** Minutes; `null` clears it. */
|
|
986
|
+
estimateMinutes?: number | null;
|
|
954
987
|
}): Promise<Commitment>;
|
|
955
988
|
/**
|
|
956
989
|
* A person adding an item nobody said in a meeting.
|
|
@@ -59,7 +59,8 @@ describe('the Tandem Go tab set', () => {
|
|
|
59
59
|
const text = allText(r);
|
|
60
60
|
expect(text).toContain('Today');
|
|
61
61
|
expect(r.root.findAllByProps({ testID: 'briefing-play' }).length).toBeGreaterThan(0);
|
|
62
|
-
expect(text).toContain('Your morning brief and what is due soon.');
|
|
62
|
+
expect(text).not.toContain('Your morning brief and what is due soon.');
|
|
63
|
+
expect(text).not.toContain('Your workspace');
|
|
63
64
|
expect(r.root.findAllByProps({ testID: 'home-talk' }).length).toBeGreaterThan(0);
|
|
64
65
|
expect(r.root.findAllByProps({ testID: 'home-due-soon' }).length).toBeGreaterThan(0);
|
|
65
66
|
expect(maybeById(r, 'home-record')).toHaveLength(0);
|
|
@@ -37,7 +37,9 @@ export function createConverse(deps: {
|
|
|
37
37
|
const dev = device.briefing;
|
|
38
38
|
if (!dev) throw new Error('features.converse needs a playback driver (device.briefing.driver)');
|
|
39
39
|
const inspector = dev.session ?? rec.session;
|
|
40
|
-
|
|
40
|
+
// A duplex driver means the recorder is echo-cancelled and the mic can stay open while the reply plays.
|
|
41
|
+
const duplex = !fake && !!dev.duplexDriver;
|
|
42
|
+
const player = createAudioPlayer({ driver: duplex && dev.duplexDriver ? dev.duplexDriver : dev.driver, session: inspector, diag, poll: tick, sleep: wait });
|
|
41
43
|
const speed = createSpeedStore({ path: device.documentUri('converse-speed.json'), files: device.files });
|
|
42
44
|
player.setRate(speed.get());
|
|
43
45
|
speed.subscribe((r) => player.setRate(r));
|
|
@@ -56,13 +58,13 @@ export function createConverse(deps: {
|
|
|
56
58
|
? fakes.api
|
|
57
59
|
: createNativeMeetingApi({ tandemUrl: config.tenant.url, authorizedFetch: session.authorizedFetch, bearer: session.bearer, filePart: rec.filePart });
|
|
58
60
|
const real = createMeetingIO({
|
|
59
|
-
api, audio, speaker: player, removeFile: rec.removeFile, ensurePermission: permissions.ensure, diag,
|
|
61
|
+
api, audio, speaker: player, removeFile: rec.removeFile, ensurePermission: permissions.ensure, diag, duplex,
|
|
60
62
|
onBroken: (h) => { broken = h; },
|
|
61
63
|
});
|
|
62
64
|
const io = fakes ? (fakeSound ? { listen: fakes.io.listen, speak: real.speak } : fakes.io) : real;
|
|
63
65
|
const controller = createMeetingController({
|
|
64
66
|
client: api, io, config: deps.meeting,
|
|
65
|
-
onChange: (s) => diag.log('meeting.state', { phase: s.phase, error: s.error, noAudio: s.noAudio }),
|
|
67
|
+
onChange: (s) => diag.log('meeting.state', { phase: s.phase, micLive: s.micLive, error: s.error, noAudio: s.noAudio }),
|
|
66
68
|
});
|
|
67
69
|
return { controller, player, speed };
|
|
68
70
|
}
|
package/src/native/app/device.ts
CHANGED
|
@@ -30,6 +30,8 @@ export interface RecordingDevice {
|
|
|
30
30
|
/** The device bindings of 'What's on the plate' (expo-audio playback). */
|
|
31
31
|
export interface BriefingDevice {
|
|
32
32
|
driver: AudioPlayerDriver;
|
|
33
|
+
/** A player that shares the recorder's playAndRecord session (never reconfigures or deactivates it). With it the Converse mic stays open while the reply plays (barge-in). Without it Converse stops listening to speak. */
|
|
34
|
+
duplexDriver?: AudioPlayerDriver;
|
|
33
35
|
/** Audio-session facts and events; defaults to the recording bindings' inspector. */
|
|
34
36
|
session?: SessionInspector;
|
|
35
37
|
/** What `-tgFakeBriefing` plays: a bundled clip, since the fake briefing has no server behind it. */
|
|
@@ -4,6 +4,7 @@ import { Alert, Button, Header, Icon, MessageBubble, Spinner, useHaptics, useThe
|
|
|
4
4
|
import { useControllerState } from '../components/useControllerState';
|
|
5
5
|
import type { MeetingController, MeetingLine } from '../../corpus/converse/meeting';
|
|
6
6
|
import type { ConverseSource } from '../../corpus/converse/types';
|
|
7
|
+
import { converseView } from '../../corpus/converse/view';
|
|
7
8
|
import { statusLine } from './format';
|
|
8
9
|
import { SPEEDS, speedLabel, type SpeedStore } from './speed';
|
|
9
10
|
|
|
@@ -35,10 +36,7 @@ export function ConverseScreen({ controller, speed, embedded, onOpenSource }: {
|
|
|
35
36
|
const list = useRef<FlatList<MeetingLine>>(null);
|
|
36
37
|
const lines = s.lines;
|
|
37
38
|
// `micOn` is the preference (true even before anything has started): it is listening only while a conversation is running.
|
|
38
|
-
const listening
|
|
39
|
-
const thinking = s.phase === 'thinking';
|
|
40
|
-
const speaking = s.phase === 'speaking';
|
|
41
|
-
const busy = s.phase === 'ending';
|
|
39
|
+
const { listening, thinking, speaking, busy, canStop } = converseView(s);
|
|
42
40
|
// A conversation is open while the mic listens, a turn runs, or there is a thread that has not been filed (typing still works with the mic off).
|
|
43
41
|
const open = listening || thinking || speaking || s.phase === 'stopped' || (lines.length > 0 && s.phase !== 'ended' && s.phase !== 'ending');
|
|
44
42
|
const sec = useElapsed(s.phase === 'listening');
|
|
@@ -104,6 +102,34 @@ export function ConverseScreen({ controller, speed, embedded, onOpenSource }: {
|
|
|
104
102
|
{s.phase === 'ended' ? null : <Button testID="converse-end" title="Done" variant="outline" size="sm" disabled={busy} onPress={() => { haptic('warning', 'converse.end'); void controller.end(); }} />}
|
|
105
103
|
</View>
|
|
106
104
|
) : null}
|
|
105
|
+
{canStop ? (
|
|
106
|
+
<Pressable
|
|
107
|
+
testID="converse-stop"
|
|
108
|
+
accessibilityRole="button"
|
|
109
|
+
accessibilityLabel="Stop"
|
|
110
|
+
onPress={() => { haptic('warning', 'converse.stop'); controller.stop(); }}
|
|
111
|
+
style={{ alignSelf: 'stretch', minHeight: MIC, borderRadius: MIC / 2, backgroundColor: theme.colors.destructive, alignItems: 'center', justifyContent: 'center', flexDirection: 'row', gap: theme.spacing.sm }}
|
|
112
|
+
>
|
|
113
|
+
<View style={{ width: 16, height: 16, borderRadius: 3, backgroundColor: theme.colors.primaryForeground }} />
|
|
114
|
+
<RNText style={{ color: theme.colors.primaryForeground, fontSize: theme.fontSizes.lg, fontWeight: '700' }}>Stop</RNText>
|
|
115
|
+
</Pressable>
|
|
116
|
+
) : null}
|
|
117
|
+
<View testID="converse-mode" style={{ flexDirection: 'row', alignSelf: 'center', gap: theme.spacing.xs }}>
|
|
118
|
+
{([['voice', 'Voice', listening], ['text', 'Text', !listening]] as const).map(([key, label, on]) => (
|
|
119
|
+
<Pressable
|
|
120
|
+
key={key}
|
|
121
|
+
testID={`converse-mode-${key}`}
|
|
122
|
+
accessibilityRole="button"
|
|
123
|
+
accessibilityLabel={key === 'voice' ? 'Talk by voice' : 'Type instead'}
|
|
124
|
+
accessibilityState={{ selected: on }}
|
|
125
|
+
disabled={busy}
|
|
126
|
+
onPress={() => { if (on) return; haptic('medium', `converse.mode-${key}`); controller.mic(key === 'voice'); }}
|
|
127
|
+
style={{ paddingHorizontal: theme.spacing.lg, paddingVertical: theme.spacing.xs, borderRadius: 999, backgroundColor: on ? theme.colors.primary : theme.colors.muted }}
|
|
128
|
+
>
|
|
129
|
+
<RNText style={{ color: on ? theme.colors.primaryForeground : theme.colors.foreground, fontSize: theme.fontSizes.sm, fontWeight: '600' }}>{label}</RNText>
|
|
130
|
+
</Pressable>
|
|
131
|
+
))}
|
|
132
|
+
</View>
|
|
107
133
|
<View style={{ flexDirection: 'row', alignItems: 'center', gap: theme.spacing.sm }}>
|
|
108
134
|
<TextInput
|
|
109
135
|
testID="converse-input"
|
|
@@ -10,9 +10,9 @@ const base = { micOn: false, retryable: false, lines: [{ role: 'user', text: 'pl
|
|
|
10
10
|
const make = (phase: string, micPreference = false) => {
|
|
11
11
|
const state = { ...base, phase, micOn: phase !== 'idle' || phase === 'idle' && micPreference };
|
|
12
12
|
const mics: boolean[] = [];
|
|
13
|
-
const calls = { end: 0, start: 0, text: [] as string[] };
|
|
13
|
+
const calls = { end: 0, start: 0, stop: 0, text: [] as string[] };
|
|
14
14
|
const controller = {
|
|
15
|
-
start() { calls.start += 1; }, mic(on: boolean) { mics.push(on); }, end: async () => { calls.end += 1; return null; }, replay: async () => {}, sendText: async (t: string) => { calls.text.push(t); }, dismissNotice() {},
|
|
15
|
+
start() { calls.start += 1; }, stop() { calls.stop += 1; }, mic(on: boolean) { mics.push(on); }, end: async () => { calls.end += 1; return null; }, replay: async () => {}, sendText: async (t: string) => { calls.text.push(t); }, dismissNotice() {},
|
|
16
16
|
getState: () => state, state: () => state, subscribe: () => () => undefined,
|
|
17
17
|
} as unknown as MeetingController;
|
|
18
18
|
return { controller, calls, mics };
|
|
@@ -89,3 +89,36 @@ describe('Converse while a meeting runs', () => {
|
|
|
89
89
|
expect(JSON.stringify(r.toJSON())).toContain('Filed: 2 to-dos');
|
|
90
90
|
});
|
|
91
91
|
});
|
|
92
|
+
|
|
93
|
+
describe('Stop button and Voice/Text switch', () => {
|
|
94
|
+
it('Stop is visible while the reply is spoken and while it is thought about, and stops it', async () => {
|
|
95
|
+
for (const phase of ['speaking', 'thinking']) {
|
|
96
|
+
const { controller, calls } = make(phase);
|
|
97
|
+
const r = render(<ConverseScreen controller={controller} />);
|
|
98
|
+
await act(async () => { hostById(r, 'converse-stop').props.onPress(); });
|
|
99
|
+
expect(calls.stop).toBe(1);
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
it('Stop is not shown when nothing is being said', () => {
|
|
103
|
+
const { controller } = make('listening');
|
|
104
|
+
const r = render(<ConverseScreen controller={controller} />);
|
|
105
|
+
expect(maybeById(r, 'converse-stop')).toHaveLength(0);
|
|
106
|
+
});
|
|
107
|
+
it('the mic stays on screen and tappable while it speaks', () => {
|
|
108
|
+
const { controller } = make('speaking');
|
|
109
|
+
const r = render(<ConverseScreen controller={controller} />);
|
|
110
|
+
expect(hostById(r, 'converse-mic').props.disabled).toBeFalsy();
|
|
111
|
+
});
|
|
112
|
+
it('Text turns the mic off and Voice turns it on', async () => {
|
|
113
|
+
const live = make('listening');
|
|
114
|
+
const r = render(<ConverseScreen controller={live.controller} />);
|
|
115
|
+
expect(hostById(r, 'converse-mode-voice').props.accessibilityState).toEqual({ selected: true });
|
|
116
|
+
await act(async () => { hostById(r, 'converse-mode-text').props.onPress(); });
|
|
117
|
+
expect(live.mics).toEqual([false]);
|
|
118
|
+
const off = make('idle');
|
|
119
|
+
const r2 = render(<ConverseScreen controller={off.controller} />);
|
|
120
|
+
expect(hostById(r2, 'converse-mode-text').props.accessibilityState).toEqual({ selected: true });
|
|
121
|
+
await act(async () => { hostById(r2, 'converse-mode-voice').props.onPress(); });
|
|
122
|
+
expect(off.mics).toEqual([true]);
|
|
123
|
+
});
|
|
124
|
+
});
|