@startsimpli/integrations 0.2.189 → 0.2.191

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@startsimpli/integrations",
3
- "version": "0.2.189",
3
+ "version": "0.2.191",
4
4
  "description": "Provider-agnostic types, API clients, hooks, and UI primitives for email + calendar integrations across StartSimpli apps, plus foundry customer email (subpath ./comms).",
5
5
  "license": "MIT",
6
6
  "homepage": "https://startsimpli.com",
@@ -50,9 +50,9 @@
50
50
  "react-native": ">=0.74.0",
51
51
  "@startsimpli/ui-native": ">=0.1.12",
52
52
  "react-native-safe-area-context": ">=4.0.0",
53
- "@startsimpli/ui": "^0.4.187",
54
- "@startsimpli/utils": "^0.4.20",
55
- "@startsimpli/auth": "^0.4.53"
53
+ "@startsimpli/auth": "^0.4.53",
54
+ "@startsimpli/ui": "^0.4.188",
55
+ "@startsimpli/utils": "^0.4.20"
56
56
  },
57
57
  "peerDependenciesMeta": {
58
58
  "react": {
@@ -99,10 +99,10 @@
99
99
  "react-native": "0.85.3",
100
100
  "react-native-safe-area-context": "~5.7.0",
101
101
  "@startsimpli/llm": "0.4.31",
102
- "@startsimpli/ui": "0.4.187",
103
- "@startsimpli/ui-native": "0.1.15",
102
+ "@startsimpli/ui": "0.4.188",
103
+ "@startsimpli/utils": "0.4.20",
104
104
  "@startsimpli/auth": "0.4.53",
105
- "@startsimpli/utils": "0.4.20"
105
+ "@startsimpli/ui-native": "0.1.15"
106
106
  },
107
107
  "scripts": {
108
108
  "type-check": "tsc --noEmit && tsc --noEmit -p tsconfig.native.json",
@@ -51,12 +51,12 @@ describe('a conversational turn never says "unanswerable"', () => {
51
51
  return createConverseBrain({ ...(s.deps as any), ask: async () => ({ answer, status }) });
52
52
  };
53
53
  it.each([['unanswerable'], ['Unanswerable.'], [' '], ['']])('says what it cannot see instead of %j', async (answer) => {
54
- const out = await brainWith(answer, 'no_evidence')({ utterance: 'What is due this week?', history: [], timeZone: TZ, now: NOW });
54
+ const out = await brainWith(answer, 'no_evidence')({ utterance: 'What did Dana promise me?', history: [], timeZone: TZ, now: NOW });
55
55
  expect(out.text.toLowerCase()).not.toContain('unanswerable');
56
56
  expect(out.text).toMatch(/could not find|don't see|do not see/i);
57
57
  });
58
58
  it('a real answer is passed through', async () => {
59
- const out = await brainWith('The bench is due today.', 'answered')({ utterance: 'what is due', history: [], timeZone: TZ, now: NOW });
59
+ const out = await brainWith('The bench is due today.', 'answered')({ utterance: 'what are my commitments', history: [], timeZone: TZ, now: NOW });
60
60
  expect(out.text).toBe('The bench is due today');
61
61
  });
62
62
  });
@@ -73,7 +73,7 @@ describe('converse brain', () => {
73
73
 
74
74
  it('a question goes to Ask and changes nothing', async () => {
75
75
  const s = setup();
76
- const out = await s.brain({ utterance: 'what is due today', history: [], timeZone: TZ, now: NOW });
76
+ const out = await s.brain({ utterance: 'what are my commitments this week', history: [], timeZone: TZ, now: NOW });
77
77
  expect(out.text).toBe('Two things are due today: the bench and printer paper');
78
78
  expect(s.rows.get('item:bench').data.due_at.slice(0, 10)).toBe('2026-11-04');
79
79
  });
@@ -87,9 +87,9 @@ describe('converse brain', () => {
87
87
 
88
88
  it('Ask sees the conversation so far', async () => {
89
89
  const s = setup();
90
- await s.brain({ utterance: 'and friday?', history: [{ role: 'user', text: 'what is due today' }, { role: 'assistant', text: 'The bench.' }], timeZone: TZ, now: NOW });
90
+ await s.brain({ utterance: 'and friday?', history: [{ role: 'user', text: 'what are my commitments this week' }, { role: 'assistant', text: 'The bench.' }], timeZone: TZ, now: NOW });
91
91
  const question = (s.ask.mock.calls[0] as any)[0].question as string;
92
- expect(question).toContain('Me: what is due today');
92
+ expect(question).toContain('Me: what are my commitments this week');
93
93
  expect(question).toContain('You: The bench.');
94
94
  expect(question).toMatch(/and friday\?/);
95
95
  });
@@ -107,14 +107,14 @@ describe('long answers: whole on the screen, short aloud; Ask starts beside rout
107
107
  it('a list answer: the screen text is whole, the spoken version is three items and "and 2 more"', async () => {
108
108
  const s = setup();
109
109
  const brain = createConverseBrain({ ...s.deps, ask: async () => ({ answer: LIST }) });
110
- const out = await brain(input('what is due this week'));
110
+ const out = await brain(input('what are my commitments this week'));
111
111
  expect(out.text).toContain('5. Call the bank');
112
112
  expect(out.spoken).toBe('This week, the following tasks are due. Plan the week. Build lead QC. Launch lead. And 2 more.');
113
113
  });
114
114
 
115
115
  it('a short answer has no separate spoken version', async () => {
116
116
  const s = setup();
117
- const out = await createConverseBrain(s.deps)(input('what is due today'));
117
+ const out = await createConverseBrain(s.deps)(input('what are my commitments this week'));
118
118
  expect(out.spoken).toBeUndefined();
119
119
  });
120
120
 
@@ -124,7 +124,7 @@ describe('long answers: whole on the screen, short aloud; Ask starts beside rout
124
124
  let routing = false;
125
125
  const routeLlm = { write: vi.fn(async () => { routing = true; await new Promise((r) => setTimeout(r, 40)); routing = false; return '{"route":"other"}'; }) };
126
126
  const ask = vi.fn(async () => { askedWhileRouting = routing; return { answer: 'The bench.' }; });
127
- const out = await createConverseBrain({ ...s.deps, routeLlm: routeLlm as never, ask })(input('what is due this week'));
127
+ const out = await createConverseBrain({ ...s.deps, routeLlm: routeLlm as never, ask })(input('what are my commitments this week'));
128
128
  expect(askedWhileRouting).toBe(true);
129
129
  expect(ask).toHaveBeenCalledTimes(1);
130
130
  expect(out.text).toContain('bench');
@@ -153,9 +153,9 @@ describe('conversation answers are short unless he asks for all of it', () => {
153
153
  return String(s.ask.mock.calls[0][0].question);
154
154
  };
155
155
  it('asks Ask for at most 60 words, the top three of a list and a count', async () => {
156
- expect(await ask('what is due this week')).toMatch(/at most 60 words[\s\S]*three most important items/);
156
+ expect(await ask('what are my commitments this week')).toMatch(/at most 60 words[\s\S]*three most important items/);
157
157
  });
158
- it.each(['tell me more about the bench', 'list them all', 'give me the full list of what is due', 'what is due this week, in detail'])('"%s" gets the whole answer', async (said) => {
158
+ it.each(['tell me more about the bench', 'list them all', 'give me the full list of my commitments', 'what are my commitments this week, in detail'])('"%s" gets the whole answer', async (said) => {
159
159
  expect(await ask(said)).not.toMatch(/at most 60 words/);
160
160
  });
161
161
  });
@@ -181,7 +181,7 @@ describe('ONE entry: the assistant decides what was said', () => {
181
181
 
182
182
  it('a QUESTION is never taken for a note, whatever the routing model says', async () => {
183
183
  const s = setup();
184
- const out = await createConverseBrain({ ...s.deps, routeLlm: routeSays('note') })(say('What is due this week?'));
184
+ const out = await createConverseBrain({ ...s.deps, routeLlm: routeSays('note') })(say('what are my commitments this week'));
185
185
  expect(out.intent).toBe('question');
186
186
  expect(out.text).not.toBe('Got it.');
187
187
  expect(s.ask).toHaveBeenCalledTimes(1);
@@ -200,7 +200,85 @@ describe('ONE entry: the assistant decides what was said', () => {
200
200
  it('an answer carries its sources (documents, items, projects) for the thread to show', async () => {
201
201
  const s = setup();
202
202
  const brain = createConverseBrain({ ...s.deps, ask: async () => ({ answer: 'The bench is due today.', sources: [{ kind: 'item', title: "Order dad's bench", id: 'item:bench' }] }) });
203
- expect((await brain(say('what is due today'))).sources).toEqual([{ kind: 'item', title: "Order dad's bench", id: 'item:bench' }]);
203
+ expect((await brain(say('what are my commitments this week'))).sources).toEqual([{ kind: 'item', title: "Order dad's bench", id: 'item:bench' }]);
204
+ });
205
+ });
206
+
207
+ describe('what is due is answered in code, without Ask', () => {
208
+ const rows = [{ id: 'bench', title: "Order dad's bench", status: 'open', dueAt: '2026-11-04', ownerSub: ME }, { id: 'p', title: 'Printer paper', status: 'open', dueAt: '2026-11-04', ownerSub: ME }] as never;
209
+ it('"what is due today?" comes from his items: no Ask, no routing model, sources attached', async () => {
210
+ const s = setup();
211
+ const llm = { write: vi.fn(async () => '{"route":"other"}') };
212
+ const out = await createConverseBrain({ ...s.deps, routeLlm: llm as never, loadItems: async () => rows })({ utterance: 'what is due today?', history: [], timeZone: TZ, now: NOW });
213
+ expect(out.text).toBe("2 things are due today: Order dad's bench and Printer paper.");
214
+ expect(out.intent).toBe('question');
215
+ expect(out.sources).toHaveLength(2);
216
+ expect(s.ask).not.toHaveBeenCalled();
217
+ });
218
+ it('a due question with another topic still goes to Ask', async () => {
219
+ const s = setup();
220
+ await createConverseBrain({ ...s.deps, loadItems: async () => rows })({ utterance: 'what is due today about the bench', history: [], timeZone: TZ, now: NOW });
221
+ expect(s.ask).toHaveBeenCalledTimes(1);
222
+ });
223
+ });
224
+
225
+ describe('a long dictated plan is a note, not a stack of to-dos', () => {
226
+ const long = 'So today I want to work on my dad bench a bit more, then check the greenhouse tasks, and I also need to call Panda about the show and review the checkout copy before lunch';
227
+ const turn = (utterance: string) => ({ utterance, history: [], timeZone: TZ, now: NOW } as never);
228
+ it('is acknowledged and kept for the wrap-up: no to-do is created on the spot', async () => {
229
+ const s = setup();
230
+ const created: string[] = [];
231
+ const intentLlm = { write: vi.fn(async () => { created.push('intent model ran'); return '{"confidence":0.95,"actions":[{"type":"add_item","title":"Call Panda","due":null}]}'; }) };
232
+ const out = await createConverseBrain({ ...s.deps, intentLlm: intentLlm as never, loadItems: async () => [] as never })(turn(long));
233
+ expect(out).toMatchObject({ text: 'Got it.', intent: 'note' });
234
+ expect(created).toEqual([]);
235
+ expect([...s.rows.values()].filter((r) => r.entity_type === 'commitment' && r.data.title === 'Call Panda')).toHaveLength(0);
236
+ });
237
+ it('a short explicit instruction still acts right away', async () => {
238
+ const s = setup();
239
+ const out = await createConverseBrain({ ...s.deps, loadItems: async () => [] as never })(turn('add buy salt and pepper'));
240
+ expect(out.intent).toBe('command');
241
+ });
242
+ it('a long QUESTION is still a question, and an explicit to-do request stays a command', async () => {
243
+ const s = setup();
244
+ const q = await createConverseBrain({ ...s.deps })(turn('what is due this week and what did I say I would do about the bench and the greenhouse and the printer paper and the bank call'));
245
+ expect(q.intent).toBe('question');
246
+ const c = await createConverseBrain({ ...s.deps, loadItems: async () => [] as never })(turn('add a to-do to call Panda about the show next week and make sure the checkout copy is reviewed before lunch tomorrow morning please'));
247
+ expect(c.intent).not.toBe('note');
248
+ });
249
+ });
250
+
251
+ describe('follow-ups about the items just listed', () => {
252
+ const two = [
253
+ { id: 'bench', title: "Order dad's bench", status: 'open', dueAt: '2026-11-04', ownerSub: ME, focusName: 'Home', priority: 1 },
254
+ { id: 'paper', title: 'Pick up printer paper', status: 'open', dueAt: '2026-11-04', ownerSub: ME },
255
+ ] as never;
256
+ const turn = (utterance: string, context: unknown = null) => ({ utterance, history: [], timeZone: TZ, now: NOW, context } as never);
257
+
258
+ it('a due answer leaves its items in play, and the next turn edits the one he points at', async () => {
259
+ const s = setup();
260
+ s.rows.set('item:paper', { id: 'paper', entity_type: 'commitment', external_id: 'item:paper', name: 'Pick up printer paper', data: { title: 'Pick up printer paper', status: 'open', owner_sub: ME, subtype: 'action', due_at: '2026-11-04' } });
261
+ const brain = createConverseBrain({ ...s.deps, loadItems: async () => two });
262
+ const first = await brain(turn('what is due today?'));
263
+ expect(first.context?.items.map((i) => i.id)).toEqual(['bench', 'paper']);
264
+ const out = await brain(turn('move the second one to Friday', first.context));
265
+ expect(out.intent).toBe('command');
266
+ expect(s.rows.get('item:paper')?.data.due_at.slice(0, 10)).toBe('2026-11-06');
267
+ expect(s.rows.get('item:bench')?.data.due_at.slice(0, 10)).toBe('2026-11-04');
268
+ });
269
+
270
+ it('"tell me more about the first one" says its fields, no model', async () => {
271
+ const s = setup();
272
+ const brain = createConverseBrain({ ...s.deps, loadItems: async () => two });
273
+ const out = await brain(turn('tell me more about the first one', { items: [{ id: 'bench', title: "Order dad's bench" }, { id: 'paper', title: 'Pick up printer paper' }] }));
274
+ expect(out.text).toBe("Order dad's bench: Home, due today, urgent priority, open.");
275
+ expect(s.ask).not.toHaveBeenCalled();
276
+ });
277
+
278
+ it('"that one" with two in play asks which', async () => {
279
+ const s = setup();
280
+ const out = await createConverseBrain({ ...s.deps, loadItems: async () => two })(turn('mark that one done', { items: [{ id: 'bench', title: "Order dad's bench" }, { id: 'paper', title: 'Pick up printer paper' }] }));
281
+ expect(out.text).toBe("Which one: Order dad's bench or Pick up printer paper?");
204
282
  });
205
283
  });
206
284
 
@@ -308,10 +386,10 @@ describe('a question about a to-do is answered from the records, never sent to t
308
386
  });
309
387
 
310
388
  describe('a status route needs fleet words', () => {
311
- it('"What is due this week?" goes to Ask even when the routing model says status', async () => {
389
+ it('"what are my commitments this week" goes to Ask even when the routing model says status', async () => {
312
390
  const s = setup();
313
391
  const brain = createConverseBrain({ ...s.deps, routeLlm: { write: vi.fn(async () => '{"route":"status"}') } as never, loadFleetStatus: async () => ({ text: 'fleet text', updatedAt: new Date(NOW).toISOString() }), answerFrom: async () => 'from the fleet' });
314
- const out = await brain({ utterance: 'What is due this week?', history: [], timeZone: TZ, now: NOW });
392
+ const out = await brain({ utterance: 'what are my commitments this week', history: [], timeZone: TZ, now: NOW });
315
393
  expect(out.text).not.toContain('fleet');
316
394
  expect(s.ask).toHaveBeenCalledTimes(1);
317
395
  });
@@ -351,7 +429,7 @@ describe('fast paths', () => {
351
429
  const loads: string[] = [];
352
430
  const llm = { write: vi.fn(async () => '{"route":"other"}') };
353
431
  const brain = createConverseBrain({ ...s.deps, routeLlm: llm as never, loadItems: async () => { loads.push('items'); return s.deps.loadItems(); } });
354
- const out = await brain(input('what is due today?'));
432
+ const out = await brain(input('what are my commitments this week'));
355
433
  expect(loads).toEqual([]);
356
434
  expect(llm.write).toHaveBeenCalledTimes(1);
357
435
  expect(out.text).toContain('bench');
@@ -0,0 +1,55 @@
1
+ // @vitest-environment node
2
+ /**
3
+ * Follow-ups: "move the second one to Friday", "tell me more about the first", "when is that due?" after an answer that listed
4
+ * items. The conversation keeps the items of the last answer (in the order they were SAID) and the next turn resolves the reference.
5
+ */
6
+ import { describe, expect, it } from 'vitest';
7
+
8
+ import { followUp } from '../corpus/converse/followups';
9
+ import type { BriefingItem } from '../corpus/briefing/types';
10
+
11
+ const items = [
12
+ { id: 'a', title: 'Ship the combined roll' },
13
+ { id: 'b', title: 'Review the checkout copy' },
14
+ { id: 'c', title: 'Call the bank' },
15
+ ];
16
+ const rows: BriefingItem[] = [
17
+ { id: 'a', title: 'Ship the combined roll', status: 'open', dueAt: '2026-11-16', focusName: 'Tandem', priority: 1, ownerSub: 'me' },
18
+ { id: 'b', title: 'Review the checkout copy', status: 'blocked', dueAt: '2026-11-18', focusName: 'Crochets', ownerSub: 'me' },
19
+ { id: 'c', title: 'Call the bank', status: 'open', dueAt: '2026-11-19', ownerSub: 'me' },
20
+ ];
21
+ const NOW = Date.parse('2026-11-16T17:00:00Z');
22
+ const f = (said: string, ctx = items) => followUp({ utterance: said, items: ctx, rows, now: NOW, timeZone: 'America/Denver' });
23
+
24
+ describe('a reference with an edit becomes a plain sentence about the item', () => {
25
+ it.each([
26
+ ['move the second one to Friday', 'move "Review the checkout copy" to Friday'],
27
+ ['mark the first one done', 'mark "Ship the combined roll" done'],
28
+ ['push the last one to next week', 'push "Call the bank" to next week'],
29
+ ['drop the third', 'drop "Call the bank"'],
30
+ ['defer number two until tomorrow', 'defer "Review the checkout copy" until tomorrow'],
31
+ ])('%s', (said, rewritten) => expect(f(said)).toEqual({ kind: 'rewrite', utterance: rewritten }));
32
+
33
+ it('"it" / "that one" works when only one item was in play', () => {
34
+ expect(f('move it to Friday', [items[0]])).toEqual({ kind: 'rewrite', utterance: 'move "Ship the combined roll" to Friday' });
35
+ expect(f('mark that one done', [items[0]])).toEqual({ kind: 'rewrite', utterance: 'mark "Ship the combined roll" done' });
36
+ });
37
+
38
+ it('"that one" with several in play asks which, naming them', () => {
39
+ expect(f('mark that one done')).toEqual({ kind: 'ask', text: 'Which one: Ship the combined roll, Review the checkout copy or Call the bank?' });
40
+ });
41
+ });
42
+
43
+ describe('telling more about one', () => {
44
+ it('says its project, due date, status and priority in one short sentence', () => {
45
+ expect(f('tell me more about the first one')).toEqual({ kind: 'answer', text: 'Ship the combined roll: Tandem, due today, urgent priority, open.' });
46
+ expect(f('tell me more about the second')).toEqual({ kind: 'answer', text: 'Review the checkout copy: Crochets, due Wednesday, blocked.' });
47
+ expect(f('when is the third one due')).toEqual({ kind: 'answer', text: 'Call the bank: due Thursday, open.' });
48
+ });
49
+ });
50
+
51
+ describe('everything else is not a follow-up', () => {
52
+ it.each(['do it today', 'what is the first thing I should do', 'hello', 'add a to-do to call it a day', 'move the bench to Friday'])('%s', (said) => expect(f(said)).toBeNull());
53
+ it('without items in play nothing is a follow-up', () => expect(f('move the second one to Friday', [])).toBeNull());
54
+ it('an ordinal beyond the list asks nothing and is left alone', () => expect(f('mark the fourth one done')).toBeNull());
55
+ });
@@ -0,0 +1,51 @@
1
+ // @vitest-environment node
2
+ /**
3
+ * "What is due this week / today / what is overdue": answered in code from his items (no model, about 1 s instead of 4 to 8 s),
4
+ * and ONLY when the question is purely about due dates and states. Anything with another topic goes to Ask.
5
+ */
6
+ import { describe, expect, it } from 'vitest';
7
+
8
+ import { itemAnswer } from '../corpus/converse/item-answers';
9
+ import type { BriefingItem } from '../corpus/briefing/types';
10
+
11
+ const NOW = Date.parse('2026-11-16T17:00:00Z'); // Monday 10:00 in Denver
12
+ const TZ = 'America/Denver';
13
+ const it_ = (id: string, title: string, dueAt: string, over: Partial<BriefingItem> = {}): BriefingItem => ({ id, title, status: 'open', dueAt, ownerSub: 'me', ...over });
14
+ const ITEMS = [
15
+ it_('a', 'Ship the combined roll', '2026-11-16', { focusName: 'Tandem', priority: 1 }),
16
+ it_('b', 'Review the checkout copy', '2026-11-18', { focusName: 'Crochets', priority: 2 }),
17
+ it_('c', 'Call the bank', '2026-11-19'),
18
+ it_('d', 'Plan the week ahead', '2026-11-20', { focusName: 'Crochets' }),
19
+ it_('e', 'Order the bench', '2026-11-14'),
20
+ it_('f', 'Pay rent', '2026-11-30'),
21
+ it_('g', 'Finished thing', '2026-11-17', { status: 'done' }),
22
+ it_('h', 'Someone else', '2026-11-17', { ownerSub: 'other' }),
23
+ ];
24
+ const ask = (q: string) => itemAnswer({ question: q, items: ITEMS, now: NOW, timeZone: TZ, ownerSub: 'me' });
25
+
26
+ describe('what is due', () => {
27
+ it('this week: his open items due Monday to Sunday, in due order, top three and a count', () => {
28
+ const out = ask('What is due this week?')!;
29
+ expect(out.text).toBe('4 things are due this week: Ship the combined roll, Review the checkout copy, Call the bank, and 1 more.');
30
+ expect(out.sources.map((s) => s.id)).toEqual(['item:a', 'item:b', 'item:c']);
31
+ });
32
+ it('today, and a single item is said plainly', () => {
33
+ expect(ask("what's due today")!.text).toBe('1 thing is due today: Ship the combined roll.');
34
+ });
35
+ it('nothing due says so', () => {
36
+ expect(ask('what is due tomorrow')!.text).toBe('Nothing is due tomorrow.');
37
+ });
38
+ it("overdue / slipping: before today and still open (done and other people's are left out)", () => {
39
+ expect(ask("what's overdue?")!.text).toBe('1 thing is overdue: Order the bench.');
40
+ });
41
+ it('a project named in the question narrows it', () => {
42
+ expect(ask('what is due this week for Crochets')!.text).toBe('2 things are due this week: Review the checkout copy and Plan the week ahead.');
43
+ });
44
+ });
45
+
46
+ describe('only when the question is purely about due dates', () => {
47
+ it.each([
48
+ 'what is due this week about the roll', 'when is the bank call due', 'is the bench overdue', 'what is due this week and who is blocked', 'what did I finish this week',
49
+ 'what is on my plate', 'what do I owe Dana this week',
50
+ ])('%s goes to Ask', (q) => expect(ask(q)).toBeNull());
51
+ });
@@ -0,0 +1,19 @@
1
+ // @vitest-environment node
2
+ import { describe, expect, it } from 'vitest';
3
+ import { toSpoken } from '../corpus/converse/spoken-form';
4
+
5
+ const TODAY = '2026-11-16'; // Monday
6
+ describe('what the voice says: dates, ticket ids and markup are said the way a person would', () => {
7
+ it('turns ISO dates into spoken ones', () => {
8
+ expect(toSpoken('Plan out the week ahead (due 2026-11-20).', TODAY)).toBe('Plan out the week ahead (due Friday).');
9
+ expect(toSpoken('Ship it 2026-11-16 or 2026-11-17.', TODAY)).toBe('Ship it today or tomorrow.');
10
+ expect(toSpoken('Renewal on 2027-03-04.', TODAY)).toMatch(/^Renewal on Thursday the fourth of March/);
11
+ });
12
+ it('drops ticket ids and markdown', () => {
13
+ expect(toSpoken('Fix the login bug (SIM-1234) and **ship** it.', TODAY)).toBe('Fix the login bug and ship it.');
14
+ expect(toSpoken('## Today\n- Call the bank', TODAY)).toBe('Today Call the bank');
15
+ });
16
+ it('leaves a plain sentence alone (null = nothing to change)', () => {
17
+ expect(toSpoken('Yesterday you added 12 new to-dos.', TODAY)).toBeNull();
18
+ });
19
+ });
@@ -107,6 +107,38 @@ describe('what End pulls asks out of', () => {
107
107
  });
108
108
  });
109
109
 
110
+ describe('a wrap-up phrase is never an ask', () => {
111
+ // The worst-case extractor: every line it is given becomes an ask.
112
+ const echo = async ({ transcript }: { transcript: string }) => ({ asks: transcript.split('\n').filter((l) => l.startsWith('- ')).map((l) => l.slice(2)), decisions: [] });
113
+
114
+ it('a statement then "parse that note" typed as a normal turn: the command is not filed (0 beyond the statement)', async () => {
115
+ const { deps } = setup();
116
+ const withBrain = { ...deps, extract: echo, handoff: async () => undefined };
117
+ const first = await handleConverseTurn(withBrain as never, { text: 'The video for landing pages is finished and published, so that item is done.' });
118
+ await handleConverseTurn(withBrain as never, { text: 'parse that note', conversationId: first.conversation_id });
119
+ const done = await handleConverseEnd(withBrain as never, { conversationId: first.conversation_id });
120
+ expect(done.asks).toEqual(['The video for landing pages is finished and published, so that item is done.']);
121
+ expect(done.asks.join(' ')).not.toMatch(/parse that note/i);
122
+ });
123
+
124
+ it.each(['parse that note', "that's it", "I'm done", 'file it', 'wrap it up', 'save the note', 'done'])('a conversation whose only content is "%s" files nothing', async (phrase) => {
125
+ const { deps } = setup();
126
+ const withBrain = { ...deps, extract: echo, handoff: async () => undefined };
127
+ const first = await handleConverseTurn(withBrain as never, { text: phrase });
128
+ const done = await handleConverseEnd(withBrain as never, { conversationId: first.conversation_id });
129
+ expect(done.asks).toEqual([]);
130
+ });
131
+
132
+ it('a real task in turn 1 and the wrap-up on the wrap-up turn: one to-do, not two', async () => {
133
+ const { deps } = setup();
134
+ const brains = [{ text: 'Got it.', intent: 'note' as const }, { text: 'x', intent: 'note' as const, finish: true }];
135
+ const withBrain = { ...deps, brain: async () => brains.shift()!, extract: echo, handoff: async () => undefined };
136
+ const first = await handleConverseTurn(withBrain as never, { text: 'I need to call the bank on Friday' });
137
+ const last = await handleConverseTurn(withBrain as never, { text: 'parse that note', conversationId: first.conversation_id });
138
+ expect(last.filed).toEqual({ note: true, todos: 1 });
139
+ });
140
+ });
141
+
110
142
  describe('End never files a question as an ask', () => {
111
143
  it('a conversation that is only the question "Is the to-do ... overdue?" gives the extractor nothing and files nothing', async () => {
112
144
  const { deps } = setup();
@@ -127,6 +159,30 @@ describe('End never files a question as an ask', () => {
127
159
  });
128
160
  });
129
161
 
162
+ describe('what is said after wrapping up', () => {
163
+ it('names what was filed: the first three titles and a count', async () => {
164
+ const { deps, t } = setup();
165
+ const asks = ['Call the bank', 'Review the checkout copy', 'Order the bench', 'Pay rent', 'Check the greenhouse'];
166
+ const brains = [{ text: 'Got it.', intent: 'note' as const }, { text: 'Filing it now.', intent: 'note' as const, finish: true }];
167
+ const withBrain = { ...deps, brain: async () => brains.shift()!, extract: async () => ({ asks, decisions: [] }), handoff: async () => undefined };
168
+ const first = await handleConverseTurn(withBrain as never, { text: 'a long note about my day' });
169
+ const last = await handleConverseTurn(withBrain as never, { text: 'parse that note', conversationId: first.conversation_id });
170
+ expect(last.reply_text).toBe('Filed the note and 5 to-dos: Call the bank, Review the checkout copy, Order the bench, and 2 more.');
171
+ const row = [...t.rows.values()].find((r) => r.data.source === 'conversation')!;
172
+ expect(row.data.status).toBe('ended');
173
+ expect(row.data.turns).toHaveLength(2);
174
+ expect(row.data.turns[1].assistant.text).toBe(last.reply_text);
175
+ });
176
+ it('a note with nothing to file says so', async () => {
177
+ const { deps } = setup();
178
+ const brains = [{ text: 'Got it.', intent: 'note' as const }, { text: 'Filing it now.', intent: 'note' as const, finish: true }];
179
+ const withBrain = { ...deps, brain: async () => brains.shift()!, extract: async () => ({ asks: [], decisions: [] }), handoff: async () => undefined };
180
+ const first = await handleConverseTurn(withBrain as never, { text: 'just thinking out loud' });
181
+ const last = await handleConverseTurn(withBrain as never, { text: "that's it", conversationId: first.conversation_id });
182
+ expect(last.reply_text).toBe('Filed the note.');
183
+ });
184
+ });
185
+
130
186
  describe('the turn wraps the conversation up itself', () => {
131
187
  it('"parse that note" ends it through the normal End: ended true, filed counts, the next message starts fresh', async () => {
132
188
  const { deps, t } = setup();
@@ -145,7 +201,7 @@ describe('the turn wraps the conversation up itself', () => {
145
201
  expect(first).toMatchObject({ intent: 'note' });
146
202
  expect(first.ended).toBeUndefined();
147
203
  const last = await handleConverseTurn(withBrain as never, { text: 'parse that note', conversationId: first.conversation_id });
148
- expect(last).toMatchObject({ ended: true, filed: { note: true, todos: 2 }, intent: 'note', reply_text: 'Filing it now.' });
204
+ expect(last).toMatchObject({ ended: true, filed: { note: true, todos: 2 }, intent: 'note', reply_text: 'Filed the note and 2 to-dos: Call the bank and Review the checkout copy.' });
149
205
  expect(filed).toHaveLength(1);
150
206
  expect([...t.rows.values()].find((r) => r.data.source === 'conversation')!.data.status).toBe('ended');
151
207
  });
@@ -159,6 +215,41 @@ describe('the turn wraps the conversation up itself', () => {
159
215
  });
160
216
  });
161
217
 
218
+ describe('the items an answer listed are kept for follow-ups', () => {
219
+ it('the next turn gets them, and End clears them', async () => {
220
+ const { deps, t } = setup();
221
+ const seen: unknown[] = [];
222
+ const turns = [{ text: 'Two things are due.', context: { items: [{ id: 'a', title: 'A' }, { id: 'b', title: 'B' }] } }, { text: 'Moved.' }];
223
+ const withBrain = { ...deps, brain: async (input: any) => { seen.push(input.context); return turns.shift()!; } };
224
+ const first = await handleConverseTurn(withBrain as never, { text: 'what is due' });
225
+ const row = () => [...t.rows.values()].find((r) => r.data.source === 'conversation');
226
+ expect(row().data.context.items).toHaveLength(2);
227
+ await handleConverseTurn(withBrain as never, { text: 'move the second one', conversationId: first.conversation_id });
228
+ expect(seen[0]).toBeNull();
229
+ expect((seen[1] as any).items.map((i: any) => i.id)).toEqual(['a', 'b']);
230
+ await handleConverseEnd(withBrain as never, { conversationId: first.conversation_id });
231
+ expect(row().data.context).toBeNull();
232
+ });
233
+ });
234
+
235
+ describe('the voice says dates and ids the way a person would, the screen keeps the text', () => {
236
+ it('speaks "Friday" for an ISO date and drops the ticket id; stores the text as written', async () => {
237
+ const { deps, t } = setup();
238
+ const said: string[] = [];
239
+ const withBrain = {
240
+ ...deps,
241
+ brain: async () => ({ text: 'Plan the week (due 2026-11-20, SIM-12).' }),
242
+ synthesize: async ({ text }: { text: string }) => { said.push(text); return { audio: new Uint8Array([1]), mimeType: 'audio/mpeg' } as never; },
243
+ };
244
+ const out = await handleConverseTurn(withBrain as never, { text: 'what is due', timeZone: 'America/Denver', conversationId: undefined });
245
+ expect(out.reply_text).toBe('Plan the week (due 2026-11-20, SIM-12).');
246
+ expect(said).toHaveLength(1);
247
+ expect(said[0]).not.toMatch(/2026|SIM-/);
248
+ expect(said[0]).toMatch(/Plan the week/);
249
+ expect([...t.rows.values()][0].data.turns[0].assistant.text).toBe('Plan the week (due 2026-11-20, SIM-12).');
250
+ });
251
+ });
252
+
162
253
  describe('where the time went', () => {
163
254
  it('reports each step of a fresh turn, with the brain steps, once, and not on a replay', async () => {
164
255
  const { deps } = setup();
@@ -0,0 +1,22 @@
1
+ import { render, screen } from '@testing-library/react';
2
+ import { describe, expect, it } from 'vitest';
3
+
4
+ import { CompactItemRow } from '../components/pages/home/CompactItemRow';
5
+ import type { Commitment } from '../corpus/types';
6
+
7
+ const item = (mentions: Commitment['mentions']) => ({ id: '1', externalId: 'c1', title: 'Send the draft', status: 'open', mentions }) as unknown as Commitment;
8
+
9
+ describe('CompactItemRow meeting evidence', () => {
10
+ it('shows the latest meeting line on the item, and how many more', () => {
11
+ render(<ul><CompactItemRow item={item([
12
+ { documentId: 'd1', originKey: 'a', occurredAt: '2026-11-10T10:00:00Z', quote: 'old line', extractor: 'model' },
13
+ { documentId: 'd2', originKey: 'b', occurredAt: '2026-11-15T10:00:00Z', quote: 'send it Friday', extractor: 'model' },
14
+ ])} days={2} due={null} /></ul>);
15
+ expect(screen.getByTestId('item-evidence').textContent).toContain('send it Friday');
16
+ expect(screen.getByTestId('item-evidence').textContent).toContain('+1 more');
17
+ });
18
+ it('shows nothing for an item with no meeting behind it', () => {
19
+ render(<ul><CompactItemRow item={item([])} days={2} due={null} /></ul>);
20
+ expect(screen.queryByTestId('item-evidence')).toBeNull();
21
+ });
22
+ });
@@ -0,0 +1,20 @@
1
+ import { render, screen, waitFor } from '@testing-library/react';
2
+ import { describe, expect, it } from 'vitest';
3
+
4
+ import { OverviewPage } from '../components/pages/overview/OverviewPage';
5
+
6
+ const page = <T,>(results: T[]) => ({ count: results.length, next: null, previous: null, results });
7
+ const people = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H'];
8
+ const api = {
9
+ listFocuses: async () => page([{ id: 'f1', title: 'Alpha', status: 'active' }]),
10
+ listCommitments: async () => page(people.map((n, i) => ({ id: String(i), externalId: `c${i}`, title: `task ${n}`, status: 'open', ownerName: n, focusId: 'f1', mentions: [], dueAt: null, lastSeenAt: null }))),
11
+ } as never;
12
+
13
+ describe('OverviewPage with many people', () => {
14
+ it('shows a few columns plus Others, and every person still has a chip', async () => {
15
+ render(<OverviewPage api={api} scope={{} as never} onOpenProject={() => {}} />);
16
+ await waitFor(() => expect(screen.getAllByText('Alpha').length).toBeGreaterThan(0));
17
+ expect(screen.getAllByRole('columnheader').map((h) => h.textContent)).toEqual(['Project', 'A', 'B', 'C', 'D', 'E', 'Others (3)', 'Last activity']);
18
+ for (const n of people) expect(screen.getByRole('button', { name: new RegExp(`^${n} · 1$`) })).toBeTruthy();
19
+ });
20
+ });
@@ -0,0 +1,52 @@
1
+ import { describe, expect, it } from 'vitest';
2
+
3
+ import { buildOverview, NO_PROJECT } from '../corpus/overview';
4
+ import type { Commitment, Focus } from '../corpus/types';
5
+
6
+ const focus = (id: string, title: string, status: Focus['status'] = 'active') => ({ id, title, status }) as unknown as Focus;
7
+ const item = (id: string, over: Partial<Commitment> & { focusId?: string }) =>
8
+ ({ id, title: `t${id}`, status: 'open', ownerName: undefined, dueAt: null, lastSeenAt: null, ...over }) as unknown as Commitment & { focusId?: string };
9
+
10
+ describe('buildOverview', () => {
11
+ it('makes columns from whoever owns open items, Me first, with no names built in', () => {
12
+ const o = buildOverview(
13
+ [focus('f1', 'Alpha')],
14
+ [item('1', { focusId: 'f1', ownerName: 'Sam' }), item('2', { focusId: 'f1', ownerName: 'Sam' }), item('3', { focusId: 'f1', ownerName: 'Riley' }), item('4', { focusId: 'f1', ownerName: 'Quinn' })],
15
+ { meNames: ['quinn'] },
16
+ );
17
+ expect(o.columns.map((c) => c.label)).toEqual(['Me', 'Sam', 'Riley']);
18
+ expect(o.rows[0].cells.sam.count).toBe(2);
19
+ });
20
+
21
+ it('counts only open work and puts unfiled and closed-project items under No project', () => {
22
+ const o = buildOverview(
23
+ [focus('f1', 'Alpha'), focus('f2', 'Done one', 'completed')],
24
+ [item('1', { focusId: 'f1' }), item('2', { focusId: 'f1', status: 'done' }), item('3', {}), item('4', { focusId: 'f2' })],
25
+ );
26
+ expect(o.rows.map((r) => r.id)).toEqual(['f1', NO_PROJECT]);
27
+ expect(o.rows[0].open).toBe(1);
28
+ expect(o.rows[1].open).toBe(2);
29
+ expect(o.columns.map((c) => c.label)).toEqual(['Unassigned']);
30
+ });
31
+
32
+ it('shows what needs attention first and picks the most urgent next item per cell', () => {
33
+ const o = buildOverview(
34
+ [focus('a', 'Calm'), focus('b', 'Risky', 'at_risk')],
35
+ [item('1', { focusId: 'a', ownerName: 'X' }), item('2', { focusId: 'b', ownerName: 'X', dueAt: '2030-01-02T00:00:00Z' }), item('3', { focusId: 'b', ownerName: 'X', dueAt: '2030-01-01T00:00:00Z' })],
36
+ { now: Date.parse('2029-01-01') },
37
+ );
38
+ expect(o.rows.map((r) => r.id)).toEqual(['b', 'a']);
39
+ expect(o.rows[0].cells.x.next?.id).toBe('3');
40
+ });
41
+ });
42
+
43
+ describe('buildOverview pointer fallback', () => {
44
+ it('files an item under the project its external_focus_id names when there is no link, and ignores a pointer to nothing', () => {
45
+ const o = buildOverview(
46
+ [focus('f1', 'Alpha')],
47
+ [item('1', { externalFocusId: 'f1' } as never), item('2', { externalFocusId: 'gone' } as never), item('3', { focusId: 'f1', externalFocusId: 'other' } as never)],
48
+ );
49
+ expect(o.rows.find((r) => r.id === 'f1')?.open).toBe(2);
50
+ expect(o.rows.find((r) => r.id === NO_PROJECT)?.open).toBe(1);
51
+ });
52
+ });
@@ -81,3 +81,4 @@ export * from './pages/home';
81
81
  export * from './pages/questions';
82
82
  export * from './pages/task-tracker/OwnerPicker';
83
83
  export * from './pages/plan';
84
+ export * from './pages/overview';
@@ -109,6 +109,8 @@ export interface TrackerPageProps {
109
109
  * added from the box is filed under it too. This is how a project's to-dos are "the same list, filtered".
110
110
  */
111
111
  focusId?: string;
112
+ /** Pre-fill the filter box (e.g. an owner's name arriving from the Overview). */
113
+ initialSearch?: string;
112
114
  classNames?: Partial<Record<TrackerSlot, string>>;
113
115
  }
114
116
 
@@ -151,6 +153,7 @@ export function TrackerPage({
151
153
  timeZone,
152
154
  showTimeline = true,
153
155
  focusId,
156
+ initialSearch,
154
157
  classNames = {},
155
158
  }: TrackerPageProps) {
156
159
  const foundTracker = useTrackerName(trackerNameProp ? undefined : memberConnections);
@@ -358,7 +361,7 @@ export function TrackerPage({
358
361
  // `sweepEpoch` re-arms the poll after the button starts a new one.
359
362
  }, [canQueue, pollMs, maxAutoResumes, scope.orgId, sweepEpoch]);
360
363
 
361
- const [filterText, setFilterText] = React.useState('');
364
+ const [filterText, setFilterText] = React.useState(initialSearch ?? '');
362
365
  type QuickKey = 'all' | 'overdue' | 'blocked' | 'in_progress';
363
366
  const [quick, setQuick] = React.useState<QuickKey>('all');
364
367
  /** Client-side narrowing over the loaded page: title, owner, subject or project name. */