@startsimpli/integrations 0.2.145 → 0.2.147

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 (76) hide show
  1. package/package.json +3 -3
  2. package/src/__tests__/briefing-actions.test.ts +2 -0
  3. package/src/__tests__/briefing-reply.test.ts +334 -0
  4. package/src/__tests__/corpus-tracker.test.tsx +79 -0
  5. package/src/__tests__/extract-classify.test.ts +9 -4
  6. package/src/__tests__/owner-backfill.test.ts +114 -0
  7. package/src/__tests__/owner-link.test.ts +115 -0
  8. package/src/__tests__/owner-picker.test.tsx +70 -0
  9. package/src/__tests__/private-items.test.ts +63 -0
  10. package/src/__tests__/roster.test.ts +27 -0
  11. package/src/__tests__/task-detail-private.test.tsx +44 -0
  12. package/src/__tests__/tracker-sort.test.ts +28 -0
  13. package/src/components/index.ts +1 -0
  14. package/src/components/pages/TaskDetailPage.tsx +51 -2
  15. package/src/components/pages/TrackerPage.tsx +28 -6
  16. package/src/components/pages/task-tracker/OwnerPicker.tsx +82 -0
  17. package/src/components/pages/tracker/TrackerBoard.tsx +45 -0
  18. package/src/components/pages/tracker/TrackerToolbar.tsx +44 -0
  19. package/src/corpus/briefing/actions/execute.ts +5 -4
  20. package/src/corpus/briefing/actions/log.ts +1 -1
  21. package/src/corpus/briefing/actions/types.ts +21 -0
  22. package/src/corpus/briefing/index.ts +1 -0
  23. package/src/corpus/briefing/intent/model.ts +3 -0
  24. package/src/corpus/briefing/intent/resolve.ts +14 -6
  25. package/src/corpus/briefing/intent/types.ts +7 -0
  26. package/src/corpus/briefing/reply/handle.ts +174 -0
  27. package/src/corpus/briefing/reply/index.ts +6 -0
  28. package/src/corpus/briefing/reply/respond.ts +95 -0
  29. package/src/corpus/briefing/reply/types.ts +112 -0
  30. package/src/corpus/briefing/store.ts +14 -0
  31. package/src/corpus/client.ts +24 -18
  32. package/src/corpus/entities.ts +7 -0
  33. package/src/corpus/extract.ts +21 -0
  34. package/src/corpus/index.ts +4 -0
  35. package/src/corpus/owner-backfill.ts +200 -0
  36. package/src/corpus/owner-link.ts +160 -0
  37. package/src/corpus/roster.ts +53 -0
  38. package/src/corpus/tracker-groups.ts +8 -4
  39. package/src/corpus/tracker-sort.ts +51 -0
  40. package/src/corpus/types.ts +24 -1
  41. package/src/native/app/FoundryApp.tsx +25 -7
  42. package/src/native/app/__tests__/briefingLink.test.tsx +57 -0
  43. package/src/native/app/__tests__/briefingServices.test.ts +92 -0
  44. package/src/native/app/__tests__/launch.test.ts +2 -1
  45. package/src/native/app/briefingServices.ts +101 -0
  46. package/src/native/app/config/__tests__/briefingConfig.test.ts +49 -0
  47. package/src/native/app/config/links.ts +4 -1
  48. package/src/native/app/config/types.ts +13 -1
  49. package/src/native/app/config/validate.ts +20 -2
  50. package/src/native/app/data.ts +3 -3
  51. package/src/native/app/device.ts +3 -0
  52. package/src/native/app/launch.ts +4 -0
  53. package/src/native/app/registry.tsx +3 -1
  54. package/src/native/app/screens/RecordScreen.tsx +3 -2
  55. package/src/native/app/services.ts +11 -30
  56. package/src/native/app/strings.ts +28 -0
  57. package/src/native/briefing/BriefingCard.tsx +14 -2
  58. package/src/native/briefing/BriefingReply.tsx +68 -0
  59. package/src/native/briefing/__tests__/BriefingReply.test.tsx +144 -0
  60. package/src/native/briefing/__tests__/fakeReply.test.ts +46 -0
  61. package/src/native/briefing/__tests__/notify.test.ts +42 -1
  62. package/src/native/briefing/__tests__/replyApi.test.ts +43 -0
  63. package/src/native/briefing/__tests__/replyController.test.ts +230 -0
  64. package/src/native/briefing/__tests__/replyPosition.test.ts +116 -0
  65. package/src/native/briefing/audioPlayer.ts +9 -2
  66. package/src/native/briefing/controller.ts +50 -5
  67. package/src/native/briefing/fake.ts +25 -18
  68. package/src/native/briefing/fakeReply.ts +65 -0
  69. package/src/native/briefing/index.ts +8 -3
  70. package/src/native/briefing/notify.ts +42 -0
  71. package/src/native/briefing/reply.ts +261 -0
  72. package/src/native/briefing/replyApi.ts +82 -0
  73. package/src/native/recording/__tests__/deeplink.test.ts +20 -0
  74. package/src/native/recording/deeplink.ts +7 -0
  75. package/src/native/tracker/__tests__/itemsChanged.test.ts +13 -0
  76. package/src/native/tracker/tab.tsx +4 -1
@@ -0,0 +1,115 @@
1
+ import { describe, expect, it } from 'vitest';
2
+ import {
3
+ decodeOwnerSubs, encodeOwnerSubs, matchOwnerName, planOwnerLinks, splitOwnerNames,
4
+ } from '../corpus/owner-link';
5
+
6
+ const roster = [
7
+ { sub: 'u-quinn', email: 'quinn@x.com', name: 'Quinn Osha' },
8
+ { sub: 'u-jon', email: 'jonathan@x.com', name: 'Jonathan Osha' },
9
+ { sub: 'u-kate', email: 'kate@x.com', name: 'Kate Reyes' },
10
+ { sub: 'u-st1', email: 'st1@x.com', name: 'Stephanie Lee' },
11
+ { sub: 'u-st2', email: 'st2@x.com', name: 'Stephanie Lopez' },
12
+ { sub: 'u-noname', email: 'qosha@debugg.ai' },
13
+ { sub: 'u-qa', email: 'qa-tandem@startsimpli.com', name: 'Tandem QA' },
14
+ { sub: 'u-qa2', email: 'idf+tandem@foundry.local', name: 'Jude Test' },
15
+ ];
16
+
17
+ describe('splitOwnerNames', () => {
18
+ it('splits joint owners on comma, ampersand, "and", semicolon, slash', () => {
19
+ expect(splitOwnerNames('Jude, Jenny')).toEqual(['Jude', 'Jenny']);
20
+ expect(splitOwnerNames('Jonathan & Kevin')).toEqual(['Jonathan', 'Kevin']);
21
+ expect(splitOwnerNames('Kate and Quinn')).toEqual(['Kate', 'Quinn']);
22
+ expect(splitOwnerNames('Kate; Quinn / Megan')).toEqual(['Kate', 'Quinn', 'Megan']);
23
+ });
24
+ it('keeps a single name whole and drops blanks and duplicates', () => {
25
+ expect(splitOwnerNames('Jonathan Osha')).toEqual(['Jonathan Osha']);
26
+ expect(splitOwnerNames(' , Kate,kate ')).toEqual(['Kate']);
27
+ expect(splitOwnerNames('')).toEqual([]);
28
+ });
29
+ });
30
+
31
+ describe('matchOwnerName', () => {
32
+ it('links a unique first name and the full-name variants to one person', () => {
33
+ for (const text of ['Quinn', 'quinn', 'Quinn Osha', 'QUINN OSHA']) {
34
+ expect(matchOwnerName(text, roster)).toMatchObject({ status: 'linked', sub: 'u-quinn' });
35
+ }
36
+ });
37
+ it('links first+last across a middle name', () => {
38
+ const r = [{ sub: 'm', email: 'm@x.com', name: 'Megan Q. Fox' }];
39
+ expect(matchOwnerName('Megan Fox', r)).toMatchObject({ status: 'linked', sub: 'm' });
40
+ });
41
+ it('never merges an ambiguous first name', () => {
42
+ const m = matchOwnerName('Stephanie', roster);
43
+ expect(m.status).toBe('ambiguous');
44
+ expect(m.status === 'ambiguous' && m.candidates.sort()).toEqual(['u-st1', 'u-st2']);
45
+ });
46
+ it('an exact full name beats an ambiguous first name', () => {
47
+ expect(matchOwnerName('Stephanie Lee', roster)).toMatchObject({ status: 'linked', sub: 'u-st1' });
48
+ });
49
+ it('a surname alone never matches', () => {
50
+ expect(matchOwnerName('Osha', roster).status).toBe('unmatched');
51
+ });
52
+ it('same first name, different surname is not the same person', () => {
53
+ expect(matchOwnerName('Jonathan Smith', roster).status).toBe('unmatched');
54
+ });
55
+ it('a member with no name is never matched through their email', () => {
56
+ expect(matchOwnerName('qosha', roster).status).toBe('unmatched');
57
+ });
58
+ it('service and QA accounts are never candidates', () => {
59
+ expect(matchOwnerName('Jude', roster).status).toBe('unmatched');
60
+ expect(matchOwnerName('Tandem', roster).status).toBe('unmatched');
61
+ });
62
+ it('unknown names are unmatched', () => {
63
+ expect(matchOwnerName('Najima', roster).status).toBe('unmatched');
64
+ });
65
+ it('two roster rows for one sub are one person', () => {
66
+ const r = [...roster, { sub: 'u-quinn', email: 'q2@x.com', name: 'Quinn Osha' }];
67
+ expect(matchOwnerName('Quinn', r)).toMatchObject({ status: 'linked', sub: 'u-quinn' });
68
+ });
69
+ });
70
+
71
+ describe('declared aliases', () => {
72
+ const bare = [
73
+ { sub: 'a', email: 'qosha@debugg.ai', aliases: ['Quinn Osha'] },
74
+ { sub: 'b', email: 'jpo@ogmc.ai', aliases: ['Jonathan Osha'] },
75
+ { sub: 'c', email: 'sam@x.com' },
76
+ ];
77
+ it('match through declared aliases only', () => {
78
+ expect(matchOwnerName('Quinn', bare)).toMatchObject({ status: 'linked', sub: 'a' });
79
+ expect(matchOwnerName('Jonathan Osha', bare)).toMatchObject({ status: 'linked', sub: 'b' });
80
+ expect(matchOwnerName('Sam', bare).status).toBe('unmatched');
81
+ expect(matchOwnerName('Osha', bare).status).toBe('unmatched');
82
+ });
83
+ it('a roster with no names links nothing', () => {
84
+ expect(planOwnerLinks('Quinn, Jonathan', bare.map(({ aliases, ...m }) => m)).outcome).toBe('unmatched');
85
+ });
86
+ });
87
+
88
+ describe('planOwnerLinks', () => {
89
+ it('links the resolvable parts of a joint owner and reports the rest', () => {
90
+ const plan = planOwnerLinks('Jonathan Osha, Kevin', roster);
91
+ expect(plan.subs).toEqual(['u-jon']);
92
+ expect(plan.parts.map((p) => p.status)).toEqual(['linked', 'unmatched']);
93
+ expect(plan.outcome).toBe('partial');
94
+ });
95
+ it('classifies whole rows', () => {
96
+ expect(planOwnerLinks('Quinn', roster).outcome).toBe('linked');
97
+ expect(planOwnerLinks('Kate, Quinn', roster).subs).toEqual(['u-kate', 'u-quinn']);
98
+ expect(planOwnerLinks('Stephanie', roster).outcome).toBe('ambiguous');
99
+ expect(planOwnerLinks('Najima', roster).outcome).toBe('unmatched');
100
+ expect(planOwnerLinks('', roster).outcome).toBe('none');
101
+ });
102
+ it('two spellings of one person do not double-count', () => {
103
+ expect(planOwnerLinks('Jonathan, Jonathan Osha', roster).subs).toEqual(['u-jon']);
104
+ });
105
+ });
106
+
107
+ describe('owner_subs encoding', () => {
108
+ it('round-trips and is delimiter-safe for icontains filtering', () => {
109
+ expect(encodeOwnerSubs(['a', 'b'])).toBe('|a|b|');
110
+ expect(decodeOwnerSubs('|a|b|')).toEqual(['a', 'b']);
111
+ expect(decodeOwnerSubs(['a', 'b'])).toEqual(['a', 'b']);
112
+ expect(decodeOwnerSubs(undefined)).toEqual([]);
113
+ expect(encodeOwnerSubs([])).toBe('');
114
+ });
115
+ });
@@ -0,0 +1,70 @@
1
+ import { describe, expect, it, vi } from 'vitest';
2
+ import { render, screen, waitFor, fireEvent } from '@testing-library/react';
3
+
4
+ import { TaskDetailPage } from '../components/pages/TaskDetailPage';
5
+ import { toCommitment, commitmentToEntity, type TenantEntity } from '../corpus/entities';
6
+ import type { Commitment } from '../corpus/types';
7
+
8
+ const members = [
9
+ { sub: 'u-q', email: 'q@x.com', name: 'Quinn Osha' },
10
+ { sub: 'u-s1', email: 's1@x.com', name: 'Stephanie Lee' },
11
+ { sub: 'u-s2', email: 's2@x.com', name: 'Stephanie Lopez' },
12
+ ];
13
+
14
+ const make = (data: Record<string, unknown>): Commitment =>
15
+ toCommitment({
16
+ id: 'a', external_id: 'commit:a', name: 'a', entity_type: 'commitment', version: 1,
17
+ data: { title: 'Task a', status: 'open', subtype: 'action', mentions: [], ...data },
18
+ } as unknown as TenantEntity, { orgId: 'o' });
19
+
20
+ function setup(item: Commitment) {
21
+ const api = {
22
+ listCommitments: vi.fn(async (q: { page?: number } = {}) => ({ results: (q.page ?? 1) === 1 ? [item] : [], count: 1 })) as never,
23
+ updateCommitment: vi.fn(async (i: Commitment, patch: object) => ({ ...i, ...patch })) as never,
24
+ listMembers: vi.fn(async () => members),
25
+ };
26
+ render(<TaskDetailPage api={api} scope={{ orgId: 'o' } as never} itemId="commit:a" />);
27
+ return api;
28
+ }
29
+
30
+ describe('commitment joint owners round trip', () => {
31
+ it('reads owner_subs and writes it back', () => {
32
+ const c = make({ owner_name: 'Quinn, Kate', owner_sub: 'u-q', owner_subs: '|u-q|u-k|' });
33
+ expect(c.ownerSubs).toEqual(['u-q', 'u-k']);
34
+ expect((commitmentToEntity(c) as { data: Record<string, unknown> }).data.owner_subs).toBe('|u-q|u-k|');
35
+ });
36
+ });
37
+
38
+ describe('OwnerPicker in the task detail', () => {
39
+ it('offers a one-tap link for an unambiguous name and saves joint owners', async () => {
40
+ const api = setup(make({ owner_name: 'Quinn' }));
41
+ fireEvent.click(await screen.findByRole('button', { name: /link “quinn” to quinn osha/i }));
42
+ await waitFor(() => expect(api.updateCommitment).toHaveBeenCalledWith(
43
+ expect.anything(), { ownerSubs: ['u-q'], ownerSub: 'u-q' }));
44
+ fireEvent.change(await screen.findByLabelText('Add owner'), { target: { value: 'u-s1' } });
45
+ await waitFor(() => expect(api.updateCommitment).toHaveBeenLastCalledWith(
46
+ expect.anything(), { ownerSubs: ['u-q', 'u-s1'], ownerSub: 'u-q' }));
47
+ });
48
+
49
+ it('never picks for an ambiguous name: shows the candidates', async () => {
50
+ const api = setup(make({ owner_name: 'Stephanie' }));
51
+ expect(await screen.findByText(/which “stephanie”/i)).toBeInTheDocument();
52
+ expect(api.updateCommitment).not.toHaveBeenCalled();
53
+ fireEvent.click(screen.getByRole('button', { name: 'Stephanie Lopez' }));
54
+ await waitFor(() => expect(api.updateCommitment).toHaveBeenCalledWith(
55
+ expect.anything(), { ownerSubs: ['u-s2'], ownerSub: 'u-s2' }));
56
+ });
57
+
58
+ it('says plainly when the name is not a member, and keeps the text', async () => {
59
+ setup(make({ owner_name: 'Najima' }));
60
+ expect(await screen.findByText(/“najima” is not a workspace member/i)).toBeInTheDocument();
61
+ expect(screen.getByText('Najima')).toBeInTheDocument();
62
+ });
63
+
64
+ it('removing a linked owner leaves the original text', async () => {
65
+ const api = setup(make({ owner_name: 'Quinn', owner_sub: 'u-q', owner_subs: '|u-q|' }));
66
+ fireEvent.click(await screen.findByRole('button', { name: /remove quinn osha/i }));
67
+ await waitFor(() => expect(api.updateCommitment).toHaveBeenCalledWith(
68
+ expect.anything(), { ownerSubs: [], ownerSub: '' }));
69
+ });
70
+ });
@@ -0,0 +1,63 @@
1
+ /**
2
+ * PERSONAL SECTIONS BECOME PRIVATE ITEMS (bd startsim-768w.38.48).
3
+ *
4
+ * A voice note's Personal section must never reach teammates. The tenant enforces
5
+ * it (row scope `visibility`); this is the writer's half: the item is written with
6
+ * `visibility: private`, whether or not the classifier called it personal, and a
7
+ * project item is never marked.
8
+ */
9
+ import { describe, expect, it } from 'vitest';
10
+
11
+ import { commitmentToEntity } from '../corpus/entities';
12
+ import { extractCommitments } from '../corpus/extract';
13
+ import { toSourceDocument } from '../corpus/entities';
14
+ import { NOV5_SUMMARY } from './fixtures/nov5-note';
15
+ import type { Commitment, CorpusExtractorLlm } from '../corpus/types';
16
+ import { isPersonalItem } from '../corpus/extract';
17
+
18
+ const SCOPE = { orgId: 'o' } as never;
19
+ const note = () =>
20
+ toSourceDocument(
21
+ { id: 'e527a7f5', name: 'Nov 5', data: { source: 'voice', title: 'Nov 5 note', summary: NOV5_SUMMARY, body: '' } } as never,
22
+ SCOPE,
23
+ );
24
+
25
+ describe('private items from a voice note', () => {
26
+ it('marks every item under a Personal heading private, even with NO classifier', async () => {
27
+ const saved: Commitment[] = [];
28
+ const document = note();
29
+ const corpus = {
30
+ listDocuments: async () => ({ count: 1, next: null, previous: null, results: [document] }),
31
+ getDocument: async () => document,
32
+ listParties: async () => ({ count: 0, next: null, previous: null, results: [] }),
33
+ listSources: async () => [],
34
+ listCommitments: async () => ({ count: 0, next: null, previous: null, results: [] }),
35
+ saveCommitments: async (items: Commitment[]) => { saved.push(...items); },
36
+ } as never;
37
+ const extractor: CorpusExtractorLlm = {
38
+ describe: () => ({ provider: 'fixture', model: 'fixture', live: false }),
39
+ extract: async () => ({ items: [], resolutions: [] }),
40
+ };
41
+ await extractCommitments({ scope: SCOPE }, { corpus, extractor });
42
+ const personal = saved.filter((i) => i.mentions.some((m) => /^personal/i.test(m.section ?? '')));
43
+ const shared = saved.filter((i) => !personal.includes(i));
44
+ expect(personal.length).toBeGreaterThan(0);
45
+ expect(shared.length).toBeGreaterThan(0);
46
+ expect(personal.every((i) => i.visibility === 'private' && i.destination === 'personal' && !i.focusId)).toBe(true);
47
+ expect(shared.every((i) => i.visibility === undefined)).toBe(true);
48
+ });
49
+
50
+ it('the classifier calling an item personal is enough, whatever the heading', () => {
51
+ expect(isPersonalItem({ destination: 'personal', mentions: [] })).toBe(true);
52
+ expect(isPersonalItem({ mentions: [{ section: 'Crochets' }] as never })).toBe(false);
53
+ expect(isPersonalItem({ mentions: [{ section: ' personal ' }] as never })).toBe(true);
54
+ expect(isPersonalItem({ mentions: [{ section: 'Personal projects' }] as never })).toBe(true);
55
+ expect(isPersonalItem({ mentions: [{ section: 'Impersonal' }] as never })).toBe(false);
56
+ });
57
+
58
+ it('is written to the row, and only when private', () => {
59
+ const base = { externalId: 'x', title: 't', status: 'open', mentions: [], subjectKey: '', actionKey: '', dedupeKey: 'd', firstSeenAt: '', lastSeenAt: '', extractorVersion: 'v', source: 'voice' } as unknown as Commitment;
60
+ expect(commitmentToEntity({ ...base, visibility: 'private' }).data.visibility).toBe('private');
61
+ expect('visibility' in commitmentToEntity(base).data).toBe(false);
62
+ });
63
+ });
@@ -0,0 +1,27 @@
1
+ import { describe, expect, it } from 'vitest';
2
+ import { readRoster } from '../corpus/roster';
3
+
4
+ const paths = { members: 'm', roster: 'r' };
5
+
6
+ describe('readRoster', () => {
7
+ it('joins names from the member roster to emails from the admin list', async () => {
8
+ const http = { async get(path: string, o?: { params?: Record<string, unknown> }) {
9
+ if (path === 'r') return o?.params?.cursor
10
+ ? { results: [{ sub: 'b', label: 'Kate' }], next_cursor: null }
11
+ : { results: [{ sub: 'a', label: 'Quinn' }], next_cursor: 'c2' };
12
+ return { results: [{ user: { sub: 'a', email: 'q@x.com' } }, { user: { sub: 'b', email: 'k@x.com' } }] };
13
+ } } as never;
14
+ expect(await readRoster(http, paths)).toEqual([
15
+ { sub: 'a', email: 'q@x.com', name: 'Quinn' }, { sub: 'b', email: 'k@x.com', name: 'Kate' }]);
16
+ });
17
+ it('still serves names when the admin-only members list is refused', async () => {
18
+ const http = { async get(path: string) {
19
+ if (path === 'm') throw new Error('403');
20
+ return { results: [{ sub: 'a', label: 'Quinn' }] };
21
+ } } as never;
22
+ expect(await readRoster(http, paths)).toEqual([{ sub: 'a', email: '', name: 'Quinn' }]);
23
+ });
24
+ it('is empty, not an error, when neither is available', async () => {
25
+ expect(await readRoster({ get: async () => { throw new Error('x'); } } as never, paths)).toEqual([]);
26
+ });
27
+ });
@@ -0,0 +1,44 @@
1
+ /**
2
+ * An item's owner can make it private (readable by them alone) and shared again
3
+ * from its detail page (bd startsim-768w.38.48). The tenant enforces it; this is
4
+ * the control and the badge.
5
+ */
6
+ import { describe, expect, it, vi } from 'vitest';
7
+ import { render, screen, waitFor, fireEvent } from '@testing-library/react';
8
+
9
+ import { TaskDetailPage } from '../components/pages/TaskDetailPage';
10
+ import { toCommitment, type TenantEntity } from '../corpus/entities';
11
+ import type { Commitment, CommitmentApi } from '../corpus/types';
12
+
13
+ const make = (data: Record<string, unknown> = {}): Commitment =>
14
+ toCommitment({
15
+ id: 'a', external_id: 'commit:a', name: 'a', entity_type: 'commitment', version: 1,
16
+ data: { title: 'Task a', status: 'open', subtype: 'action', mentions: [], ...data },
17
+ } as unknown as TenantEntity, { orgId: 'o' });
18
+
19
+ function apiWith(item: Commitment): CommitmentApi & { updateCommitment: ReturnType<typeof vi.fn> } {
20
+ return {
21
+ listCommitments: vi.fn(async (q: { page?: number } = {}) => ({ results: (q.page ?? 1) === 1 ? [item] : [], count: 1 })) as never,
22
+ updateCommitment: vi.fn(async (it: Commitment, patch: object) => ({ ...it, ...patch })) as never,
23
+ };
24
+ }
25
+
26
+ describe('private items', () => {
27
+ it('a shared item offers "Make private" and sends visibility: private', async () => {
28
+ const api = apiWith(make());
29
+ render(<TaskDetailPage api={api} scope={{ orgId: 'o' } as never} itemId="commit:a" />);
30
+ fireEvent.click(await screen.findByRole('button', { name: /make private/i }));
31
+ await waitFor(() => expect(api.updateCommitment).toHaveBeenCalledWith(expect.anything(), { visibility: 'private' }));
32
+ expect(await screen.findByText(/only you can see this/i)).toBeInTheDocument();
33
+ expect(screen.getByRole('button', { name: /share with the team/i })).toBeInTheDocument();
34
+ });
35
+
36
+ it('a private item is badged and can be shared again (visibility: null)', async () => {
37
+ const api = apiWith(make({ visibility: 'private' }));
38
+ render(<TaskDetailPage api={api} scope={{ orgId: 'o' } as never} itemId="commit:a" />);
39
+ expect(await screen.findByText(/only you can see this/i)).toBeInTheDocument();
40
+ fireEvent.click(screen.getByRole('button', { name: /share with the team/i }));
41
+ await waitFor(() => expect(api.updateCommitment).toHaveBeenCalledWith(expect.anything(), { visibility: null }));
42
+ expect(await screen.findByRole('button', { name: /make private/i })).toBeInTheDocument();
43
+ });
44
+ });
@@ -0,0 +1,28 @@
1
+ import { describe, expect, it } from 'vitest';
2
+
3
+ import { commitmentOrder, compareCommitments } from '../corpus/tracker-sort';
4
+ import { groupTracker } from '../corpus/tracker-groups';
5
+
6
+ const row = (o: Record<string, unknown>) => ({ title: '', ...o }) as never;
7
+
8
+ describe('tracker sort', () => {
9
+ it('maps each key to a declared-attribute server order, due by default', () => {
10
+ expect(commitmentOrder()).toBe('attr.due_at');
11
+ expect(commitmentOrder('updated')).toBe('-attr.last_seen_at');
12
+ expect(commitmentOrder('title')).toBe('attr.title');
13
+ expect(commitmentOrder('owner')).toBe('attr.owner_name');
14
+ });
15
+
16
+ it('puts a missing owner or date last, never first', () => {
17
+ const rows = [row({ title: 'x', ownerName: undefined }), row({ title: 'y', ownerName: 'Amy' })];
18
+ expect(rows.sort(compareCommitments('owner')).map((r: { title: string }) => r.title)).toEqual(['y', 'x']);
19
+ const dated = [row({ title: 'none' }), row({ title: 'soon', dueAt: '2026-08-01T00:00:00Z' })];
20
+ expect(dated.sort(compareCommitments('due')).map((r: { title: string }) => r.title)).toEqual(['soon', 'none']);
21
+ });
22
+
23
+ it('groupTracker orders within groups by the sort', () => {
24
+ const mk = (title: string) => ({ title, status: 'open', subtype: 'action', dueAt: '2026-09-01T00:00:00Z', lastSeenAt: '2026-08-01T00:00:00Z', firstSeenAt: '2026-08-01T00:00:00Z' }) as never;
25
+ const g = groupTracker([mk('b'), mk('a')], { now: Date.parse('2026-08-10T00:00:00Z'), sort: 'title' });
26
+ expect(g.upNext.concat(g.later).map((e) => (e.item as { title: string }).title)).toEqual(['a', 'b']);
27
+ });
28
+ });
@@ -70,3 +70,4 @@ export * from './pages/VoiceNotesPage';
70
70
  export { VoiceRecordButton, VOICE_MIME_CANDIDATES } from './pages/VoiceRecordButton';
71
71
  export type { VoiceRecordButtonProps, VoiceRecordClassNames } from './pages/VoiceRecordButton';
72
72
  export * from './pages/home';
73
+ export * from './pages/task-tracker/OwnerPicker';
@@ -18,12 +18,17 @@ import type { Commitment, CommitmentApi, CommitmentStatus, CorpusScope } from '.
18
18
  import { isOverdue, priorityLabel } from '../../corpus/work-item-logic';
19
19
  import { isAuthored } from '../../corpus/planning';
20
20
  import { useTrackerName } from '../../task-tracker/useTrackerName';
21
+ import { OwnerPicker } from './task-tracker/OwnerPicker';
22
+ import type { RosterMember } from '../../corpus/owner-link';
21
23
  import { ExternalLinkChip } from './task-tracker/ExternalLinkChip';
22
24
  import { failureMessage } from './work-items';
23
25
  import type { MemberConnectionsApi } from './types';
24
26
 
25
27
  export interface TaskDetailPageProps {
26
- api: Pick<CommitmentApi, 'listCommitments' | 'updateCommitment'>;
28
+ api: Pick<CommitmentApi, 'listCommitments' | 'updateCommitment'> & {
29
+ /** The workspace roster; absent means the owner stays text, as before. */
30
+ listMembers?: () => Promise<RosterMember[]>;
31
+ };
27
32
  scope: CorpusScope;
28
33
  /** The item's `externalId` (`commit:<dedupeKey>`), as it appears in the route. */
29
34
  itemId: string;
@@ -79,6 +84,40 @@ export function TaskDetailPage({
79
84
  const [error, setError] = React.useState('');
80
85
  const [busy, setBusy] = React.useState(false);
81
86
  const [editing, setEditing] = React.useState(false);
87
+ const [members, setMembers] = React.useState<RosterMember[]>([]);
88
+ React.useEffect(() => {
89
+ let live = true;
90
+ void apiRef.current.listMembers?.().then((rows) => { if (live) setMembers(rows); }).catch(() => undefined);
91
+ return () => { live = false; };
92
+ }, []);
93
+
94
+ const setOwners = async (subs: string[]) => {
95
+ if (!item || !apiRef.current.updateCommitment) return;
96
+ setBusy(true);
97
+ setError('');
98
+ try {
99
+ const updated = await apiRef.current.updateCommitment(item, { ownerSubs: subs, ownerSub: subs[0] ?? '' });
100
+ setItem({ ...item, ...updated, ownerSubs: subs, ownerSub: subs[0] });
101
+ } catch (err) {
102
+ setError(failureMessage(err));
103
+ } finally {
104
+ setBusy(false);
105
+ }
106
+ };
107
+ const setPrivate = async (makePrivate: boolean) => {
108
+ if (!item || !apiRef.current.updateCommitment) return;
109
+ setBusy(true);
110
+ setError('');
111
+ try {
112
+ const updated = await apiRef.current.updateCommitment(item, { visibility: makePrivate ? 'private' : null });
113
+ const { visibility: _was, ...rest } = { ...item, ...updated };
114
+ setItem(makePrivate ? { ...rest, visibility: 'private' } : rest);
115
+ } catch (err) {
116
+ setError(failureMessage(err));
117
+ } finally {
118
+ setBusy(false);
119
+ }
120
+ };
82
121
  const [form, setForm] = React.useState({ title: '', detail: '', owner: '', due: '' });
83
122
 
84
123
  React.useEffect(() => {
@@ -169,6 +208,7 @@ export function TaskDetailPage({
169
208
  <div className="flex flex-wrap items-center gap-2">
170
209
  <span className={cn.badge}>{item.status.replace('_', ' ')}</span>
171
210
  {priority ? <span className={cn.badge}>{priority}</span> : null}
211
+ {item.visibility === 'private' ? <span className={cn.badge} title="Hidden from everyone else in the workspace">Private: only you can see this</span> : null}
172
212
  {project ? <span className={cn.badge}>{project}</span> : null}
173
213
  {item.sync ? <ExternalLinkChip sync={item.sync} trackerName={trackerName} className={cn.badge} /> : null}
174
214
  </div>
@@ -198,7 +238,13 @@ export function TaskDetailPage({
198
238
 
199
239
  <dl className="mt-3 grid grid-cols-[7rem_1fr] gap-y-1 text-sm">
200
240
  <dt className={cn.muted}>Owner</dt>
201
- <dd>{item.ownerName ? item.ownerName : <span className={cn.muted}>No owner named</span>}</dd>
241
+ <dd>
242
+ {members.length ? (
243
+ <OwnerPicker members={members} ownerName={item.ownerName}
244
+ value={item.ownerSubs?.length ? item.ownerSubs : item.ownerSub ? [item.ownerSub] : []}
245
+ onChange={(subs) => void setOwners(subs)} disabled={busy || !canWrite} mutedClassName={cn.muted} />
246
+ ) : item.ownerName ? item.ownerName : <span className={cn.muted}>No owner named</span>}
247
+ </dd>
202
248
  <dt className={cn.muted}>Due</dt>
203
249
  <dd>
204
250
  {item.dueAt
@@ -218,6 +264,9 @@ export function TaskDetailPage({
218
264
  {canWrite && !editing ? (
219
265
  <div className="mt-4 flex flex-wrap gap-2">
220
266
  <button type="button" className={cn.secondaryButton} disabled={busy} onClick={startEdit}>Edit</button>
267
+ <button type="button" className={cn.secondaryButton} disabled={busy} onClick={() => void setPrivate(item.visibility !== 'private')}>
268
+ {item.visibility === 'private' ? 'Share with the team' : 'Make private'}
269
+ </button>
221
270
  {closed ? (
222
271
  <button type="button" className={cn.secondaryButton} disabled={busy} onClick={() => void setStatus('open')}>Reopen</button>
223
272
  ) : (
@@ -33,11 +33,15 @@ import { useTrackerName } from '../../task-tracker/useTrackerName';
33
33
  import type { MemberConnectionsApi } from './types';
34
34
  import { failureMessage, unfilteredMessage } from './work-items';
35
35
  import { CompactItemRow } from './home/CompactItemRow';
36
+ import { TrackerBoard } from './tracker/TrackerBoard';
37
+ import { TrackerToolbar, type TrackerView } from './tracker/TrackerToolbar';
38
+ import { DEFAULT_TRACKER_SORT } from '../../corpus/tracker-sort';
36
39
  import { STALE_DAYS, groupTracker } from '../../corpus/tracker-groups';
37
40
  import type { TrackerEntry } from '../../corpus/tracker-groups';
38
41
  import type {
39
42
  Commitment,
40
43
  CommitmentQuery,
44
+ CommitmentSort,
41
45
  CommitmentStatus,
42
46
  CommitmentTrackerApi,
43
47
  CorpusScope,
@@ -175,8 +179,12 @@ export function TrackerPage({
175
179
  const [doneOpen, setDoneOpen] = React.useState(false);
176
180
  const [workspaceHasAny, setWorkspaceHasAny] = React.useState<boolean | null>(null);
177
181
 
182
+ const [sort, setSort] = React.useState<CommitmentSort>(DEFAULT_TRACKER_SORT);
183
+ const [view, setView] = React.useState<TrackerView>('list');
184
+
178
185
  const query = React.useMemo<CommitmentQuery>(
179
186
  () => ({
187
+ sort,
180
188
  // Everything still owed, one server page, with each item's project. The
181
189
  // groups below are computed over this set; the count says when it is only
182
190
  // the first page.
@@ -184,7 +192,7 @@ export function TrackerPage({
184
192
  withFocus: true,
185
193
  pageSize: 200,
186
194
  }),
187
- [],
195
+ [sort],
188
196
  );
189
197
 
190
198
  const load = React.useCallback(async () => {
@@ -352,8 +360,8 @@ export function TrackerPage({
352
360
  }, [filterText, quick, clock, projectNames]);
353
361
  const filtering = filterText.trim().length > 0 || quick !== 'all';
354
362
  const groups = React.useMemo(
355
- () => groupTracker(rows.filter(matches), { now: clock, timeZone }),
356
- [rows, matches, clock, timeZone],
363
+ () => groupTracker(rows.filter(matches), { now: clock, timeZone, sort }),
364
+ [rows, matches, clock, timeZone, sort],
357
365
  );
358
366
  const doneGroups = React.useMemo(
359
367
  () => (doneRows ? groupTracker(doneRows.filter(matches), { now: clock, timeZone }).done : []),
@@ -456,6 +464,9 @@ export function TrackerPage({
456
464
  </div>
457
465
  ) : null}
458
466
  {filtering && owed === 0 && rows.length > 0 ? <p className={cn.muted}>No to-dos match{filterText.trim() ? ` “${filterText.trim()}”` : ' this filter'}.</p> : null}
467
+ {rows.length > 0 ? (
468
+ <TrackerToolbar sort={sort} onSort={setSort} view={view} onView={setView} inputClassName={cn.input} />
469
+ ) : null}
459
470
  <div className="flex flex-wrap items-center gap-3">
460
471
  <p className={cn.muted} data-testid="tracker-summary">
461
472
  {loading ? 'Loading…' : `${owed} owed · ${c.today} today · ${c.inProgress} in progress`}
@@ -531,7 +542,18 @@ export function TrackerPage({
531
542
  </p>
532
543
  ) : null}
533
544
 
534
- {sections.map(({ key, label }) => (groups[key].length ? (
545
+ {view === 'board' ? (
546
+ <TrackerBoard
547
+ entries={[...groups.today, ...groups.inProgress, ...groups.upNext, ...groups.later, ...groups.stale]}
548
+ sort={sort}
549
+ headingClassName={cn.heading} mutedClassName={cn.muted}
550
+ renderRow={(entry) => rowFor(entry, canWrite ? {
551
+ actions: <button type="button" className={btn} onClick={() => void act(entry.item, { status: 'done' })}>Mark done</button>,
552
+ } : undefined)}
553
+ />
554
+ ) : null}
555
+
556
+ {view === 'list' ? sections.map(({ key, label }) => (groups[key].length ? (
535
557
  <section key={key} aria-label={label} className="space-y-1">
536
558
  <h2 className={`flex items-baseline gap-2 ${cn.heading}`}>
537
559
  {label} <span className="text-sm font-normal text-gray-500">{c[key]}</span>
@@ -542,7 +564,7 @@ export function TrackerPage({
542
564
  } : undefined))}
543
565
  </ul>
544
566
  </section>
545
- ) : null))}
567
+ ) : null)) : null}
546
568
 
547
569
  {total > rows.length ? (
548
570
  <p className={cn.muted}>
@@ -553,7 +575,7 @@ export function TrackerPage({
553
575
  </p>
554
576
  ) : null}
555
577
 
556
- {c.stale ? (
578
+ {c.stale && view === 'list' ? (
557
579
  <details className={fold}>
558
580
  <summary className={foldSummary}>Stale ({c.stale})
559
581
  <span className="ml-2 text-xs font-normal text-gray-500">no date, not touched in {STALE_DAYS}+ days</span>
@@ -0,0 +1,82 @@
1
+ /**
2
+ * WHO OWES THIS (bd startsim-768w.38.29): a multi-person owner field.
3
+ *
4
+ * The meeting's owner text stays visible. Beside it, the people it is linked to
5
+ * as workspace members, an add control, and, while nothing is linked, a
6
+ * suggestion per name: one tap to link when exactly one member matches, a choice
7
+ * between the candidates when several could be meant, and a plain note when the
8
+ * name is not a member at all. Nothing is ever auto-merged here.
9
+ */
10
+ import * as React from 'react';
11
+ import { planOwnerLinks } from '../../../corpus/owner-link';
12
+ import type { RosterMember } from '../../../corpus/owner-link';
13
+
14
+ export interface OwnerPickerProps {
15
+ members: RosterMember[];
16
+ /** What the meeting said, preserved verbatim. */
17
+ ownerName?: string;
18
+ /** The members currently linked. */
19
+ value: string[];
20
+ onChange: (subs: string[]) => void;
21
+ disabled?: boolean;
22
+ mutedClassName?: string;
23
+ buttonClassName?: string;
24
+ }
25
+
26
+ const labelOf = (members: RosterMember[], sub: string) => {
27
+ const m = members.find((x) => x.sub === sub);
28
+ return m?.name || m?.aliases?.[0] || m?.email || sub;
29
+ };
30
+
31
+ export function OwnerPicker({
32
+ members, ownerName, value, onChange, disabled, mutedClassName = 'text-sm text-gray-500',
33
+ buttonClassName = 'rounded-md border border-gray-300 px-2 py-0.5 text-xs text-gray-800 disabled:opacity-50',
34
+ }: OwnerPickerProps) {
35
+ const remaining = members.filter((m) => !value.includes(m.sub));
36
+ const suggestions = !value.length && ownerName ? planOwnerLinks(ownerName, members).parts : [];
37
+ const add = (sub: string) => { if (sub && !value.includes(sub)) onChange([...value, sub]); };
38
+
39
+ return (
40
+ <div data-testid="owner-picker" className="space-y-1">
41
+ {ownerName ? <div>{ownerName}</div> : <div className={mutedClassName}>No owner named</div>}
42
+ {value.length ? (
43
+ <ul className="flex flex-wrap gap-1" aria-label="Linked owners">
44
+ {value.map((sub) => (
45
+ <li key={sub} className="inline-flex items-center gap-1 rounded-full border border-gray-300 px-2 py-0.5 text-xs">
46
+ {labelOf(members, sub)}
47
+ <button type="button" aria-label={`Remove ${labelOf(members, sub)}`} disabled={disabled}
48
+ onClick={() => onChange(value.filter((s) => s !== sub))}>×</button>
49
+ </li>
50
+ ))}
51
+ </ul>
52
+ ) : null}
53
+ {suggestions.map((part) => (
54
+ <div key={part.text} className="flex flex-wrap items-center gap-1 text-xs">
55
+ {part.status === 'linked' ? (
56
+ <button type="button" className={buttonClassName} disabled={disabled} onClick={() => add(part.sub)}>
57
+ Link “{part.text}” to {labelOf(members, part.sub)}
58
+ </button>
59
+ ) : part.status === 'ambiguous' ? (
60
+ <>
61
+ <span className={mutedClassName}>Which “{part.text}”?</span>
62
+ {part.candidates.map((sub) => (
63
+ <button key={sub} type="button" className={buttonClassName} disabled={disabled} onClick={() => add(sub)}>
64
+ {labelOf(members, sub)}
65
+ </button>
66
+ ))}
67
+ </>
68
+ ) : (
69
+ <span className={mutedClassName}>“{part.text}” is not a workspace member</span>
70
+ )}
71
+ </div>
72
+ ))}
73
+ {members.length && remaining.length ? (
74
+ <select aria-label="Add owner" className="rounded-md border border-gray-300 px-2 py-1 text-xs" disabled={disabled}
75
+ value="" onChange={(e) => add(e.target.value)}>
76
+ <option value="">Add owner…</option>
77
+ {remaining.map((m) => <option key={m.sub} value={m.sub}>{labelOf(members, m.sub)}</option>)}
78
+ </select>
79
+ ) : null}
80
+ </div>
81
+ );
82
+ }