@startsimpli/integrations 0.2.187 → 0.2.188

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 (34) hide show
  1. package/package.json +6 -6
  2. package/src/__tests__/connection-reconnect.test.tsx +69 -0
  3. package/src/__tests__/converse-brain.test.ts +44 -0
  4. package/src/__tests__/converse-meeting.test.ts +118 -0
  5. package/src/__tests__/converse-page.test.tsx +150 -83
  6. package/src/__tests__/converse.test.ts +32 -0
  7. package/src/__tests__/corpus-tracker.test.tsx +37 -35
  8. package/src/__tests__/plan-shell.test.tsx +14 -11
  9. package/src/__tests__/possibly-done-extract.test.ts +90 -0
  10. package/src/__tests__/possibly-done-ui.test.tsx +80 -0
  11. package/src/components/pages/ConversePage.tsx +128 -83
  12. package/src/components/pages/TaskDetailPage.tsx +22 -0
  13. package/src/components/pages/TrackerPage.tsx +15 -141
  14. package/src/components/pages/connections/ConnectionCard.tsx +20 -0
  15. package/src/components/pages/connections/bound-api.ts +2 -0
  16. package/src/components/pages/converse/Thread.tsx +46 -0
  17. package/src/components/pages/converse/browserIO.ts +15 -5
  18. package/src/components/pages/home/CompactItemRow.tsx +4 -1
  19. package/src/components/pages/plan/TalkPage.tsx +8 -29
  20. package/src/components/pages/tracker/PossiblyDone.tsx +49 -0
  21. package/src/corpus/client.ts +2 -0
  22. package/src/corpus/commitments.ts +27 -6
  23. package/src/corpus/converse/brain.ts +24 -16
  24. package/src/corpus/converse/handle.ts +24 -2
  25. package/src/corpus/converse/index.ts +2 -1
  26. package/src/corpus/converse/meeting.ts +70 -21
  27. package/src/corpus/converse/route.ts +4 -3
  28. package/src/corpus/converse/sources.ts +17 -0
  29. package/src/corpus/converse/types.ts +19 -0
  30. package/src/corpus/entities.ts +4 -0
  31. package/src/corpus/nav-copy.ts +3 -3
  32. package/src/corpus/possibly-done.ts +59 -0
  33. package/src/corpus/types.ts +17 -1
  34. package/src/native/converse/io.ts +2 -1
@@ -9,10 +9,16 @@
9
9
  */
10
10
  import { ConverseClientError } from './client';
11
11
  import { resolveMeetingConfig, type MeetingConfig } from './meeting-config';
12
- import type { ConverseEndResult, ConverseThread, ConverseTurnResult } from './types';
12
+ import type { ConverseEndResult, ConverseIntent, ConverseSource, ConverseThread, ConverseTurnResult } from './types';
13
13
 
14
14
  export type MeetingPhase = 'idle' | 'listening' | 'thinking' | 'speaking' | 'ending' | 'ended' | 'stopped';
15
- export interface MeetingLine { role: 'user' | 'assistant' | 'relay'; text: string }
15
+ export interface MeetingLine {
16
+ /** `system` is a quiet line the thread shows between messages ("Filed: 2 to-dos"). */
17
+ role: 'user' | 'assistant' | 'relay' | 'system';
18
+ text: string;
19
+ intent?: ConverseIntent;
20
+ sources?: ConverseSource[];
21
+ }
16
22
 
17
23
  export interface MeetingState {
18
24
  phase: MeetingPhase;
@@ -26,6 +32,8 @@ export interface MeetingState {
26
32
  saved: ConverseEndResult | null;
27
33
  /** A relay message that arrived while the meeting was not running: shown, not spoken. Cleared by `dismissNotice`. */
28
34
  relayNotice: string | null;
35
+ /** The small mic: true = the meeting listens; false = it does not (typing still works). */
36
+ micOn: boolean;
29
37
  }
30
38
 
31
39
  /** Why `listen` returned: the platform's detector says, the controller only needs `audio` and `cancelled`. */
@@ -51,6 +59,8 @@ export interface MeetingIO<A = Blob> {
51
59
 
52
60
  export interface MeetingController {
53
61
  start(): void;
62
+ /** The mic control. On: listen (starting the meeting if needed, keeping the open conversation). Off: stop listening and SEND what was said so far; the conversation stays open. */
63
+ mic(on: boolean): void;
54
64
  getState(): MeetingState;
55
65
  subscribe(listener: (state: MeetingState) => void): () => void;
56
66
  end(): Promise<ConverseEndResult | null>;
@@ -72,8 +82,10 @@ export function createMeetingController<A = Blob>(options: {
72
82
  }): MeetingController {
73
83
  const { client, io } = options;
74
84
  const config = resolveMeetingConfig(options.config);
75
- let s: MeetingState = { phase: 'idle', retryable: false, lines: [], error: null, noAudio: null, conversationId: null, saved: null, relayNotice: null };
85
+ let s: MeetingState = { phase: 'idle', retryable: false, lines: [], error: null, noAudio: null, conversationId: null, saved: null, relayNotice: null, micOn: false };
76
86
  let running = false;
87
+ /** Wakes the loop when the mic is turned back on. */
88
+ let resume: (() => void) | null = null;
77
89
  let loop: Promise<void> | null = null;
78
90
  let listenAbort = new AbortController();
79
91
  let speakAbort = new AbortController();
@@ -87,6 +99,9 @@ export function createMeetingController<A = Blob>(options: {
87
99
  /** One in-flight turn at a time: typed text waits for the spoken one and vice versa. */
88
100
  let turnChain: Promise<unknown> = Promise.resolve();
89
101
 
102
+ /** What the screen shows when nothing is in flight: listening if the mic is on, idle if it is off. */
103
+ const restPhase = (): MeetingPhase => (s.micOn ? 'listening' : 'idle');
104
+
90
105
  const listeners = new Set<(state: MeetingState) => void>();
91
106
  const set = (patch: Partial<MeetingState>) => { s = { ...s, ...patch }; options.onChange?.(s); listeners.forEach((l) => l(s)); };
92
107
 
@@ -116,8 +131,15 @@ export function createMeetingController<A = Blob>(options: {
116
131
  }
117
132
  set({
118
133
  conversationId: out.conversation_id,
119
- lines: [...s.lines, { role: 'user', text: out.transcript }, { role: 'assistant', text: out.reply_text }],
134
+ lines: [...s.lines, { role: 'user', text: out.transcript }, { role: 'assistant', text: out.reply_text, ...(out.intent ? { intent: out.intent } : {}), ...(out.sources?.length ? { sources: out.sources } : {}) }],
120
135
  });
136
+ // The assistant wrapped the conversation up and filed it: a quiet line, and the next message starts a new conversation.
137
+ if (out.ended) {
138
+ const todos = out.filed?.todos ?? 0;
139
+ stopPolling();
140
+ seen = 0;
141
+ set({ conversationId: null, lines: [...s.lines, { role: 'system', text: todos > 0 ? `Filed: ${todos} to-do${todos === 1 ? '' : 's'}` : 'Filed the note' }] });
142
+ }
121
143
  if (out.audio_url) {
122
144
  lastReply = { conversationId: out.conversation_id, turn: out.turn, replyText: out.reply_text, audioUrl: out.audio_url };
123
145
  // A typed message speaks its reply even before Start: the person asked in text, but the screen is a voice one.
@@ -128,7 +150,7 @@ export function createMeetingController<A = Blob>(options: {
128
150
  }
129
151
  return true;
130
152
  } catch (e) {
131
- if (isRejected(e)) { set({ phase: 'stopped', error: e instanceof Error ? e.message : 'The session ended.' }); running = false; return false; }
153
+ if (isRejected(e)) { set({ phase: 'stopped', micOn: false, error: e instanceof Error ? e.message : 'The session ended.' }); running = false; return false; }
132
154
  if (attempt === 1 || !(e instanceof ConverseClientError && e.retryable)) {
133
155
  set({ error: e instanceof Error ? e.message : 'That turn failed.', retryable: e instanceof ConverseClientError && e.retryable });
134
156
  return false;
@@ -159,7 +181,7 @@ export function createMeetingController<A = Blob>(options: {
159
181
  if (!running) return;
160
182
  listenAbort.abort();
161
183
  await playReply(reply);
162
- if (running && s.phase === 'speaking') set({ phase: 'listening' });
184
+ if (running && s.phase === 'speaking') set({ phase: restPhase() });
163
185
  });
164
186
  gate = done.catch(() => undefined);
165
187
  turnChain = gate;
@@ -183,6 +205,13 @@ export function createMeetingController<A = Blob>(options: {
183
205
  while (running) {
184
206
  await gate;
185
207
  if (!running) break;
208
+ // Mic off: wait here (typing still works) until it is turned back on or the meeting ends.
209
+ if (!s.micOn) {
210
+ if (s.phase !== 'stopped') set({ phase: 'idle' });
211
+ await new Promise<void>((r) => { resume = r; });
212
+ resume = null;
213
+ continue;
214
+ }
186
215
  listenAbort = new AbortController();
187
216
  set({ phase: 'listening' });
188
217
  const heard = await io.listen(listenAbort.signal, config);
@@ -199,20 +228,39 @@ export function createMeetingController<A = Blob>(options: {
199
228
  }
200
229
  }
201
230
 
231
+ function begin(reset: boolean) {
232
+ if (running) return;
233
+ running = true;
234
+ lastReply = null;
235
+ if (reset) {
236
+ // A new meeting is a new conversation, also after End or a stop.
237
+ stopPolling();
238
+ seen = 0;
239
+ set({ phase: 'listening', retryable: false, lines: [], error: null, noAudio: null, conversationId: null, saved: null, relayNotice: null, micOn: true });
240
+ } else {
241
+ set({ phase: 'listening', micOn: true, error: null });
242
+ }
243
+ loop = run();
244
+ startPolling();
245
+ }
246
+
202
247
  return {
203
248
  state: () => s,
204
249
  getState: () => s,
205
250
  subscribe(listener) { listeners.add(listener); return () => { listeners.delete(listener); }; },
206
- start() {
207
- if (running) return;
208
- running = true;
209
- lastReply = null;
210
- // A new meeting is a new conversation, also after End or a stop.
211
- stopPolling();
212
- seen = 0;
213
- set({ phase: 'listening', retryable: false, lines: [], error: null, noAudio: null, conversationId: null, saved: null, relayNotice: null });
214
- loop = run();
215
- startPolling();
251
+ start() { begin(true); },
252
+ mic(on) {
253
+ if (on) {
254
+ // Typing before the mic: the conversation is already open, so turning the mic on continues it.
255
+ if (!running) { begin(!s.conversationId || s.phase === 'ended' || s.phase === 'stopped'); return; }
256
+ set({ micOn: true, phase: s.phase === 'idle' ? 'listening' : s.phase });
257
+ resume?.();
258
+ return;
259
+ }
260
+ if (!running || !s.micOn) { set({ micOn: false }); return; }
261
+ set({ micOn: false, phase: s.phase === 'listening' ? 'idle' : s.phase });
262
+ // Stop and send what has been said so far; the platform's listen hands it back (or nothing if nothing was said).
263
+ listenAbort.abort('finish');
216
264
  },
217
265
  async sendText(text) {
218
266
  const t = text.trim();
@@ -222,7 +270,7 @@ export function createMeetingController<A = Blob>(options: {
222
270
  const done = turnChain.then(async () => {
223
271
  if (running) listenAbort.abort();
224
272
  await takeTurn({ text: t });
225
- if (running && s.phase !== 'stopped') set({ phase: 'listening' });
273
+ if (running && s.phase !== 'stopped') set({ phase: restPhase() });
226
274
  else if (!running && (s.phase === 'thinking' || s.phase === 'speaking')) set({ phase: 'idle' });
227
275
  });
228
276
  gate = done.catch(() => undefined);
@@ -236,7 +284,7 @@ export function createMeetingController<A = Blob>(options: {
236
284
  const done = turnChain.then(async () => {
237
285
  if (running) listenAbort.abort();
238
286
  await playReply(reply);
239
- if (running) set({ phase: 'listening' });
287
+ if (running) set({ phase: restPhase() });
240
288
  });
241
289
  gate = done.catch(() => undefined);
242
290
  turnChain = gate;
@@ -244,19 +292,20 @@ export function createMeetingController<A = Blob>(options: {
244
292
  },
245
293
  async end() {
246
294
  running = false;
295
+ resume?.();
247
296
  stopPolling();
248
297
  listenAbort.abort();
249
298
  speakAbort.abort();
250
299
  await loop?.catch(() => undefined);
251
300
  await turnChain;
252
- if (!s.conversationId) { set({ phase: 'ended' }); return null; }
301
+ if (!s.conversationId) { set({ phase: 'ended', micOn: false }); return null; }
253
302
  set({ phase: 'ending' });
254
303
  try {
255
304
  const saved = await client.end(s.conversationId);
256
- set({ phase: 'ended', saved, lines: s.lines });
305
+ set({ phase: 'ended', saved, lines: s.lines, micOn: false });
257
306
  return saved;
258
307
  } catch (e) {
259
- set({ phase: 'ended', error: e instanceof Error ? e.message : 'Saving the conversation failed.' });
308
+ set({ phase: 'ended', micOn: false, error: e instanceof Error ? e.message : 'Saving the conversation failed.' });
260
309
  return null;
261
310
  }
262
311
  },
@@ -7,12 +7,13 @@
7
7
  */
8
8
  import type { BriefingScriptLlm } from '../briefing/script';
9
9
 
10
- export type ConverseRoute = 'work' | 'status' | 'other';
10
+ export type ConverseRoute = 'work' | 'status' | 'note' | 'other';
11
11
 
12
12
  const SYSTEM = [
13
- 'You sort one thing a person said aloud to their assistant. Reply with JSON only: {"route": "work" | "status" | "other"}.',
13
+ 'You sort one thing a person said aloud to their assistant. Reply with JSON only: {"route": "work" | "status" | "note" | "other"}.',
14
14
  '- work: they are talking TO the relay or the agent team: telling it to do something (start, stop, fix, ship, look into, assign, prioritise, add a to-do for it, update something), or asking it a question to answer live ("ask the relay what it is working on").',
15
15
  '- status: they are asking YOU what the agents, sessions, fleet or lanes are doing, how work is going, or what is blocked, without asking the relay itself to answer.',
16
+ '- note: they are dictating a note or plan for themselves: several things they need, want or plan to do, or thinking out loud about their day or a project; NOT a question and NOT a request to the assistant or the relay. Anything that asks the assistant to do or make something ("plan my friday", "summarize my week", "help me think this through") is other, not note.',
16
17
  '- other: anything else, including questions about THEIR OWN tasks, to-dos, plate, what is due, notes, calendar or documents ("what is on my plate today", "what is due this week"), and small talk.',
17
18
  'Examples. other: "is the to-do call the bank overdue?", "what is due Friday", "when did I last talk to Dana", "what is on my plate", "how many open items do I have". status: "what are the agents working on", "is the relay blocked", "how is the crochets lane going". work: "tell the relay to fix the checkout bug", "ask the agents to ship the roll".',
18
19
  'A question about a single to-do, record, note, person or date is ALWAYS other, even if it contains words like late, overdue, blocked or done.',
@@ -20,7 +21,7 @@ const SYSTEM = [
20
21
  ].join('\n');
21
22
 
22
23
  export function parseRoute(raw: string): ConverseRoute {
23
- const m = /"route"\s*:\s*"(work|status|other)"/i.exec(raw);
24
+ const m = /"route"\s*:\s*"(work|status|note|other)"/i.exec(raw);
24
25
  return m ? (m[1].toLowerCase() as ConverseRoute) : 'other';
25
26
  }
26
27
 
@@ -0,0 +1,17 @@
1
+ /** The records an answer came from, as the thread shows them: { kind, title, id } (documents, items, projects, notes). */
2
+ import type { SourceDocument } from '../types';
3
+ import type { ConverseSource } from './types';
4
+
5
+ const MAX_SOURCES = 6;
6
+
7
+ export const sourceOf = (d: Pick<SourceDocument, 'id' | 'title'> & Partial<SourceDocument>): ConverseSource => ({
8
+ kind: d.id.startsWith('item:') ? 'todo' : String(d.sourceLabel || d.source || 'document').toLowerCase(),
9
+ title: d.title,
10
+ id: d.id,
11
+ });
12
+
13
+ /** From an Ask result's citations (what the app wires into the brain's `ask`). */
14
+ export const askSources = (result: { citations?: Array<{ document: SourceDocument }> }): ConverseSource[] =>
15
+ (result.citations ?? []).slice(0, MAX_SOURCES).map((c) => sourceOf(c.document));
16
+
17
+ export const sourcesOfDocs = (docs: SourceDocument[] | undefined): ConverseSource[] => (docs ?? []).slice(0, MAX_SOURCES).map(sourceOf);
@@ -34,8 +34,16 @@ export interface ConverseTurn {
34
34
  from?: 'relay';
35
35
  /** Set when what was said is an instruction for the relay to pick up (a work order), not something the assistant answers alone. */
36
36
  for_relay?: boolean;
37
+ /** What kind of thing was said: the one assistant decides inside the turn. */
38
+ intent?: ConverseIntent;
39
+ /** The records an answer came from (documents, items, projects), for the thread to show. */
40
+ sources?: ConverseSource[];
37
41
  }
38
42
 
43
+ /** note: a plan or thoughts to keep; question: asked and answered; command: a change to his to-dos; relay: for the relay; briefing: the one-item-at-a-time walk; chat: small talk. */
44
+ export type ConverseIntent = 'note' | 'question' | 'command' | 'relay' | 'briefing' | 'chat';
45
+ export interface ConverseSource { kind: string; title: string; id: string }
46
+
39
47
  export interface ConversationRecord {
40
48
  /** Tenant row id. */
41
49
  id: string;
@@ -88,6 +96,12 @@ export interface ConverseBrainOutput {
88
96
  relayText?: string;
89
97
  /** The briefing after this turn: null = over; absent = unchanged. */
90
98
  briefing?: BriefingState | null;
99
+ /** What kind of thing was said (shown by the app, kept on the turn). */
100
+ intent?: ConverseIntent;
101
+ /** The records the answer came from. */
102
+ sources?: ConverseSource[];
103
+ /** He asked to wrap up ("parse that note", "that's it"): the turn files the conversation through the normal End. */
104
+ finish?: boolean;
91
105
  /** Milliseconds spent in each step of the brain (items, intent, route, ask...): measured, never spoken. */
92
106
  timings?: Record<string, number>;
93
107
  }
@@ -114,6 +128,11 @@ export interface ConverseTurnResult {
114
128
  audio_url: string | null;
115
129
  /** Why there is no audio, when there is none: the page says it instead of staying silent. */
116
130
  audio_reason: string | null;
131
+ intent?: ConverseIntent;
132
+ sources?: ConverseSource[];
133
+ /** True when this turn wrapped the conversation up and filed it; the next message starts a new conversation. */
134
+ ended?: boolean;
135
+ filed?: { note: boolean; todos: number };
117
136
  }
118
137
 
119
138
  /** One line of a thread as the page and the relay read it. `who` is whose words `reply_text`/`transcript` are. */
@@ -22,6 +22,7 @@
22
22
  * blanks itself because an attribute was renamed is worse than one that shows a
23
23
  * row with a missing subtitle.
24
24
  */
25
+ import { readPossiblyDone, writePossiblyDone } from './possibly-done';
25
26
  import { withSourceEntity } from './source-entity';
26
27
  import { decodeOwnerSubs, encodeOwnerSubs } from './owner-link';
27
28
  import { readItemSync, type ItemSync } from '../task-tracker/item-sync';
@@ -748,6 +749,8 @@ export function toCommitment(
748
749
  ? { origin: asText(pick(data, ORIGIN_KEY, 'Origin')) } : {}),
749
750
  ...withSync(data),
750
751
  mentions,
752
+ ...(readPossiblyDone(pick(data, 'possibly_done', 'possiblyDone')).length
753
+ ? { possiblyDone: readPossiblyDone(pick(data, 'possibly_done', 'possiblyDone')) } : {}),
751
754
  firstSeenAt: asIso(pick(data, 'first_seen_at', 'firstSeenAt')),
752
755
  lastSeenAt: asIso(pick(data, 'last_seen_at', 'lastSeenAt')),
753
756
  extractorVersion: asText(pick(data, 'extractor_version', 'extractorVersion')),
@@ -833,6 +836,7 @@ export function commitmentToEntity(commitment: Commitment): {
833
836
  extractor: mention.extractor,
834
837
  ...(mention.section ? { section: mention.section } : {}),
835
838
  })),
839
+ ...(commitment.possiblyDone?.length ? { possibly_done: writePossiblyDone(commitment.possiblyDone) } : {}),
836
840
  extractor_version: commitment.extractorVersion,
837
841
  source: commitment.source,
838
842
  // Marks the row as pipeline-written, the same way the corpus delivery
@@ -5,9 +5,9 @@
5
5
  */
6
6
  export const TAB_COPY = {
7
7
  today: { label: 'Today', subtitle: 'Your morning brief and what is due soon.' },
8
- talk: { label: 'Talk', subtitle: 'Talk or type to Tandem: plans, questions, and notes. Asks you make become to-dos.' },
8
+ talk: { label: 'Talk', subtitle: 'Talk or type: plans, questions, notes. Say "parse that note" when you are done.' },
9
9
  plan: { label: 'Plan', subtitle: 'Everything you owe, and what you are aiming for.' },
10
- more: { label: 'More', subtitle: 'Library, Decisions, Connections, Admin.' },
10
+ more: { label: 'More', subtitle: 'Library, Decisions, Connections.' },
11
11
  } as const;
12
12
 
13
13
  export const PLAN_TABS = [
@@ -17,11 +17,11 @@ export const PLAN_TABS = [
17
17
  ] as const;
18
18
  export type PlanTabKey = (typeof PLAN_TABS)[number]['key'];
19
19
 
20
+ /** Admin is not here on purpose: schema, records and people are managed by Foundry admins in the Foundry app. Connect Claude is a section of Connections. */
20
21
  export const MORE_ENTRIES = [
21
22
  { key: 'library', label: 'Library', subtitle: 'Everything Tandem has pulled in: documents, notes and recordings.' },
22
23
  { key: 'decisions', label: 'Decisions', subtitle: 'Questions your agents need you to answer.' },
23
24
  { key: 'connections', label: 'Connections', subtitle: 'The accounts and data sources Tandem reads from.' },
24
- { key: 'admin', label: 'Admin', subtitle: 'Records, organisation and build settings.' },
25
25
  ] as const;
26
26
 
27
27
  export const TALK_MODES = [
@@ -0,0 +1,59 @@
1
+ /**
2
+ * "POSSIBLY DONE" — meeting statements that might have closed a to-do, kept ON
3
+ * that to-do (data.possibly_done) so a person decides on the row.
4
+ *
5
+ * One candidate per (item, meeting). That is also the dismissal key: once a
6
+ * meeting's candidate is dismissed, a later sweep over the same meeting does
7
+ * not raise it again even when the model words the statement differently.
8
+ * Nothing here ever changes a status.
9
+ */
10
+ import type { PossiblyDone } from './types';
11
+
12
+ const text = (v: unknown): string => (typeof v === 'string' ? v : v == null ? '' : String(v));
13
+
14
+ /** Tolerates both key spellings: the browser client camelCases `data` keys. */
15
+ export function readPossiblyDone(raw: unknown): PossiblyDone[] {
16
+ if (!Array.isArray(raw)) return [];
17
+ const out: PossiblyDone[] = [];
18
+ for (const entry of raw) {
19
+ if (!entry || typeof entry !== 'object') continue;
20
+ const e = entry as Record<string, unknown>;
21
+ const documentId = text(e.document_id ?? e.documentId);
22
+ const quote = text(e.quote);
23
+ if (!documentId || !quote) continue;
24
+ const at = text(e.at);
25
+ out.push({
26
+ quote,
27
+ documentId,
28
+ documentTitle: text(e.document_title ?? e.documentTitle),
29
+ at: at && !Number.isNaN(Date.parse(at)) ? at : null,
30
+ state: e.state === 'dismissed' ? 'dismissed' : 'pending',
31
+ });
32
+ }
33
+ return out;
34
+ }
35
+
36
+ export function writePossiblyDone(list: PossiblyDone[]): Array<Record<string, unknown>> {
37
+ return list.map((c) => ({
38
+ quote: c.quote.slice(0, 400),
39
+ document_id: c.documentId,
40
+ document_title: c.documentTitle.slice(0, 200),
41
+ at: c.at,
42
+ state: c.state,
43
+ }));
44
+ }
45
+
46
+ /** The list with `candidate` added, unless this meeting already has one (pending or dismissed). */
47
+ export function withCandidate(existing: PossiblyDone[] | undefined, candidate: PossiblyDone): PossiblyDone[] | null {
48
+ const list = existing ?? [];
49
+ if (list.some((c) => c.documentId === candidate.documentId)) return null;
50
+ return [...list, candidate];
51
+ }
52
+
53
+ export const pendingCandidates = (list: PossiblyDone[] | undefined): PossiblyDone[] =>
54
+ (list ?? []).filter((c) => c.state === 'pending');
55
+
56
+ /** The list with one meeting's candidate marked dismissed. */
57
+ export function dismissCandidate(list: PossiblyDone[] | undefined, documentId: string): PossiblyDone[] {
58
+ return (list ?? []).map((c) => (c.documentId === documentId ? { ...c, state: 'dismissed' as const } : c));
59
+ }
@@ -654,6 +654,16 @@ export interface CommitmentMention {
654
654
  }
655
655
 
656
656
  /** A trackable thing that came out of a conversation. */
657
+ /** One meeting statement that might have closed a to-do. `dismissed` is remembered so a re-sweep does not raise it again. */
658
+ export interface PossiblyDone {
659
+ quote: string;
660
+ documentId: string;
661
+ documentTitle: string;
662
+ /** When the meeting happened (ISO), or null when it was undated. */
663
+ at: string | null;
664
+ state: 'pending' | 'dismissed';
665
+ }
666
+
657
667
  export interface Commitment {
658
668
  id: string;
659
669
  /** `commit:<dedupeKey>` — the row's stable external identity in the tenant. */
@@ -766,6 +776,12 @@ export interface Commitment {
766
776
  /** Its link to a task tracker (identifier, state, sync health); absent when it has none. */
767
777
  sync?: ItemSync;
768
778
  mentions: CommitmentMention[];
779
+ /**
780
+ * Meeting statements that PLAUSIBLY close this item but were not strong enough
781
+ * to close it. Stored on the item itself, one per meeting, so a person decides
782
+ * on the row; nothing here ever changes `status` by itself.
783
+ */
784
+ possiblyDone?: PossiblyDone[];
769
785
  firstSeenAt: string | null;
770
786
  lastSeenAt: string | null;
771
787
  /** Which extractor produced it, so a later one can re-derive without orphaning. */
@@ -925,7 +941,7 @@ export interface CommitmentApi {
925
941
  */
926
942
  updateCommitment?(item: Commitment, patch: Partial<Pick<Commitment,
927
943
  'status' | 'statusReason' | 'ownerName' | 'ownerSub' | 'ownerSubs' | 'dueAt' | 'subtype'
928
- | 'title' | 'detail' | 'resolvedAt'>> & {
944
+ | 'title' | 'detail' | 'resolvedAt' | 'possiblyDone'>> & {
929
945
  /** `private` hides the item from everyone but its owner; `null` makes it shared again. */
930
946
  visibility?: 'private' | null;
931
947
  /** `null` clears it (undoing a voice-set priority). */
@@ -65,7 +65,8 @@ export function createMeetingIO(deps: {
65
65
  const finish = (why: NonNullable<typeof h.why>) => { if (!h.why) { h.why = why; wake?.(); } };
66
66
  const t0 = now();
67
67
  broken = () => finish('broken');
68
- const onAbort = () => finish('abort');
68
+ // Aborted with reason 'finish' (the mic button): if he was speaking, that is the end of the utterance (it is sent); otherwise a plain stop.
69
+ const onAbort = () => finish(signal.reason === 'finish' && startedAt !== null ? 'end' : 'abort');
69
70
  signal.addEventListener('abort', onAbort, { once: true });
70
71
  try {
71
72
  await deps.audio.start({