@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.
Files changed (147) hide show
  1. package/package.json +7 -7
  2. package/src/__tests__/briefing-actions.test.ts +11 -0
  3. package/src/__tests__/briefing-edits.test.ts +98 -0
  4. package/src/__tests__/briefing-markdown.test.ts +64 -0
  5. package/src/__tests__/converse-brain.test.ts +64 -1
  6. package/src/__tests__/converse-cards.test.ts +53 -0
  7. package/src/__tests__/converse-handoff.test.ts +8 -0
  8. package/src/__tests__/converse-meeting-brief.test.ts +72 -8
  9. package/src/__tests__/converse-meeting-duplex.test.ts +132 -0
  10. package/src/__tests__/converse-meeting-keep-speech.test.ts +87 -0
  11. package/src/__tests__/converse-meeting-vad.test.ts +1 -1
  12. package/src/__tests__/converse-page.test.tsx +148 -37
  13. package/src/__tests__/converse-roci.test.ts +22 -0
  14. package/src/__tests__/converse-spoken-form.test.ts +10 -0
  15. package/src/__tests__/converse-spoken-summary.test.ts +27 -6
  16. package/src/__tests__/converse-structure.test.ts +27 -0
  17. package/src/__tests__/converse-view.test.ts +46 -0
  18. package/src/__tests__/converse.test.ts +29 -2
  19. package/src/__tests__/corpus-ask.test.ts +22 -0
  20. package/src/__tests__/corpus-tracker.test.tsx +42 -174
  21. package/src/__tests__/data-table-logic.test.ts +75 -0
  22. package/src/__tests__/data-table.test.tsx +133 -0
  23. package/src/__tests__/extract-classify.test.ts +17 -0
  24. package/src/__tests__/fleet-page.test.tsx +57 -0
  25. package/src/__tests__/fleet-view.test.ts +149 -0
  26. package/src/__tests__/home-brief.test.tsx +25 -40
  27. package/src/__tests__/library-call-shape.test.tsx +164 -0
  28. package/src/__tests__/load-error.test.tsx +1 -1
  29. package/src/__tests__/mini-markdown.test.tsx +24 -0
  30. package/src/__tests__/overview-page.test.tsx +36 -6
  31. package/src/__tests__/plan-shell.test.tsx +6 -4
  32. package/src/__tests__/project-basis-entity.test.ts +19 -0
  33. package/src/__tests__/project-basis.test.ts +21 -0
  34. package/src/__tests__/relay-cli.test.ts +10 -1
  35. package/src/__tests__/task-detail-project-guess.test.tsx +46 -0
  36. package/src/__tests__/timeline-events.test.ts +65 -0
  37. package/src/__tests__/timeline-table.test.tsx +66 -0
  38. package/src/__tests__/todo-table-model.test.ts +75 -0
  39. package/src/__tests__/todo-table.test.tsx +202 -0
  40. package/src/__tests__/tracker-timeline-component.test.tsx +4 -4
  41. package/src/__tests__/tracker-timeline-reader.test.ts +1 -1
  42. package/src/comms/__tests__/app-sends-page.test.tsx +69 -0
  43. package/src/comms/api/comms.ts +23 -0
  44. package/src/comms/components/ResultsPanel.tsx +2 -2
  45. package/src/comms/components/SendLog.tsx +20 -8
  46. package/src/comms/components/index.ts +1 -0
  47. package/src/comms/components/pages/AppSendsPage.tsx +58 -0
  48. package/src/comms/hooks/index.ts +8 -3
  49. package/src/components/FolderTree.tsx +12 -3
  50. package/src/components/index.ts +4 -1
  51. package/src/components/pages/ConversePage.tsx +114 -105
  52. package/src/components/pages/FleetPage.tsx +115 -0
  53. package/src/components/pages/LibraryPage.tsx +63 -24
  54. package/src/components/pages/TaskDetailPage.tsx +27 -1
  55. package/src/components/pages/TrackerPage.tsx +170 -474
  56. package/src/components/pages/converse/CardView.tsx +72 -0
  57. package/src/components/pages/converse/SettingsMenu.tsx +37 -0
  58. package/src/components/pages/converse/Thread.tsx +48 -33
  59. package/src/components/pages/converse/useNeedsYou.ts +60 -0
  60. package/src/components/pages/home/BriefCard.tsx +16 -7
  61. package/src/components/pages/home/HomeBriefPage.tsx +6 -91
  62. package/src/components/pages/home/MiniMarkdown.tsx +51 -0
  63. package/src/components/pages/home/{DueSoonLine.tsx → dueSoonText.ts} +2 -11
  64. package/src/components/pages/home/index.ts +1 -1
  65. package/src/components/pages/overview/OverviewPage.tsx +46 -83
  66. package/src/components/pages/plan/TalkPage.tsx +5 -14
  67. package/src/components/pages/plan/TimelinePage.tsx +4 -2
  68. package/src/components/pages/task-tracker/ProjectGuess.tsx +42 -0
  69. package/src/components/pages/tracker/SweepPanel.tsx +108 -0
  70. package/src/components/pages/tracker/TimelineTable.tsx +70 -0
  71. package/src/components/pages/tracker/TrackerTimeline.tsx +32 -15
  72. package/src/components/table/DataTable.tsx +92 -0
  73. package/src/components/table/RowMenu.tsx +35 -0
  74. package/src/components/table/TablePagination.tsx +63 -0
  75. package/src/components/table/TableToolbar.tsx +56 -0
  76. package/src/components/table/TodoTable.tsx +142 -0
  77. package/src/components/table/index.ts +10 -0
  78. package/src/components/table/table-logic.ts +60 -0
  79. package/src/components/table/todo-model.ts +93 -0
  80. package/src/corpus/ask-items.ts +7 -4
  81. package/src/corpus/ask.ts +1 -1
  82. package/src/corpus/briefing/actions/confirm.ts +9 -1
  83. package/src/corpus/briefing/actions/execute.ts +71 -11
  84. package/src/corpus/briefing/actions/log.ts +1 -1
  85. package/src/corpus/briefing/actions/seam.ts +18 -2
  86. package/src/corpus/briefing/actions/types.ts +14 -0
  87. package/src/corpus/briefing/generate-weekly.ts +4 -0
  88. package/src/corpus/briefing/generate.ts +4 -0
  89. package/src/corpus/briefing/index.ts +1 -0
  90. package/src/corpus/briefing/intent/describe.ts +5 -1
  91. package/src/corpus/briefing/intent/edits.ts +92 -0
  92. package/src/corpus/briefing/intent/grammar.ts +3 -0
  93. package/src/corpus/briefing/intent/ground.ts +5 -1
  94. package/src/corpus/briefing/intent/match.ts +3 -1
  95. package/src/corpus/briefing/intent/model.ts +36 -3
  96. package/src/corpus/briefing/intent/resolve.ts +12 -1
  97. package/src/corpus/briefing/intent/types.ts +8 -0
  98. package/src/corpus/briefing/markdown.ts +71 -0
  99. package/src/corpus/briefing/speak.ts +13 -0
  100. package/src/corpus/client.ts +40 -146
  101. package/src/corpus/converse/brain.ts +41 -13
  102. package/src/corpus/converse/briefing-queue.ts +105 -27
  103. package/src/corpus/converse/cards.ts +69 -0
  104. package/src/corpus/converse/client.ts +6 -0
  105. package/src/corpus/converse/fleet-view.ts +126 -0
  106. package/src/corpus/converse/fleet.ts +18 -5
  107. package/src/corpus/converse/followups.ts +12 -2
  108. package/src/corpus/converse/handle.ts +21 -12
  109. package/src/corpus/converse/handoff.ts +7 -2
  110. package/src/corpus/converse/index.ts +11 -3
  111. package/src/corpus/converse/meeting-config.ts +8 -4
  112. package/src/corpus/converse/meeting.ts +66 -11
  113. package/src/corpus/converse/respond.ts +14 -2
  114. package/src/corpus/converse/roci.ts +13 -0
  115. package/src/corpus/converse/spoken-form.ts +9 -2
  116. package/src/corpus/converse/spoken-summary.ts +30 -8
  117. package/src/corpus/converse/store.ts +2 -0
  118. package/src/corpus/converse/structure.ts +39 -0
  119. package/src/corpus/converse/types.ts +14 -1
  120. package/src/corpus/converse/view.ts +34 -0
  121. package/src/corpus/entities.ts +2 -0
  122. package/src/corpus/extract.ts +9 -4
  123. package/src/corpus/index.ts +2 -0
  124. package/src/corpus/participants.ts +220 -0
  125. package/src/corpus/project-basis.ts +23 -0
  126. package/src/corpus/timeline-events.ts +83 -0
  127. package/src/corpus/tracker-sort.ts +9 -3
  128. package/src/corpus/tracker-timeline-client.ts +2 -0
  129. package/src/corpus/tracker-timeline.ts +4 -0
  130. package/src/corpus/types.ts +38 -5
  131. package/src/native/app/__tests__/plan-talk-registry.test.tsx +2 -1
  132. package/src/native/app/converseServices.ts +5 -3
  133. package/src/native/app/device.ts +2 -0
  134. package/src/native/converse/ConverseScreen.tsx +30 -4
  135. package/src/native/converse/__tests__/liveScreen.test.tsx +35 -2
  136. package/src/native/converse/__tests__/meetingIO.test.ts +55 -1
  137. package/src/native/converse/format.ts +2 -2
  138. package/src/native/converse/io.ts +15 -5
  139. package/src/native/home/HomeScreen.tsx +1 -1
  140. package/src/native/home/tab.tsx +1 -2
  141. package/src/native/plan/PlanTab.tsx +1 -2
  142. package/src/native/plan/__tests__/plan-tab.test.tsx +5 -5
  143. package/src/native/talk/TalkTab.tsx +1 -1
  144. package/src/native/talk/__tests__/talk-tab.test.tsx +1 -1
  145. package/src/__tests__/home-needs-your-call.test.tsx +0 -65
  146. package/src/components/pages/tracker/TrackerBoard.tsx +0 -45
  147. package/src/components/pages/tracker/TrackerToolbar.tsx +0 -44
@@ -1,52 +1,38 @@
1
1
  /**
2
- * THE TRACKING SURFACE — what came out of your meetings and is still owed
3
- * (bd startsim-768w.38.25).
2
+ * THE TO-DO LIST — what came out of your meetings (and what you typed) and is still owed.
4
3
  *
5
- * `<TrackerPage api={trackerApi} scope={scope} />`, the same injected shape as
6
- * `ConnectionsPage`, `LibraryPage` and `AskPage`. The app owns className slots
7
- * and a wrapper; extraction happens behind `api.extract`, server-side, where the
8
- * provider key is. Nothing in this file imports a provider.
4
+ * `<TrackerPage api={trackerApi} scope={scope} />`, the same injected shape as `ConnectionsPage`,
5
+ * `LibraryPage` and `AskPage`. The app owns className slots and a wrapper; extraction happens behind
6
+ * `api.extract`, server-side, where the provider key is. Nothing in this file imports a provider.
9
7
  *
10
- * THE SCREEN ANSWERS FOUR QUESTIONS and nothing else, because those are the four
11
- * a person actually has: what is outstanding, who owns it, what is overdue, and
12
- * what changed since last week. Everything on it is either one of those or the
13
- * evidence for one of those.
8
+ * ONE TOOLBAR, ONE TABLE (Quinn, 2026-11-20): a search box, Status and Project dropdowns and a single
9
+ * filled "+ Add to-do"; then `TodoTable` with sortable headers and the shared pagination footer. No
10
+ * pill rows, no second status, no groups or boards or folds: Status "Done" is how finished work is read.
14
11
  *
15
- * EVERY ROW IS TRACEABLE, for exactly the reason `AskPage` enforces citations:
16
- * an item nobody can trace back to something a person said is an item nobody
17
- * will act on. So each row carries the meetings it came from, the verbatim quote
18
- * from each, and a click-through to the record. A commitment with no mention
19
- * cannot be rendered, because it cannot exist.
12
+ * EVERYTHING IS A SERVER PARAMETER (CLAUDE.md rule 8): search, status, project, sort, direction, page and
13
+ * page size all go out in `todoQuery`, so the list never loads in one piece, and the screen SAYS SO when the
14
+ * deployment's data API does not honour a filter (same `appliedFilters` mechanism the Library uses).
20
15
  *
21
- * FILTERS ARE SERVER PARAMETERS (CLAUDE.md rule 8) and the screen SAYS SO when
22
- * the deployment's data API does not honour one — same `appliedFilters`
23
- * mechanism the Library uses. A status filter that silently does nothing is
24
- * worse on this screen than on any other: the whole product claim is "this is
25
- * what is still open".
16
+ * THE LOAD EFFECT IS KEYED ON THE SERIALISED QUERY with the api held in a ref: this component has already
17
+ * shipped one request runaway (917 requests in ten minutes), and a table that re-read on every render or
18
+ * keystroke would be a second. Search is debounced before it becomes a query.
26
19
  */
27
20
  import * as React from 'react';
28
21
 
29
22
  import { LoadError } from '../LoadError';
30
23
 
31
- import { isStalled, runProgress } from '../../corpus/runs';
32
- import { isOverdue } from '../../corpus/work-item-logic';
24
+ import { isStalled } from '../../corpus/runs';
33
25
  import { useTrackerName } from '../../task-tracker/useTrackerName';
34
26
  import type { MemberConnectionsApi } from './types';
35
27
  import { failureMessage, unfilteredMessage } from './work-items';
36
- import { CompactItemRow } from './home/CompactItemRow';
37
28
  import { PossiblyDoneNote, markDonePatch, notDonePatch } from './tracker/PossiblyDone';
38
- import { TrackerBoard } from './tracker/TrackerBoard';
29
+ import { SweepPanel } from './tracker/SweepPanel';
39
30
  import { TrackerTimeline } from './tracker/TrackerTimeline';
40
31
  import { filterFromChip } from '../../corpus/tracker-timeline';
41
- import { TrackerToolbar, type TrackerView } from './tracker/TrackerToolbar';
42
- import { DEFAULT_TRACKER_SORT } from '../../corpus/tracker-sort';
43
- import { STALE_DAYS, groupTracker } from '../../corpus/tracker-groups';
44
- import type { TrackerEntry } from '../../corpus/tracker-groups';
32
+ import { FilterSelect, TableToolbar, TodoTable, TODO_STATUS_FILTERS, readPageSize, todoQuery, writePageSize } from '../table';
33
+ import type { PageSize, TableSort } from '../table';
45
34
  import type {
46
35
  Commitment,
47
- CommitmentQuery,
48
- CommitmentSort,
49
- CommitmentStatus,
50
36
  CommitmentTrackerApi,
51
37
  CorpusScope,
52
38
  ExtractionRun,
@@ -141,6 +127,11 @@ const DEFAULTS: Record<TrackerSlot, string> = {
141
127
  /** States the poll stops at. A finished run is a record, not a subscription. */
142
128
  const TERMINAL_RUN = new Set(['succeeded', 'failed', 'cancelled']);
143
129
 
130
+
131
+ const SEARCH_DEBOUNCE_MS = 300;
132
+ /** A quiet text button, so the filled "+ Add to-do" stays the only strong control on the page. */
133
+ const QUIET = 'h-9 rounded-md px-2 text-sm text-gray-600 hover:text-gray-900 hover:underline disabled:opacity-50 dark:text-gray-300';
134
+
144
135
  export function TrackerPage({
145
136
  api,
146
137
  scope,
@@ -167,116 +158,72 @@ export function TrackerPage({
167
158
  const [mountedAt] = React.useState(() => Date.now());
168
159
  const clock = now ?? mountedAt;
169
160
 
170
- /**
171
- * The api is an injected CAPABILITY, not data, so its identity is not a reason
172
- * to re-read the same query — and an app that builds it inline must not turn
173
- * that mistake into a runaway. Held in a ref and read at call time; a genuine
174
- * change of workspace re-reads through `scope.orgId` below.
175
- */
161
+ /** The api is an injected CAPABILITY, not data: held in a ref and read at call time. */
176
162
  const apiRef = React.useRef(api);
177
163
  apiRef.current = api;
178
164
 
179
165
  const [rows, setRows] = React.useState<Commitment[]>([]);
180
166
  const [total, setTotal] = React.useState(0);
181
- const [pageNo, setPageNo] = React.useState(1);
182
- const [loadingMore, setLoadingMore] = React.useState(false);
183
167
  const [applied, setApplied] = React.useState<string[]>([]);
168
+ /** Whether the workspace holds ANY to-do at all: tells a fresh workspace from one with nothing owed. */
169
+ const [workspaceHasAny, setWorkspaceHasAny] = React.useState<boolean | null>(null);
184
170
  const [loading, setLoading] = React.useState(true);
185
171
  const [error, setError] = React.useState('');
186
- // a failed LOAD (offer Try again, hide the counts) is different from a failed action on one row (keep the plain message)
172
+ // a failed LOAD (offer Try again) is different from a failed action on one row (keep the plain message)
187
173
  const [loadFailed, setLoadFailed] = React.useState(false);
188
174
  const [running, setRunning] = React.useState(false);
189
- /**
190
- * The SWEEP, when this deployment runs extraction as a job
191
- * (bd startsim-768w.38.28). `run` is one synchronous slice's result; this is
192
- * the durable record of a long one, polled from the server.
193
- */
175
+ /** The SWEEP, when this deployment runs extraction as a job (bd startsim-768w.38.28). */
194
176
  const [sweep, setSweep] = React.useState<ExtractionRun | null>(null);
195
177
  const [starting, setStarting] = React.useState(false);
196
- /** Finished items, read only when the Done fold is opened (a second, server-filtered read). */
197
- const [doneRows, setDoneRows] = React.useState<Commitment[] | null>(null);
198
- const [doneOpen, setDoneOpen] = React.useState(false);
199
- const [workspaceHasAny, setWorkspaceHasAny] = React.useState<boolean | null>(null);
200
178
 
201
- const [sort, setSort] = React.useState<CommitmentSort>(DEFAULT_TRACKER_SORT);
202
- const [view, setView] = React.useState<TrackerView>('list');
203
-
204
- const query = React.useMemo<CommitmentQuery>(
205
- () => ({
206
- sort,
207
- // Everything still owed, one server page, with each item's project. The
208
- // groups below are computed over this set; the count says when it is only
209
- // the first page.
210
- status: ['open', 'in_progress', 'blocked'] as CommitmentStatus[],
211
- withFocus: true,
212
- ...(focusId ? { focus: focusId } : {}),
213
- pageSize: 200,
214
- }),
215
- [sort, focusId],
179
+ const [searchText, setSearchText] = React.useState(initialSearch ?? '');
180
+ const [search, setSearch] = React.useState(initialSearch ?? '');
181
+ const [status, setStatus] = React.useState('open');
182
+ const [project, setProject] = React.useState('');
183
+ const [sort, setSort] = React.useState<TableSort | null>(null);
184
+ const [page, setPage] = React.useState(1);
185
+ const [pageSize, setPageSizeState] = React.useState<PageSize>(() => readPageSize('todos'));
186
+
187
+ // The typed text becomes a server query only after a pause, and starts again from page one.
188
+ React.useEffect(() => {
189
+ if (searchText === search) return undefined;
190
+ const timer = setTimeout(() => { setSearch(searchText); setPage(1); }, SEARCH_DEBOUNCE_MS);
191
+ return () => clearTimeout(timer);
192
+ }, [searchText, search]);
193
+
194
+ const query = React.useMemo(
195
+ () => todoQuery({ search, status, project, sort, page, pageSize }, focusId),
196
+ [search, status, project, sort, page, pageSize, focusId],
216
197
  );
217
198
 
218
199
  const load = React.useCallback(async () => {
219
200
  setLoading(true);
220
201
  setError('');
221
202
  setLoadFailed(false);
222
- setLoadFailed(false);
223
203
  try {
224
- const page = await apiRef.current.listCommitments(query);
225
- setRows(page.results);
226
- setPageNo(1);
227
- setTotal(page.count);
228
- setApplied(page.appliedFilters ?? []);
229
- if (page.results.length > 0) {
204
+ const result = await apiRef.current.listCommitments(query);
205
+ setRows(result.results);
206
+ setTotal(result.count);
207
+ setApplied(result.appliedFilters ?? []);
208
+ if (result.results.length > 0) {
230
209
  setWorkspaceHasAny(true);
231
- } else {
232
- const any = await apiRef.current
233
- .listCommitments({ pageSize: 1 })
234
- .then((probe) => probe.count > 0)
235
- .catch(() => null);
210
+ } else if (!query.search && !query.focus && query.page === 1) {
211
+ const any = await apiRef.current.listCommitments({ pageSize: 1 }).then((probe) => probe.count > 0).catch(() => null);
236
212
  setWorkspaceHasAny(any);
237
213
  }
238
214
  } catch (err) {
239
215
  setRows([]);
240
216
  setError(failureMessage(err));
241
217
  setLoadFailed(true);
242
- setLoadFailed(true);
243
218
  } finally {
244
219
  setLoading(false);
245
220
  }
246
221
  }, [query]);
247
222
 
248
- /** The next SERVER page of what is owed, appended; the list never loads in one piece. */
249
- const loadMore = React.useCallback(async () => {
250
- setLoadingMore(true);
251
- try {
252
- const next = pageNo + 1;
253
- const page = await apiRef.current.listCommitments({ ...query, page: next });
254
- setRows((prev) => {
255
- const seen = new Set(prev.map((r) => r.externalId));
256
- return [...prev, ...page.results.filter((r) => !seen.has(r.externalId))];
257
- });
258
- setPageNo(next);
259
- setTotal(page.count);
260
- } catch (err) {
261
- setError(failureMessage(err));
262
- } finally {
263
- setLoadingMore(false);
264
- }
265
- }, [pageNo, query]);
266
-
267
- const loadDone = React.useCallback(async () => {
268
- try {
269
- const page = await apiRef.current.listCommitments({ status: ['done', 'dropped'], withFocus: true, pageSize: 50 });
270
- setDoneRows(page.results);
271
- } catch (err) {
272
- setError(failureMessage(err));
273
- }
274
- }, []);
275
-
276
-
277
223
  // Real input only: the query the user asked for, and the workspace they are in.
278
224
  React.useEffect(() => { void load(); }, [load, scope.orgId]);
279
225
 
226
+
280
227
  /**
281
228
  * WATCH THE SWEEP, and pick one up that was already going.
282
229
  *
@@ -291,17 +238,6 @@ export function TrackerPage({
291
238
  * once already.
292
239
  */
293
240
  const canQueue = Boolean(api.startExtraction && api.getExtractionRun);
294
- /**
295
- * The reader, and the last state we saw, held in REFS.
296
- *
297
- * Neither is an input to the poll. `load` changes whenever the tab or the
298
- * owner filter changes, and a poll that restarts on a tab click is a poll that
299
- * fires an extra request per click; the last-seen status is compared inside
300
- * the tick rather than through a state updater, because a side effect inside a
301
- * `setState` updater runs twice under StrictMode. Same discipline as the
302
- * frozen clock above, and for the same reason: this component has already
303
- * shipped one runaway.
304
- */
305
241
  const loadRef = React.useRef(load);
306
242
  loadRef.current = load;
307
243
  const clockRef = React.useRef(clock);
@@ -369,28 +305,12 @@ export function TrackerPage({
369
305
  // `sweepEpoch` re-arms the poll after the button starts a new one.
370
306
  }, [canQueue, pollMs, maxAutoResumes, scope.orgId, sweepEpoch]);
371
307
 
372
- const [filterText, setFilterText] = React.useState(initialSearch ?? '');
373
- type QuickKey = 'all' | 'overdue' | 'blocked' | 'in_progress';
374
- const [quick, setQuick] = React.useState<QuickKey>('all');
375
- /** Client-side narrowing over the loaded page: title, owner, subject or project name. */
376
- const matches = React.useCallback((r: Commitment) => {
377
- if (quick === 'overdue' && !isOverdue(r, clock)) return false;
378
- if (quick === 'blocked' && r.status !== 'blocked') return false;
379
- if (quick === 'in_progress' && r.status !== 'in_progress') return false;
380
- const q = filterText.trim().toLowerCase();
381
- if (!q) return true;
382
- const project = r.focusId ? projectNames[r.focusId] ?? '' : '';
383
- return [r.title, r.ownerName, r.subject, project, r.detail].some((v) => (v ?? '').toLowerCase().includes(q));
384
- }, [filterText, quick, clock, projectNames]);
385
- const filtering = filterText.trim().length > 0 || quick !== 'all';
386
- const groups = React.useMemo(
387
- () => groupTracker(rows.filter(matches), { now: clock, timeZone, sort }),
388
- [rows, matches, clock, timeZone, sort],
389
- );
390
- const doneGroups = React.useMemo(
391
- () => (doneRows ? groupTracker(doneRows.filter(matches), { now: clock, timeZone }).done : []),
392
- [doneRows, matches, clock, timeZone],
393
- );
308
+
309
+ const canWrite = Boolean(api.updateCommitment);
310
+ const canAdd = Boolean(api.createCommitment);
311
+ const [adding, setAdding] = React.useState(false);
312
+ const [draftTitle, setDraftTitle] = React.useState('');
313
+ const [saving, setSaving] = React.useState(false);
394
314
 
395
315
  /** One write, then the list is re-read: the server is the source of what is owed. */
396
316
  const act = React.useCallback(async (item: Commitment, patch: Parameters<NonNullable<CommitmentTrackerApi['updateCommitment']>>[1]) => {
@@ -398,377 +318,153 @@ export function TrackerPage({
398
318
  try {
399
319
  await apiRef.current.updateCommitment!(item, patch);
400
320
  await loadRef.current();
401
- if (doneOpen) await loadDone();
402
321
  } catch (err) {
403
322
  setError(failureMessage(err));
404
323
  }
405
- }, [doneOpen, loadDone]);
406
- const canWrite = Boolean(api.updateCommitment);
407
- const canAdd = Boolean(api.createCommitment);
408
- const [draftTitle, setDraftTitle] = React.useState('');
409
- const [adding, setAdding] = React.useState(false);
324
+ }, []);
325
+
410
326
  /** Quick-add: a title is enough; everything else is edited on the detail page. */
411
327
  const addTodo = async () => {
412
328
  const title = draftTitle.trim();
413
- if (!title || adding) return;
414
- setAdding(true);
329
+ if (!title || saving) return;
330
+ setSaving(true);
415
331
  setError('');
416
332
  try {
417
333
  await apiRef.current.createCommitment!({ title, ...(focusId ? { focusId } : {}) });
418
334
  setDraftTitle('');
335
+ setAdding(false);
419
336
  await loadRef.current();
420
337
  } catch (err) {
421
338
  setError(failureMessage(err));
422
339
  } finally {
423
- setAdding(false);
340
+ setSaving(false);
424
341
  }
425
342
  };
343
+
426
344
  const open = (item: Commitment) => {
427
345
  if (onOpenItem) { onOpenItem(item); return; }
428
346
  const doc = item.mentions[0]?.documentId;
429
347
  if (doc) onOpenDocument?.(doc);
430
348
  };
431
-
349
+ const snoozeTo = (days: number) => new Date(clock + days * 86_400_000).toISOString().slice(0, 10);
432
350
 
433
351
  const sweepBusy = Boolean(sweep && (sweep.status === 'queued' || sweep.status === 'running'));
434
352
  // A run whose lease has lapsed is not running, whatever its status field says.
435
- // Rendering it as "in progress" is a spinner that never ends.
436
353
  const sweepStalled = Boolean(sweep && isStalled(sweep, clock));
354
+ const filtering = search.trim().length > 0 || status !== 'open' || Boolean(project);
437
355
 
438
- const sections: Array<{ key: 'today' | 'inProgress' | 'upNext' | 'later' | 'noDate'; label: string }> = [
439
- { key: 'today', label: 'Today' },
440
- { key: 'inProgress', label: 'In progress' },
441
- { key: 'upNext', label: 'Up next' },
442
- { key: 'later', label: 'Later' },
443
- { key: 'noDate', label: 'No date' },
356
+ const projectOptions = [
357
+ { value: '', label: 'All projects' },
358
+ ...Object.entries(projectNames).map(([value, label]) => ({ value, label })),
444
359
  ];
445
- const c = groups.counts;
446
- const owed = c.today + c.inProgress + c.upNext + c.later + c.noDate;
447
- const rowFor = (entry: TrackerEntry, extra?: { actions?: React.ReactNode; chip?: string }) => (
448
- <CompactItemRow
449
- key={entry.item.externalId}
450
- item={entry.item} due={entry.due} days={entry.days}
451
- project={extra?.chip ?? (entry.item.focusId ? projectNames[entry.item.focusId] : undefined)}
452
- trackerName={trackerName}
453
- onOpen={onOpenItem || entry.item.mentions.length ? open : undefined}
454
- actions={extra?.actions}
455
- below={canWrite ? (
456
- <PossiblyDoneNote
457
- item={entry.item}
458
- onMarkDone={(it, c) => void act(it, markDonePatch(c))}
459
- onNotDone={(it, c) => void act(it, notDonePatch(it, c))}
460
- />
461
- ) : undefined}
462
- />
463
- );
464
- const btn = 'rounded border border-gray-300 px-2 py-0.5 text-xs text-gray-700 hover:border-gray-400';
465
- const fold = 'rounded-lg border border-gray-200 bg-white';
466
- const foldSummary = 'cursor-pointer list-none px-4 py-3 text-sm font-medium text-gray-900';
467
- const snoozeTo = (days: number) => new Date(clock + days * 86_400_000).toISOString().slice(0, 10);
360
+ const resetPage = <T,>(set: (v: T) => void) => (v: T) => { set(v); setPage(1); };
361
+
362
+ const pullButton = canQueue ? (
363
+ /**
364
+ * THE BUTTON NO LONGER WAITS, because it cannot: seventeen meetings is about six minutes of model
365
+ * time and the tenant gateway closes a request at sixty seconds. It starts the job and the screen
366
+ * watches it (bd startsim-768w.38.28).
367
+ */
368
+ <button
369
+ type="button" className={QUIET} disabled={starting || sweepBusy}
370
+ onClick={async () => {
371
+ setStarting(true);
372
+ setError('');
373
+ try {
374
+ const started = await apiRef.current.startExtraction!({ scope });
375
+ setSweep(started);
376
+ setSweepEpoch((epoch) => epoch + 1);
377
+ } catch (err) {
378
+ setError(failureMessage(err));
379
+ } finally {
380
+ setStarting(false);
381
+ }
382
+ }}
383
+ >
384
+ {sweepStalled ? 'Resume reading your meetings' : sweepBusy ? 'Reading your meetings…' : 'Pull from meetings'}
385
+ </button>
386
+ ) : api.extract ? (
387
+ <button
388
+ type="button" className={QUIET} disabled={running}
389
+ onClick={async () => {
390
+ setRunning(true);
391
+ setError('');
392
+ try {
393
+ await apiRef.current.extract!({ scope });
394
+ await load();
395
+ } catch (err) {
396
+ setError(failureMessage(err));
397
+ } finally {
398
+ setRunning(false);
399
+ }
400
+ }}
401
+ >
402
+ {running ? 'Reading your meetings…' : 'Pull from meetings'}
403
+ </button>
404
+ ) : null;
405
+
406
+ /**
407
+ * A data API that ignores the status filter must not make finished work look owed: the page is narrowed
408
+ * here as well, and the warning says the server did not do it. (A server that applied it is trusted.)
409
+ */
410
+ const wanted = query.status;
411
+ const shown = wanted && !applied.includes('status') ? rows.filter((r) => wanted.includes(r.status)) : rows;
412
+ const warning = unfilteredMessage(['status'] as const, applied, query);
468
413
 
469
414
  return (
470
415
  <div className={cn.root}>
471
- {canAdd ? (
472
- <form className="flex gap-2" onSubmit={(e) => { e.preventDefault(); void addTodo(); }}>
473
- <input
474
- className={`${cn.input} flex-1`} value={draftTitle} disabled={adding}
475
- onChange={(e) => setDraftTitle(e.target.value)}
476
- placeholder="Add a to-do…" aria-label="Add a to-do"
477
- />
478
- <button type="submit" className={cn.secondaryButton} disabled={adding || !draftTitle.trim()}>Add</button>
479
- </form>
480
- ) : null}
481
- {rows.length > 0 ? (
482
- <input
483
- type="search" className={`${cn.input} w-full`} value={filterText}
484
- onChange={(e) => setFilterText(e.target.value)}
485
- placeholder="Filter to-dos by title, owner or project…" aria-label="Filter to-dos"
486
- />
487
- ) : null}
488
- {rows.length > 0 ? (
489
- <div className="flex flex-wrap gap-2" role="group" aria-label="Quick filters">
490
- {([['all', 'All'], ['overdue', 'Overdue'], ['blocked', 'Blocked'], ['in_progress', 'In progress']] as Array<[QuickKey, string]>).map(([key, label]) => (
491
- <button
492
- key={key} type="button" aria-pressed={quick === key} onClick={() => setQuick(key)}
493
- className={`rounded-full border px-3 py-1 text-xs ${quick === key ? 'border-gray-900 bg-gray-900 text-white' : 'border-gray-300 text-gray-700'}`}
494
- >{label}</button>
495
- ))}
496
- </div>
497
- ) : null}
416
+ <TableToolbar
417
+ search={searchText} onSearch={setSearchText} searchLabel="Search to-dos" searchPlaceholder="Search to-dos"
418
+ action={canAdd ? { label: 'Add to-do', onClick: () => setAdding(true) } : undefined}
419
+ >
420
+ <FilterSelect label="Status" value={status} options={[...TODO_STATUS_FILTERS]} onChange={resetPage(setStatus)} />
421
+ {focusId ? null : <FilterSelect label="Project" value={project} options={projectOptions} onChange={resetPage(setProject)} />}
422
+ {pullButton}
423
+ </TableToolbar>
424
+
498
425
  {showTimeline && api.timeline ? (
499
- <TrackerTimeline
500
- api={api} orgId={scope.orgId} now={clock} timeZone={timeZone}
501
- filter={filterFromChip(quick, { search: filterText })}
502
- />
503
- ) : null}
504
- {filtering && owed === 0 && rows.length > 0 ? <p className={cn.muted}>No to-dos match{filterText.trim() ? ` “${filterText.trim()}”` : ' this filter'}.</p> : null}
505
- {rows.length > 0 ? (
506
- <TrackerToolbar sort={sort} onSort={setSort} view={view} onView={setView} inputClassName={cn.input} />
507
- ) : null}
508
- <div className="flex flex-wrap items-center gap-3">
509
- <p className={cn.muted} data-testid="tracker-summary">
510
- {loading ? 'Loading…' : loadFailed ? '' : `${owed} owed · ${c.today} today · ${c.inProgress} in progress`}
511
- </p>
512
- <div className="ml-auto">
513
- {canQueue ? (
514
- /**
515
- * THE BUTTON NO LONGER WAITS, because it cannot: seventeen meetings
516
- * is about six minutes of model time and the tenant gateway closes a
517
- * request at sixty seconds. It starts the job and the screen watches
518
- * it (bd startsim-768w.38.28).
519
- */
520
- <button
521
- type="button"
522
- className={cn.secondaryButton}
523
- disabled={starting || sweepBusy}
524
- onClick={async () => {
525
- setStarting(true);
526
- setError('');
527
- try {
528
- const started = await apiRef.current.startExtraction!({ scope });
529
- setSweep(started);
530
- setSweepEpoch((epoch) => epoch + 1);
531
- } catch (err) {
532
- setError(failureMessage(err));
533
- } finally {
534
- setStarting(false);
535
- }
536
- }}
537
- >
538
- {sweepStalled ? 'Resume reading your meetings' : sweepBusy ? 'Reading your meetings…' : 'Pull from meetings'}
539
- </button>
540
- ) : api.extract ? (
541
- <button
542
- type="button"
543
- className={cn.secondaryButton}
544
- disabled={running}
545
- onClick={async () => {
546
- setRunning(true);
547
- setError('');
548
- try {
549
- await apiRef.current.extract!({ scope });
550
- await load();
551
- } catch (err) {
552
- setError(failureMessage(err));
553
- } finally {
554
- setRunning(false);
555
- }
556
- }}
557
- >
558
- {running ? 'Reading your meetings…' : 'Pull from meetings'}
559
- </button>
560
- ) : null}
561
- </div>
562
- </div>
563
-
564
- {unfilteredMessage(['status'] as const, applied, query) ? (
565
- // One quiet chip, not a paragraph over the list: the sentence is a click away.
566
- <details className="text-xs text-amber-900">
567
- <summary className="inline-flex cursor-pointer list-none rounded-full border border-amber-300 bg-amber-50 px-2.5 py-0.5 font-medium">1 warning</summary>
568
- <p className={`mt-2 ${cn.warning}`} role="status">{unfilteredMessage(['status'] as const, applied, query)}</p>
569
- </details>
426
+ <TrackerTimeline api={api} orgId={scope.orgId} now={clock} timeZone={timeZone} filter={filterFromChip('all', { search })} />
570
427
  ) : null}
428
+
429
+ {warning ? <p className={cn.warning} role="status">{warning}</p> : null}
571
430
  {error ? (loadFailed ? <LoadError what="your to-dos" message={error} onRetry={() => void load()} /> : <p className={cn.error} role="alert">{error}</p>) : null}
572
431
  {sweep ? <SweepPanel sweep={sweep} now={clock} classNames={cn} /> : null}
573
432
 
574
- {!loading && owed === 0 && c.stale === 0 && !filtering ? (
575
- <p className={cn.muted}>
576
- {workspaceHasAny === false
577
- ? 'Nothing has been pulled out of your meetings yet. Connect a source, then run “Pull from meetings”.'
578
- : 'Nothing is owed right now.'}
579
- </p>
580
- ) : null}
581
-
582
- {view === 'board' ? (
583
- <TrackerBoard
584
- entries={[...groups.today, ...groups.inProgress, ...groups.upNext, ...groups.later, ...groups.noDate, ...groups.stale]}
585
- sort={sort}
586
- headingClassName={cn.heading} mutedClassName={cn.muted}
587
- renderRow={(entry) => rowFor(entry, canWrite ? {
588
- actions: <button type="button" className={btn} onClick={() => void act(entry.item, { status: 'done' })}>Mark done</button>,
589
- } : undefined)}
590
- />
591
- ) : null}
592
-
593
- {view === 'list' ? sections.map(({ key, label }) => (groups[key].length ? (
594
- <section key={key} aria-label={label} className="space-y-1">
595
- <h2 className={`flex items-baseline gap-2 ${cn.heading}`}>
596
- {label} <span className="text-sm font-normal text-gray-500">{c[key]}</span>
597
- </h2>
598
- <ul>
599
- {groups[key].map((entry) => rowFor(entry, canWrite ? {
600
- actions: <button type="button" className={btn} onClick={() => void act(entry.item, { status: 'done' })}>Mark done</button>,
601
- } : undefined))}
602
- </ul>
603
- </section>
604
- ) : null)) : null}
605
-
606
- {total > rows.length ? (
607
- <p className={cn.muted}>
608
- Showing {rows.length} of {total} open items.{' '}
609
- <button type="button" className="text-blue-700 underline disabled:opacity-50" disabled={loadingMore} onClick={() => void loadMore()}>
610
- {loadingMore ? 'Loading…' : 'Load more'}
611
- </button>
612
- </p>
613
- ) : null}
614
-
615
- {c.stale && view === 'list' ? (
616
- <details className={fold}>
617
- <summary className={foldSummary}>Stale ({c.stale})
618
- <span className="ml-2 text-xs font-normal text-gray-500">no date, not touched in {STALE_DAYS}+ days</span>
619
- </summary>
620
- <div className="px-4 pb-3">
621
- {canWrite ? (
622
- <button type="button" className={`${btn} mb-2`} onClick={async () => {
623
- for (const entry of groups.stale) await apiRef.current.updateCommitment!(entry.item, { status: 'dropped', statusReason: 'Archived as stale' });
624
- await load();
625
- }}>Archive all {c.stale}</button>
626
- ) : null}
627
- <ul>
628
- {groups.stale.map((entry) => rowFor(entry, canWrite ? {
629
- actions: (
630
- <>
631
- <button type="button" className={btn} onClick={() => void act(entry.item, { status: 'dropped', statusReason: 'Archived as stale' })}>Archive</button>
632
- <button type="button" className={btn} onClick={() => void act(entry.item, { dueAt: snoozeTo(30) })}>Snooze 30d</button>
633
- </>
634
- ),
635
- } : undefined))}
636
- </ul>
637
- </div>
638
- </details>
639
- ) : null}
640
-
641
- {c.statements ? (
642
- <details className={fold}>
643
- <summary className={foldSummary}>Decisions and questions ({c.statements})
644
- <span className="ml-2 text-xs font-normal text-gray-500">said in meetings, not owed by anyone</span>
645
- </summary>
646
- <ul className="px-4 pb-3">{groups.statements.map((entry) => rowFor(entry, { chip: entry.item.subtype }))}</ul>
647
- </details>
648
- ) : null}
649
-
650
- <details
651
- className={fold}
652
- onToggle={(event) => {
653
- const isOpen = (event.currentTarget as HTMLDetailsElement).open;
654
- setDoneOpen(isOpen);
655
- if (isOpen && doneRows === null) void loadDone();
656
- }}
657
- >
658
- <summary className={foldSummary}>Done{doneRows ? ` (${doneGroups.length})` : ''}</summary>
659
- <ul className="px-4 pb-3">
660
- {doneRows === null ? <li className={cn.muted}>Loading…</li> : doneGroups.length === 0 ? <li className={cn.muted}>Nothing finished yet.</li> : doneGroups.map((entry) => rowFor(entry))}
661
- </ul>
662
- </details>
663
- </div>
664
- );
665
-
666
- }
667
-
668
- // ---------------------------------------------------------------------------
669
-
670
- /**
671
- * A SWEEP IN FLIGHT, and afterwards what it did (bd startsim-768w.38.28).
672
- *
673
- * The old button blocked on a call that could not finish, so the only states it
674
- * ever had were "spinning" and "504". A six-minute job has four states a person
675
- * actually needs, and every one of them is a sentence rather than a spinner:
676
- *
677
- * GOING how far, out of what, and that it survives leaving the page. A
678
- * progress bar with no denominator is a spinner with extra steps.
679
- * STALLED the driver went away — a container replacement, usually. Said out
680
- * loud with a Resume, because a sweep that silently stops looking
681
- * busy is the worst of the four.
682
- * DONE what it wrote, AND whether the model actually answered.
683
- * FAILED why, and what it kept. Partial progress is progress and nobody
684
- * should start over by hand because the screen did not say so.
685
- *
686
- * THE MODEL LINE IS THE POINT OF THE BEAD. `fromModel: 0` used to be the entire
687
- * report of a blown provider timeout, and it reads exactly like "the model found
688
- * nothing to add". It is not allowed to render that way any more: if the model
689
- * did not answer, this says so, says it timed out when it did, and names how many
690
- * meetings got only the deterministic pass.
691
- */
692
- function SweepPanel({
693
- sweep, now, classNames: cn,
694
- }: {
695
- sweep: ExtractionRun;
696
- now: number;
697
- classNames: Record<TrackerSlot, string>;
698
- }) {
699
- const progress = runProgress(sweep);
700
- const stalled = isStalled(sweep, now);
701
- const busy = (sweep.status === 'queued' || sweep.status === 'running') && !stalled;
702
- const totals = sweep.totals;
703
- const failure = sweep.lastModelFailure;
704
-
705
- // A finished run leaves nothing on the page: the list is the result.
706
- if (sweep.status === 'succeeded') return null;
707
-
708
- return (
709
- <div className={cn.card} role="status" aria-live="polite">
710
- {busy || stalled ? (
711
- <>
712
- <p className="text-sm text-gray-800">
713
- Reading your meetings — {progress.done} of {progress.total} meetings
714
- {totals.created > 0 ? `, ${totals.created} items so far` : ''}.
715
- </p>
716
- <div className={`mt-2 ${cn.progressTrack}`}>
717
- <div className={cn.progressBar} style={{ width: `${Math.max(progress.percent, 2)}%` }} />
433
+ <TodoTable
434
+ items={shown} now={clock} timeZone={timeZone} projectNames={projectNames} trackerName={trackerName} hideProject={Boolean(focusId)}
435
+ onOpen={onOpenItem || shown.some((r) => r.mentions.length) ? open : undefined}
436
+ onToggleDone={canWrite ? (item, done) => void act(item, { status: done ? 'done' : 'open' }) : undefined}
437
+ onSnooze={canWrite ? (item) => void act(item, { dueAt: snoozeTo(7) }) : undefined}
438
+ onDrop={canWrite ? (item) => void act(item, { status: 'dropped', statusReason: 'Dropped from the list' }) : undefined}
439
+ below={canWrite ? (item) => (
440
+ <PossiblyDoneNote
441
+ item={item}
442
+ onMarkDone={(it, c) => void act(it, markDonePatch(c))}
443
+ onNotDone={(it, c) => void act(it, notDonePatch(it, c))}
444
+ />
445
+ ) : undefined}
446
+ sort={sort} onSort={resetPage(setSort)}
447
+ page={page} pageSize={pageSize} total={total} onPage={setPage}
448
+ onPageSize={(size) => { writePageSize('todos', size); setPageSizeState(size); setPage(1); }}
449
+ loading={loading}
450
+ emptyMessage={loadFailed ? '' : filtering ? 'No to-dos match.'
451
+ : workspaceHasAny === false ? 'Nothing has been pulled out of your meetings yet. Connect a source, then run “Pull from meetings”.'
452
+ : 'Nothing is owed right now.'}
453
+ topRow={adding ? (
454
+ <div className="flex items-center gap-2">
455
+ <input
456
+ autoFocus aria-label="New to-do title" placeholder="What needs doing?" value={draftTitle} disabled={saving}
457
+ onChange={(e) => setDraftTitle(e.target.value)}
458
+ onKeyDown={(e) => {
459
+ if (e.key === 'Enter') { e.preventDefault(); void addTodo(); }
460
+ if (e.key === 'Escape') { setAdding(false); setDraftTitle(''); }
461
+ }}
462
+ className="h-8 flex-1 rounded-md border border-gray-300 bg-white px-2.5 text-sm text-gray-900 dark:border-gray-600 dark:bg-gray-900 dark:text-gray-100"
463
+ />
464
+ <span className="text-xs text-gray-500">Enter to add · Esc to cancel</span>
718
465
  </div>
719
- </>
720
- ) : null}
721
-
722
- {busy ? (
723
- <p className={`mt-2 ${cn.muted}`}>
724
- {/* The single most useful sentence on the screen: it removes the
725
- reason somebody sits and watches, or presses the button again. */}
726
- This keeps going if you close this page. Come back and it will still be here.
727
- </p>
728
- ) : null}
729
-
730
- {stalled ? (
731
- <p className={`mt-2 ${cn.warning}`}>
732
- This run stopped before it finished — the process that was doing the work went
733
- away. Everything it had already read is saved. Resume picks up at meeting{' '}
734
- {progress.done + 1}, not at the beginning.
735
- </p>
736
- ) : null}
737
-
738
- {sweep.status === 'failed' ? (
739
- <p className={cn.error}>
740
- This run stopped: {sweep.error || 'the workspace could not be reached'}. It kept
741
- everything it had already read — {progress.done} of {progress.total} meetings,{' '}
742
- {totals.created} items. Running it again carries on from there.
743
- </p>
744
- ) : null}
745
-
746
- {totals.modelFailures > 0 ? (
747
- <p className={`mt-2 ${cn.warning}`} role="status">
748
- {/* NOT `fromModel: 0` on its own. That reading — "nothing to add" —
749
- is what hid a week of degraded runs. */}
750
- On {totals.modelFailures} of {totals.modelFailures + totals.modelCalls} passes the model
751
- did not answer
752
- {failure?.timedOut ? ' — it timed out' : failure ? ` — ${failure.message}` : ''}. Those{' '}
753
- {sweep.modelIncompleteIds.length} meeting
754
- {sweep.modelIncompleteIds.length === 1 ? '' : 's'} were read by the deterministic pass
755
- only, so anything stated in the notes but not written into a next-step list is still
756
- missing from them. Running it again gives the model another go; nothing is duplicated.
757
- </p>
758
- ) : null}
759
-
760
- {totals.droppedOutOfScope > 0 ? (
761
- <p className={cn.error} role="status">
762
- {totals.droppedOutOfScope} record{totals.droppedOutOfScope === 1 ? '' : 's'} from another
763
- workspace were returned by the data API and excluded before extracting.
764
- </p>
765
- ) : null}
466
+ ) : undefined}
467
+ />
766
468
  </div>
767
469
  );
768
470
  }
769
-
770
- // ---------------------------------------------------------------------------
771
-
772
-
773
-
774
-