@startsimpli/integrations 0.2.179 → 0.2.180
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 +3 -3
- package/src/__tests__/converse-handoff.test.ts +129 -0
- package/src/__tests__/converse-meeting.test.ts +41 -0
- package/src/__tests__/converse-relay.test.ts +19 -3
- package/src/__tests__/home-brief.test.tsx +12 -24
- package/src/__tests__/home-needs-your-call.test.tsx +13 -16
- package/src/__tests__/plan-shell.test.tsx +160 -0
- package/src/components/DocumentDetail.tsx +15 -4
- package/src/components/documentText.ts +24 -0
- package/src/components/index.ts +1 -0
- package/src/components/pages/LibraryPage.tsx +4 -0
- package/src/components/pages/PlanningPage.tsx +20 -10
- package/src/components/pages/TrackerPage.tsx +16 -3
- package/src/components/pages/home/DueSoonLine.tsx +28 -0
- package/src/components/pages/home/HomeBriefPage.tsx +19 -52
- package/src/components/pages/home/index.ts +1 -3
- package/src/components/pages/plan/ProjectsPage.tsx +54 -0
- package/src/components/pages/plan/TalkPage.tsx +48 -0
- package/src/components/pages/plan/TimelinePage.tsx +33 -0
- package/src/components/pages/plan/index.ts +6 -0
- package/src/corpus/converse/handle.ts +10 -3
- package/src/corpus/converse/handled-asks.ts +29 -0
- package/src/corpus/converse/handoff.ts +52 -0
- package/src/corpus/converse/index.ts +4 -2
- package/src/corpus/converse/meeting.ts +23 -7
- package/src/corpus/converse/relay.ts +8 -4
- package/src/corpus/converse/store.ts +2 -0
- package/src/corpus/converse/transcript.ts +9 -0
- package/src/corpus/converse/types.ts +14 -0
- package/src/corpus/index.ts +2 -0
- package/src/corpus/nav-copy.ts +31 -0
- package/src/corpus/view-text.ts +3 -2
- package/src/native/__tests__/design-screens.test.tsx +3 -2
- package/src/native/app/FoundryApp.tsx +1 -1
- package/src/native/app/__tests__/plan-talk-registry.test.tsx +74 -0
- package/src/native/app/briefingServices.ts +1 -0
- package/src/native/app/config/defaults.ts +8 -2
- package/src/native/app/config/types.ts +1 -1
- package/src/native/app/converseServices.ts +1 -0
- package/src/native/app/registry.tsx +26 -6
- package/src/native/app/services.ts +3 -2
- package/src/native/components/NoteDetailScreen.tsx +16 -4
- package/src/native/components/__tests__/notes-screens.test.tsx +8 -8
- package/src/native/converse/ConverseScreen.tsx +24 -5
- package/src/native/converse/__tests__/liveScreen.test.tsx +15 -2
- package/src/native/home/HomeScreen.tsx +20 -7
- package/src/native/home/controller.ts +15 -5
- package/src/native/home/tab.tsx +31 -6
- package/src/native/plan/NewProjectRow.tsx +30 -0
- package/src/native/plan/PlanTab.tsx +105 -0
- package/src/native/plan/ProjectTodos.tsx +24 -0
- package/src/native/plan/TimelineScreen.tsx +68 -0
- package/src/native/plan/__tests__/plan-tab.test.tsx +76 -0
- package/src/native/plan/index.ts +5 -0
- package/src/native/plan/timeline.ts +56 -0
- package/src/native/recording/__tests__/recorderAudio.test.ts +10 -2
- package/src/native/recording/recorderAudio.ts +6 -2
- package/src/native/screens/__tests__/tabs.test.tsx +13 -0
- package/src/native/screens/ask/AskScreen.tsx +4 -2
- package/src/native/screens/library/LibraryDetailScreen.tsx +11 -4
- package/src/native/screens/planning/PlanningScreens.tsx +30 -13
- package/src/native/screens/tabs.tsx +5 -4
- package/src/native/talk/TalkTab.tsx +62 -0
- package/src/native/talk/__tests__/talk-tab.test.tsx +57 -0
- package/src/native/tracker/TrackerListScreen.tsx +7 -3
- package/src/native/tracker/tab.tsx +33 -8
- package/src/components/pages/home/DueAcrossProjects.tsx +0 -76
- package/src/components/pages/home/RecentNotes.tsx +0 -69
|
@@ -56,11 +56,11 @@ import type {
|
|
|
56
56
|
PlanningApi,
|
|
57
57
|
} from '../../corpus/types';
|
|
58
58
|
|
|
59
|
-
type PlanningSlot =
|
|
59
|
+
export type PlanningSlot =
|
|
60
60
|
| 'root' | 'section' | 'heading' | 'card' | 'badge' | 'button' | 'secondaryButton'
|
|
61
61
|
| 'input' | 'muted' | 'error' | 'warning' | 'row' | 'due' | 'progressTrack' | 'progressBar';
|
|
62
62
|
|
|
63
|
-
const
|
|
63
|
+
export const PLANNING_DEFAULTS: Record<PlanningSlot, string> = {
|
|
64
64
|
root: 'space-y-6',
|
|
65
65
|
section: 'space-y-3',
|
|
66
66
|
heading: 'text-lg font-semibold text-gray-900',
|
|
@@ -129,13 +129,18 @@ export interface PlanningPageProps {
|
|
|
129
129
|
*/
|
|
130
130
|
focusId?: string | null;
|
|
131
131
|
onFocusChange?: (focusId: string | null) => void;
|
|
132
|
+
/**
|
|
133
|
+
* Replaces the open project's own item list. Plan passes the shared to-do list filtered to
|
|
134
|
+
* this project, so a project never carries a second list of its own.
|
|
135
|
+
*/
|
|
136
|
+
renderItems?: (focus: Focus) => React.ReactNode;
|
|
132
137
|
classNames?: Partial<Record<PlanningSlot, string>>;
|
|
133
138
|
}
|
|
134
139
|
|
|
135
140
|
export function PlanningPage({
|
|
136
|
-
api, scope, onOpenDocument, now, timeZone, focusId, onFocusChange, classNames = {},
|
|
141
|
+
api, scope, onOpenDocument, now, timeZone, focusId, onFocusChange, renderItems, classNames = {},
|
|
137
142
|
}: PlanningPageProps) {
|
|
138
|
-
const cn = { ...
|
|
143
|
+
const cn = { ...PLANNING_DEFAULTS, ...classNames };
|
|
139
144
|
|
|
140
145
|
// Frozen once. See the note on the prop.
|
|
141
146
|
const [mountedAt] = React.useState(() => Date.now());
|
|
@@ -372,7 +377,7 @@ export function PlanningPage({
|
|
|
372
377
|
{showAll ? 'Show fewer' : `Show all ${overview.length}`}
|
|
373
378
|
</button>
|
|
374
379
|
) : null}
|
|
375
|
-
{unfiled ? <p className={cn.muted}>{unfiled} open item{unfiled === 1 ? ' is' : 's are'} not filed under a focus. Open
|
|
380
|
+
{unfiled ? <p className={cn.muted}>{unfiled} open item{unfiled === 1 ? ' is' : 's are'} not filed under a focus. Open Plan to see them.</p> : null}
|
|
376
381
|
</section>
|
|
377
382
|
{drawer}
|
|
378
383
|
</div>
|
|
@@ -384,7 +389,7 @@ export function PlanningPage({
|
|
|
384
389
|
<section className={cn.section} aria-label="Focus">
|
|
385
390
|
<div className="flex flex-wrap items-center gap-2">
|
|
386
391
|
<button type="button" className={cn.secondaryButton} onClick={() => { setSelected(null); setShowDone(false); }}>
|
|
387
|
-
← All
|
|
392
|
+
← All projects
|
|
388
393
|
</button>
|
|
389
394
|
{warningChip}
|
|
390
395
|
</div>
|
|
@@ -399,6 +404,9 @@ export function PlanningPage({
|
|
|
399
404
|
{error ? <p className={cn.error} role="alert">{error}</p> : null}
|
|
400
405
|
</section>
|
|
401
406
|
|
|
407
|
+
{renderItems ? (
|
|
408
|
+
<section className={cn.section} aria-label="To-dos">{renderItems(selectedFocus)}</section>
|
|
409
|
+
) : (
|
|
402
410
|
<section className={cn.section} aria-label="Items">
|
|
403
411
|
<div className="flex flex-wrap items-center gap-2">
|
|
404
412
|
<h2 className={cn.heading}>
|
|
@@ -467,6 +475,7 @@ export function PlanningPage({
|
|
|
467
475
|
/>
|
|
468
476
|
))}
|
|
469
477
|
</section>
|
|
478
|
+
)}
|
|
470
479
|
|
|
471
480
|
{api.listDocuments ? (
|
|
472
481
|
<FocusDocuments
|
|
@@ -537,7 +546,8 @@ function FocusCard({
|
|
|
537
546
|
|
|
538
547
|
// ---------------------------------------------------------------------------
|
|
539
548
|
|
|
540
|
-
|
|
549
|
+
/** The create form, shared with the Projects sub-tab. */
|
|
550
|
+
export function NewFocusForm({
|
|
541
551
|
classNames: cn, onCreate, onError,
|
|
542
552
|
}: {
|
|
543
553
|
classNames: Record<PlanningSlot, string>;
|
|
@@ -552,7 +562,7 @@ function NewFocusForm({
|
|
|
552
562
|
if (!open) {
|
|
553
563
|
return (
|
|
554
564
|
<button type="button" className={`${cn.secondaryButton} ml-auto`} onClick={() => setOpen(true)}>
|
|
555
|
-
New
|
|
565
|
+
New project
|
|
556
566
|
</button>
|
|
557
567
|
);
|
|
558
568
|
}
|
|
@@ -576,7 +586,7 @@ function NewFocusForm({
|
|
|
576
586
|
}}
|
|
577
587
|
>
|
|
578
588
|
<label>
|
|
579
|
-
<span className="sr-only">
|
|
589
|
+
<span className="sr-only">Project title</span>
|
|
580
590
|
<input
|
|
581
591
|
className={cn.input}
|
|
582
592
|
value={title}
|
|
@@ -597,7 +607,7 @@ function NewFocusForm({
|
|
|
597
607
|
</select>
|
|
598
608
|
</label>
|
|
599
609
|
<button type="submit" className={cn.button} disabled={busy || !title.trim()}>
|
|
600
|
-
{busy ? 'Adding…' : 'Add
|
|
610
|
+
{busy ? 'Adding…' : 'Add project'}
|
|
601
611
|
</button>
|
|
602
612
|
<button type="button" className={cn.secondaryButton} onClick={() => setOpen(false)}>
|
|
603
613
|
Cancel
|
|
@@ -100,6 +100,16 @@ export interface TrackerPageProps {
|
|
|
100
100
|
projectNames?: Record<string, string>;
|
|
101
101
|
/** The reader's IANA zone, for "today". Default UTC. */
|
|
102
102
|
timeZone?: string;
|
|
103
|
+
/**
|
|
104
|
+
* Draw the created/done/overdue timeline strip under the filters. Default true. The Plan
|
|
105
|
+
* shell turns it off here and mounts `TrackerTimelinePage` as its own Timeline sub-tab.
|
|
106
|
+
*/
|
|
107
|
+
showTimeline?: boolean;
|
|
108
|
+
/**
|
|
109
|
+
* Only the to-dos filed under this project (a SERVER filter: `CommitmentQuery.focus`). A to-do
|
|
110
|
+
* added from the box is filed under it too. This is how a project's to-dos are "the same list, filtered".
|
|
111
|
+
*/
|
|
112
|
+
focusId?: string;
|
|
103
113
|
classNames?: Partial<Record<TrackerSlot, string>>;
|
|
104
114
|
}
|
|
105
115
|
|
|
@@ -140,6 +150,8 @@ export function TrackerPage({
|
|
|
140
150
|
memberConnections,
|
|
141
151
|
projectNames = {},
|
|
142
152
|
timeZone,
|
|
153
|
+
showTimeline = true,
|
|
154
|
+
focusId,
|
|
143
155
|
classNames = {},
|
|
144
156
|
}: TrackerPageProps) {
|
|
145
157
|
const foundTracker = useTrackerName(trackerNameProp ? undefined : memberConnections);
|
|
@@ -192,9 +204,10 @@ export function TrackerPage({
|
|
|
192
204
|
// the first page.
|
|
193
205
|
status: ['open', 'in_progress', 'blocked'] as CommitmentStatus[],
|
|
194
206
|
withFocus: true,
|
|
207
|
+
...(focusId ? { focus: focusId } : {}),
|
|
195
208
|
pageSize: 200,
|
|
196
209
|
}),
|
|
197
|
-
[sort],
|
|
210
|
+
[sort, focusId],
|
|
198
211
|
);
|
|
199
212
|
|
|
200
213
|
const load = React.useCallback(async () => {
|
|
@@ -392,7 +405,7 @@ export function TrackerPage({
|
|
|
392
405
|
setAdding(true);
|
|
393
406
|
setError('');
|
|
394
407
|
try {
|
|
395
|
-
await apiRef.current.createCommitment!({ title });
|
|
408
|
+
await apiRef.current.createCommitment!({ title, ...(focusId ? { focusId } : {}) });
|
|
396
409
|
setDraftTitle('');
|
|
397
410
|
await loadRef.current();
|
|
398
411
|
} catch (err) {
|
|
@@ -466,7 +479,7 @@ export function TrackerPage({
|
|
|
466
479
|
))}
|
|
467
480
|
</div>
|
|
468
481
|
) : null}
|
|
469
|
-
{api.timeline ? (
|
|
482
|
+
{showTimeline && api.timeline ? (
|
|
470
483
|
<TrackerTimeline
|
|
471
484
|
api={api} orgId={scope.orgId} now={clock} timeZone={timeZone}
|
|
472
485
|
filter={filterFromChip(quick, { search: filterText })}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The one line Today keeps about to-dos: how many are overdue, due today and due this
|
|
3
|
+
* week, and the way into Plan. It names no to-do: the list is Plan's alone.
|
|
4
|
+
*/
|
|
5
|
+
import type { DueGroups } from '../../../corpus/due-groups';
|
|
6
|
+
|
|
7
|
+
const count = (due: DueGroups, bucket: string) => due.groups.find((g) => g.bucket === bucket)?.entries.length ?? 0;
|
|
8
|
+
|
|
9
|
+
export function dueSoonText(due: DueGroups): string {
|
|
10
|
+
const overdue = count(due, 'overdue');
|
|
11
|
+
const today = count(due, 'today');
|
|
12
|
+
const week = count(due, 'week');
|
|
13
|
+
const parts = [
|
|
14
|
+
overdue ? `${overdue} overdue` : '',
|
|
15
|
+
today ? `${today} due today` : '',
|
|
16
|
+
week ? `${week} due this week` : '',
|
|
17
|
+
].filter(Boolean);
|
|
18
|
+
return parts.length ? parts.join(' · ') : 'Nothing is due soon.';
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export function DueSoonLine({ due, onOpenPlan }: { due: DueGroups; onOpenPlan?: () => void }) {
|
|
22
|
+
return (
|
|
23
|
+
<p className="text-sm text-gray-700" data-testid="due-soon">
|
|
24
|
+
{dueSoonText(due)}
|
|
25
|
+
{onOpenPlan ? <>{' '}<button type="button" className="text-blue-700 underline" onClick={onOpenPlan}>Open Plan</button></> : null}
|
|
26
|
+
</p>
|
|
27
|
+
);
|
|
28
|
+
}
|
|
@@ -1,31 +1,27 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* TODAY — the morning brief (the text the app speaks), the questions waiting for
|
|
3
|
+
* you, and ONE short line on what is due soon with the way into Plan (bd
|
|
4
|
+
* startsim-cpzoz). The to-do list itself lives only in Plan: Today never draws
|
|
5
|
+
* its own copy of it.
|
|
5
6
|
*
|
|
6
7
|
* `<HomeBriefPage brief={...} corpus={...} />` is the whole integration; an app
|
|
7
8
|
* adds a heading and navigation callbacks. Everything is read through the same
|
|
8
|
-
* injected corpus clients as the other page composers
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* the project names.
|
|
9
|
+
* injected corpus clients as the other page composers: one server-paginated read
|
|
10
|
+
* of open items (for the due-soon counts and the question titles) and the project
|
|
11
|
+
* names.
|
|
12
12
|
*/
|
|
13
13
|
import * as React from 'react';
|
|
14
14
|
|
|
15
15
|
import { groupDue } from '../../../corpus/due-groups';
|
|
16
16
|
import { isTask } from '../../../corpus/tracker-groups';
|
|
17
|
-
import { actionsByNote } from '../../../corpus/note-actions';
|
|
18
17
|
import { failureMessage } from '../../../corpus/work-item-logic';
|
|
19
18
|
import type { Commitment, CommitmentApi, CorpusApi, Focus, PlanningApi } from '../../../corpus/types';
|
|
20
19
|
import { applyAnswerToItem, type OpenQuestion, type QuestionAnswer } from '../../../corpus/questions';
|
|
21
20
|
import { NeedsYourCall } from '../questions/NeedsYourCall';
|
|
22
21
|
import type { NeedsYourCallApi } from '../questions/types';
|
|
23
22
|
import { BriefCard, type BriefCardApi } from './BriefCard';
|
|
24
|
-
import {
|
|
25
|
-
import { RecentNotes, type RecentNote } from './RecentNotes';
|
|
23
|
+
import { DueSoonLine } from './DueSoonLine';
|
|
26
24
|
|
|
27
|
-
const NOTE_SUBTYPES = new Set(['meeting', 'voice_note']);
|
|
28
|
-
const DAY = 86_400_000;
|
|
29
25
|
|
|
30
26
|
export interface HomeBriefPageProps {
|
|
31
27
|
brief: BriefCardApi;
|
|
@@ -38,28 +34,17 @@ export interface HomeBriefPageProps {
|
|
|
38
34
|
now?: number;
|
|
39
35
|
trackerName?: string;
|
|
40
36
|
onAsk?: () => void;
|
|
41
|
-
|
|
42
|
-
|
|
37
|
+
/** The way into Plan (the to-do list). */
|
|
38
|
+
onOpenPlan?: () => void;
|
|
43
39
|
onOpenItem?: (item: Commitment) => void;
|
|
44
|
-
/** How many recent notes to list. Default 6. */
|
|
45
|
-
noteCount?: number;
|
|
46
40
|
/** Tandem's open questions ("Needs your call"). Absent = no such section. */
|
|
47
41
|
questions?: NeedsYourCallApi;
|
|
48
42
|
}
|
|
49
43
|
|
|
50
|
-
interface Data { open: Commitment[];
|
|
51
|
-
|
|
52
|
-
function Section({ title, children }: { title: string; children: React.ReactNode }) {
|
|
53
|
-
return (
|
|
54
|
-
<section className="space-y-3">
|
|
55
|
-
<h2 className="text-lg font-semibold text-gray-900">{title}</h2>
|
|
56
|
-
{children}
|
|
57
|
-
</section>
|
|
58
|
-
);
|
|
59
|
-
}
|
|
44
|
+
interface Data { open: Commitment[]; names: Record<string, string> }
|
|
60
45
|
|
|
61
46
|
export function HomeBriefPage({
|
|
62
|
-
brief, weekly, corpus, listFocuses, timeZone, now,
|
|
47
|
+
brief, weekly, corpus, listFocuses, timeZone, now, onAsk, onOpenPlan, onOpenItem, questions,
|
|
63
48
|
}: HomeBriefPageProps) {
|
|
64
49
|
// Frozen once: a clock that changes every render re-fires the load effect.
|
|
65
50
|
const [mountedAt] = React.useState(() => Date.now());
|
|
@@ -76,19 +61,13 @@ export function HomeBriefPage({
|
|
|
76
61
|
(async () => {
|
|
77
62
|
const c = corpusRef.current;
|
|
78
63
|
try {
|
|
79
|
-
const [open,
|
|
64
|
+
const [open, focuses] = await Promise.all([
|
|
80
65
|
c.listCommitments({ status: ['open', 'in_progress', 'blocked'], withFocus: true, pageSize: 200 }),
|
|
81
|
-
c.listCommitments({ changedAfter: new Date(clock - 30 * DAY).toISOString(), pageSize: 200 }),
|
|
82
|
-
c.listDocuments({ order: 'recent', occurredAfter: new Date(clock - 30 * DAY).toISOString(), pageSize: noteCount * 3 }),
|
|
83
66
|
focusesRef.current ? focusesRef.current({ pageSize: 200 }).then((p) => p.results).catch((): Focus[] => []) : Promise.resolve([] as Focus[]),
|
|
84
67
|
]);
|
|
85
68
|
if (!live) return;
|
|
86
|
-
const noteDocs = docs.results.filter((d) => NOTE_SUBTYPES.has(d.subtype ?? '')).slice(0, noteCount);
|
|
87
|
-
const joined = actionsByNote([...open.results, ...recent.results], noteDocs.map((d) => d.id));
|
|
88
69
|
setData({
|
|
89
70
|
open: open.results,
|
|
90
|
-
recent: recent.results,
|
|
91
|
-
notes: noteDocs.map((doc) => ({ doc, actions: joined.get(doc.id)! })),
|
|
92
71
|
names: Object.fromEntries(focuses.map((f) => [f.id, f.title])),
|
|
93
72
|
});
|
|
94
73
|
} catch (err) {
|
|
@@ -96,21 +75,17 @@ export function HomeBriefPage({
|
|
|
96
75
|
}
|
|
97
76
|
})();
|
|
98
77
|
return () => { live = false; };
|
|
99
|
-
}, [clock,
|
|
78
|
+
}, [clock, corpus]);
|
|
100
79
|
|
|
101
80
|
// An answer shows on its to-do the moment it is tapped; a failed save drops it again.
|
|
102
81
|
const [applied, setApplied] = React.useState<Record<string, { q: OpenQuestion; answer: QuestionAnswer }>>({});
|
|
103
|
-
const [guessed, setGuessed] = React.useState<ReadonlySet<string>>(new Set());
|
|
104
82
|
const due = React.useMemo(() => {
|
|
105
83
|
if (!data) return null;
|
|
106
84
|
const answers = Object.values(applied);
|
|
107
85
|
const open = answers.length ? data.open.map((item) => answers.reduce((cur, { q, answer }) => applyAnswerToItem(cur, q, answer), item)) : data.open;
|
|
108
86
|
return groupDue(open.filter(isTask), { now: clock, timeZone });
|
|
109
87
|
}, [data, applied, clock, timeZone]);
|
|
110
|
-
const titles = React.useMemo(() => new Map((data ?
|
|
111
|
-
const onOpenQuestions = React.useCallback((open: OpenQuestion[]) => {
|
|
112
|
-
setGuessed(new Set(open.filter((q) => q.kind === 'due_date' && q.assumed?.value).map((q) => q.itemId)));
|
|
113
|
-
}, []);
|
|
88
|
+
const titles = React.useMemo(() => new Map((data ? data.open : []).map((i) => [i.id, i.title])), [data]);
|
|
114
89
|
|
|
115
90
|
return (
|
|
116
91
|
<div className="space-y-8">
|
|
@@ -120,22 +95,14 @@ export function HomeBriefPage({
|
|
|
120
95
|
{questions ? (
|
|
121
96
|
<NeedsYourCall
|
|
122
97
|
api={questions} itemTitle={(id) => titles.get(id)} projectNames={data?.names} timeZone={timeZone} now={now}
|
|
123
|
-
onOpenQuestions={onOpenQuestions}
|
|
124
98
|
onApplied={(q, answer) => setApplied((a) => ({ ...a, [q.id]: { q, answer } }))}
|
|
125
99
|
onReverted={(q) => setApplied(({ [q.id]: _gone, ...rest }) => rest)}
|
|
126
|
-
onOpenItem={onOpenItem ? (id) => { const item = data?.open.find((i) => i.id === id)
|
|
100
|
+
onOpenItem={onOpenItem ? (id) => { const item = data?.open.find((i) => i.id === id); if (item) onOpenItem(item); } : undefined}
|
|
127
101
|
/>
|
|
128
102
|
) : null}
|
|
129
|
-
|
|
130
|
-
{due
|
|
131
|
-
|
|
132
|
-
) : error ? null : <p className="text-sm text-gray-500">Loading…</p>}
|
|
133
|
-
</Section>
|
|
134
|
-
<Section title="Recent notes">
|
|
135
|
-
{data ? (
|
|
136
|
-
<RecentNotes notes={data.notes} projectNames={data.names} now={clock} timeZone={timeZone} onOpenNote={onOpenNote} onOpenItem={onOpenItem} />
|
|
137
|
-
) : error ? null : <p className="text-sm text-gray-500">Loading…</p>}
|
|
138
|
-
</Section>
|
|
103
|
+
{due && data ? (
|
|
104
|
+
<DueSoonLine due={due} onOpenPlan={onOpenPlan} />
|
|
105
|
+
) : error ? null : <p className="text-sm text-gray-500">Loading…</p>}
|
|
139
106
|
</div>
|
|
140
107
|
);
|
|
141
108
|
}
|
|
@@ -2,9 +2,7 @@ export { BriefCard } from './BriefCard';
|
|
|
2
2
|
export type { BriefCardApi } from './BriefCard';
|
|
3
3
|
export { CompactItemRow, dueLabel } from './CompactItemRow';
|
|
4
4
|
export type { CompactItemRowProps } from './CompactItemRow';
|
|
5
|
-
export {
|
|
6
|
-
export { RecentNotes } from './RecentNotes';
|
|
7
|
-
export type { RecentNote } from './RecentNotes';
|
|
5
|
+
export { DueSoonLine, dueSoonText } from './DueSoonLine';
|
|
8
6
|
export { HomeBriefPage } from './HomeBriefPage';
|
|
9
7
|
export type { HomeBriefPageProps } from './HomeBriefPage';
|
|
10
8
|
export { useProjectNames } from './useProjectNames';
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* PLAN > PROJECTS: projects and goals as ONE thing (a goal and a focus are the same
|
|
5
|
+
* row). The list is the goals table with progress, plus the create form; opening one
|
|
6
|
+
* shows the project header and progress history, and its to-dos are the SAME shared
|
|
7
|
+
* to-do list filtered to the project (`renderTodos`), never a second list.
|
|
8
|
+
*/
|
|
9
|
+
import * as React from 'react';
|
|
10
|
+
|
|
11
|
+
import type { CorpusScope, Focus, PlanningApi } from '../../../corpus/types';
|
|
12
|
+
import { GoalsPage } from '../goals/GoalsPage';
|
|
13
|
+
import { NewFocusForm, PLANNING_DEFAULTS, PlanningPage } from '../PlanningPage';
|
|
14
|
+
|
|
15
|
+
export interface ProjectsPageProps {
|
|
16
|
+
api: PlanningApi;
|
|
17
|
+
scope: CorpusScope;
|
|
18
|
+
/** Controlled selection: the open project, or null for the list. */
|
|
19
|
+
focusId: string | null;
|
|
20
|
+
onFocusChange: (focusId: string | null) => void;
|
|
21
|
+
/** The to-do list for one project: the host mounts the shared list with `focusId` set. */
|
|
22
|
+
renderTodos: (focus: Focus) => React.ReactNode;
|
|
23
|
+
onOpenDocument?: (documentId: string) => void;
|
|
24
|
+
now?: number;
|
|
25
|
+
timeZone?: string;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export function ProjectsPage({ api, scope, focusId, onFocusChange, renderTodos, onOpenDocument, now, timeZone }: ProjectsPageProps) {
|
|
29
|
+
const [epoch, setEpoch] = React.useState(0);
|
|
30
|
+
const [error, setError] = React.useState('');
|
|
31
|
+
if (focusId) {
|
|
32
|
+
return (
|
|
33
|
+
<PlanningPage
|
|
34
|
+
api={api} scope={scope} focusId={focusId} onFocusChange={onFocusChange}
|
|
35
|
+
renderItems={renderTodos} onOpenDocument={onOpenDocument} now={now} timeZone={timeZone}
|
|
36
|
+
/>
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
return (
|
|
40
|
+
<div className="space-y-4">
|
|
41
|
+
{api.createFocus ? (
|
|
42
|
+
<div className="flex items-center">
|
|
43
|
+
<NewFocusForm
|
|
44
|
+
classNames={PLANNING_DEFAULTS}
|
|
45
|
+
onCreate={async (draft) => { await api.createFocus!(draft); setEpoch((n) => n + 1); }}
|
|
46
|
+
onError={setError}
|
|
47
|
+
/>
|
|
48
|
+
</div>
|
|
49
|
+
) : null}
|
|
50
|
+
{error ? <p className="text-sm text-red-600" role="alert">{error}</p> : null}
|
|
51
|
+
<GoalsPage key={epoch} api={api} scope={scope} now={now} timeZone={timeZone} onOpenFocus={onFocusChange} />
|
|
52
|
+
</div>
|
|
53
|
+
);
|
|
54
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* TALK: one screen for speaking to Tandem. Two modes over the same assistant: Talk
|
|
5
|
+
* (start talking, or type: plans and notes, and the asks you make become to-dos) and
|
|
6
|
+
* Ask (a question, answered with the sources it came from). Each mode is the existing
|
|
7
|
+
* composer, mounted by the host; this file only owns the toggle and the one-line subtitle.
|
|
8
|
+
*/
|
|
9
|
+
import * as React from 'react';
|
|
10
|
+
|
|
11
|
+
import { TALK_MODES, type TalkMode } from '../../../corpus/nav-copy';
|
|
12
|
+
|
|
13
|
+
export interface TalkPageProps {
|
|
14
|
+
mode: TalkMode;
|
|
15
|
+
onModeChange: (mode: TalkMode) => void;
|
|
16
|
+
/** The `ConversePage`. */
|
|
17
|
+
talk: React.ReactNode;
|
|
18
|
+
/** The `AskPage`. */
|
|
19
|
+
ask: React.ReactNode;
|
|
20
|
+
classNames?: Partial<Record<'root' | 'tabs' | 'tab' | 'tabActive' | 'subtitle', string>>;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const DEFAULTS = {
|
|
24
|
+
root: 'space-y-4',
|
|
25
|
+
tabs: 'inline-flex overflow-hidden rounded-md border border-gray-300',
|
|
26
|
+
tab: 'px-4 py-1.5 text-sm text-gray-700',
|
|
27
|
+
tabActive: 'bg-gray-900 px-4 py-1.5 text-sm text-white',
|
|
28
|
+
subtitle: 'text-sm text-gray-500',
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export function TalkPage({ mode, onModeChange, talk, ask, classNames = {} }: TalkPageProps) {
|
|
32
|
+
const cn = { ...DEFAULTS, ...classNames };
|
|
33
|
+
const current = TALK_MODES.find((m) => m.key === mode) ?? TALK_MODES[0];
|
|
34
|
+
return (
|
|
35
|
+
<div className={cn.root}>
|
|
36
|
+
<div role="tablist" aria-label="Talk mode" className={cn.tabs}>
|
|
37
|
+
{TALK_MODES.map((m) => (
|
|
38
|
+
<button
|
|
39
|
+
key={m.key} type="button" role="tab" aria-selected={m.key === current.key}
|
|
40
|
+
className={m.key === current.key ? cn.tabActive : cn.tab} onClick={() => onModeChange(m.key)}
|
|
41
|
+
>{m.label}</button>
|
|
42
|
+
))}
|
|
43
|
+
</div>
|
|
44
|
+
<p className={cn.subtitle} data-testid="talk-mode-subtitle">{current.subtitle}</p>
|
|
45
|
+
{current.key === 'ask' ? ask : talk}
|
|
46
|
+
</div>
|
|
47
|
+
);
|
|
48
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* PLAN > TIMELINE: what was created, finished and overdue over time, with the to-dos
|
|
5
|
+
* behind the numbers in a table. The same strip the tracker used to carry under its
|
|
6
|
+
* list, mounted on its own so the To-dos sub-tab is only the working list.
|
|
7
|
+
*/
|
|
8
|
+
import * as React from 'react';
|
|
9
|
+
|
|
10
|
+
import type { CommitmentTrackerApi, CorpusScope } from '../../../corpus/types';
|
|
11
|
+
import { TrackerTimeline } from '../tracker/TrackerTimeline';
|
|
12
|
+
|
|
13
|
+
const NO_FILTER = {};
|
|
14
|
+
|
|
15
|
+
export interface TimelinePageProps {
|
|
16
|
+
api: Pick<CommitmentTrackerApi, 'timeline'>;
|
|
17
|
+
scope: CorpusScope;
|
|
18
|
+
/** Injectable clock. Frozen once when absent, for the reason spelled out on `TrackerPageProps.now`. */
|
|
19
|
+
now?: number;
|
|
20
|
+
timeZone?: string;
|
|
21
|
+
className?: string;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export function TimelinePage({ api, scope, now, timeZone, className }: TimelinePageProps) {
|
|
25
|
+
const [mountedAt] = React.useState(() => Date.now());
|
|
26
|
+
if (!api.timeline) return <p className="text-sm text-gray-500">The timeline is not available in this workspace.</p>;
|
|
27
|
+
return (
|
|
28
|
+
<TrackerTimeline
|
|
29
|
+
api={api} orgId={scope.orgId} now={now ?? mountedAt} timeZone={timeZone}
|
|
30
|
+
filter={NO_FILTER} className={className}
|
|
31
|
+
/>
|
|
32
|
+
);
|
|
33
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { TimelinePage } from './TimelinePage';
|
|
2
|
+
export type { TimelinePageProps } from './TimelinePage';
|
|
3
|
+
export { ProjectsPage } from './ProjectsPage';
|
|
4
|
+
export type { ProjectsPageProps } from './ProjectsPage';
|
|
5
|
+
export { TalkPage } from './TalkPage';
|
|
6
|
+
export type { TalkPageProps } from './TalkPage';
|
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
* gets a sentence saying so and the conversation goes on. Request-free so a Next route, a worker and a test
|
|
9
9
|
* all call the same thing.
|
|
10
10
|
*/
|
|
11
|
-
import {
|
|
11
|
+
import { unhandledAsks } from './handled-asks';
|
|
12
|
+
import { renderNextSteps, renderTranscript, titleFor } from './transcript';
|
|
12
13
|
import { createEntityConversationStore } from './store';
|
|
13
14
|
import { speakSide } from './speak';
|
|
14
15
|
import { addRelayOrder } from './relay-inbox';
|
|
@@ -118,7 +119,7 @@ export async function handleConverseTurn(deps: ConverseDeps, req: ConverseTurnRe
|
|
|
118
119
|
return resultOf(conversationId, turn);
|
|
119
120
|
}
|
|
120
121
|
|
|
121
|
-
/** End: finish the record, write the transcript as its document body, pull out asks and decisions. Idempotent. */
|
|
122
|
+
/** End: finish the record, write the transcript as its document body, pull out asks and decisions, then file it (project + to-dos). Idempotent. */
|
|
122
123
|
export async function handleConverseEnd(deps: ConverseDeps, req: { conversationId: string }): Promise<ConverseEndResult> {
|
|
123
124
|
if (!CLIENT_ID.test(req.conversationId ?? '')) throw new ConverseError('Say which conversation to end.', 400);
|
|
124
125
|
const store = deps.store ?? createEntityConversationStore(deps.http, deps.ownerSub);
|
|
@@ -140,5 +141,11 @@ export async function handleConverseEnd(deps: ConverseDeps, req: { conversationI
|
|
|
140
141
|
}
|
|
141
142
|
}
|
|
142
143
|
const withAsks = { ...base, asks, decisions };
|
|
143
|
-
|
|
144
|
+
// An ask the assistant already added as a to-do during the conversation is not filed again by the extraction.
|
|
145
|
+
const open = unhandledAsks(asks, record.turns);
|
|
146
|
+
const summary = renderNextSteps(open);
|
|
147
|
+
const saved = await store.save({ ...withAsks, body: renderTranscript(withAsks), ...(summary ? { summary } : {}) });
|
|
148
|
+
// Filed like a voice note: under a project, and each ask a to-do. The transcript is already kept, so this never fails End.
|
|
149
|
+
if (deps.handoff) await deps.handoff({ record: saved, asks: open, decisions }).catch((error) => console.error('[converse] handoff failed (conversation kept)', error));
|
|
150
|
+
return done(saved);
|
|
144
151
|
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Asks the assistant already acted on while the conversation ran. A typed or spoken "call the landlord" is answered with
|
|
3
|
+
* "Added Call the landlord ..." and the to-do exists; End's extraction then reads the same words again and would file a
|
|
4
|
+
* second copy. A turn's `did` lines say what was added; an ask that matches one is already a to-do.
|
|
5
|
+
*/
|
|
6
|
+
import type { ConverseTurn } from './types';
|
|
7
|
+
|
|
8
|
+
const STOP = new Set(['a', 'an', 'the', 'to', 'for', 'by', 'of', 'on', 'in', 'and', 'me', 'my', 'i', 'it']);
|
|
9
|
+
const words = (text: string): string[] => text.toLowerCase().replace(/[^a-z0-9\s]/g, ' ').split(/\s+/).filter((w) => w && !STOP.has(w));
|
|
10
|
+
|
|
11
|
+
/** The titles of to-dos the assistant added, read off its spoken `did` lines. */
|
|
12
|
+
function addedTitles(turns: ConverseTurn[]): string[][] {
|
|
13
|
+
return turns.flatMap((t) => t.did ?? []).filter((d) => /^added\s/i.test(d)).map((d) => words(d.replace(/^added\s+/i, '')));
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/** The asks that are NOT already a to-do: an ask is handled when it is mostly the added title, or nearly all of that title is in it. */
|
|
17
|
+
export function unhandledAsks(asks: string[], turns: ConverseTurn[]): string[] {
|
|
18
|
+
const added = addedTitles(turns);
|
|
19
|
+
if (!added.length) return asks;
|
|
20
|
+
return asks.filter((ask) => {
|
|
21
|
+
const a = new Set(words(ask));
|
|
22
|
+
return !added.some((title) => {
|
|
23
|
+
if (!title.length || !a.size) return false;
|
|
24
|
+
const shared = title.filter((w) => a.has(w)).length;
|
|
25
|
+
// The spoken line adds a date word or two to the title ('... for Monday the twenty-third'), so mostly-contained either way counts.
|
|
26
|
+
return shared / a.size >= 0.75 || (shared / title.length >= 0.7 && shared / a.size >= 0.5);
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WHAT END DOES WITH A FINISHED CONVERSATION: the same two things a recorded voice note gets.
|
|
3
|
+
*
|
|
4
|
+
* 1. FILED UNDER A PROJECT, as an `about_focus` edge (corpus/filing). The model only chooses from the
|
|
5
|
+
* projects it is given (the voice analyzer, reused as is); no project fits or no model = unfiled.
|
|
6
|
+
* 2. EACH ASK A TO-DO: the saved record's `## Next steps` summary is read by the same extraction a voice
|
|
7
|
+
* note goes through, so the rows land in the Tracker, Planning and the iOS To-dos tab like any other.
|
|
8
|
+
*
|
|
9
|
+
* Both are best-effort and independent: one failing leaves the other and the saved transcript alone.
|
|
10
|
+
* Seams are injected (analyzer, focus list, extraction), so the app supplies its keys and this stays pure.
|
|
11
|
+
*/
|
|
12
|
+
import type { CorpusHttp } from '../client';
|
|
13
|
+
import { fileDocument } from '../filing';
|
|
14
|
+
import type { FocusChoice } from '../filing';
|
|
15
|
+
import type { VoiceAnalyzer } from '../voice';
|
|
16
|
+
import type { ConverseHandoffInput } from './types';
|
|
17
|
+
|
|
18
|
+
export interface ConverseHandoffDeps {
|
|
19
|
+
http: CorpusHttp;
|
|
20
|
+
analyzer: VoiceAnalyzer | null;
|
|
21
|
+
listFocuses: () => Promise<FocusChoice[]>;
|
|
22
|
+
/** Runs the to-do extraction over just this document (the app's `extractCommitments`). */
|
|
23
|
+
extractTodos: (documentId: string) => Promise<unknown>;
|
|
24
|
+
now?: () => number;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function createConverseHandoff(deps: ConverseHandoffDeps) {
|
|
28
|
+
return async ({ record, asks }: ConverseHandoffInput): Promise<void> => {
|
|
29
|
+
const transcript = record.body ?? '';
|
|
30
|
+
if (deps.analyzer && transcript) {
|
|
31
|
+
try {
|
|
32
|
+
const focuses = await deps.listFocuses();
|
|
33
|
+
if (focuses.length) {
|
|
34
|
+
const analysis = await deps.analyzer.analyze({
|
|
35
|
+
transcript, focuses, now: deps.now?.() ?? Date.parse(record.startedAt), ...(record.timeZone ? { timeZone: record.timeZone } : {}),
|
|
36
|
+
});
|
|
37
|
+
// Only an id from the offered list files anything.
|
|
38
|
+
if (analysis.focusId && focuses.some((f) => f.id === analysis.focusId)) await fileDocument(deps.http, record.id, analysis.focusId);
|
|
39
|
+
}
|
|
40
|
+
} catch (error) {
|
|
41
|
+
console.error('[converse] filing under a project failed (conversation kept)', error);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
if (asks.length) {
|
|
45
|
+
try {
|
|
46
|
+
await deps.extractTodos(record.id);
|
|
47
|
+
} catch (error) {
|
|
48
|
+
console.error('[converse] to-do extraction failed (conversation kept)', error);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
}
|
|
@@ -5,10 +5,10 @@ export { addRelayOrder, loadRelayOrders, clearRelayOrders, relayInboxExternalId
|
|
|
5
5
|
export type { RelayOrder } from './relay-inbox';
|
|
6
6
|
export type { RelayReplyResult } from './relay';
|
|
7
7
|
export { createEntityConversationStore, conversationExternalId } from './store';
|
|
8
|
-
export { renderTranscript, titleFor } from './transcript';
|
|
8
|
+
export { renderNextSteps, renderTranscript, titleFor } from './transcript';
|
|
9
9
|
export { ConverseError, CONVERSATION_SOURCE, turnAudioPath } from './types';
|
|
10
10
|
export type {
|
|
11
|
-
ConversationRecord, ConversationStore, ConverseBrain, ConverseBrainInput, ConverseBrainOutput, ConverseDeps, ConverseEndResult,
|
|
11
|
+
ConversationRecord, ConversationStore, ConverseBrain, ConverseBrainInput, ConverseBrainOutput, ConverseDeps, ConverseEndResult, ConverseHandoffInput,
|
|
12
12
|
ConverseThread, ConverseThreadTurn, ConverseTurn, ConverseTurnRequest, ConverseTurnResult, HistoryLine,
|
|
13
13
|
} from './types';
|
|
14
14
|
export { createConverseBrain, questionWithHistory, speakableAnswer } from './brain';
|
|
@@ -17,6 +17,8 @@ export { createConverseClient, ConverseClientError } from './client';
|
|
|
17
17
|
export type { ConverseClient } from './client';
|
|
18
18
|
export { converseEnv } from './config';
|
|
19
19
|
export { createConverseExtractor, parseExtract } from './extract';
|
|
20
|
+
export { createConverseHandoff } from './handoff';
|
|
21
|
+
export type { ConverseHandoffDeps } from './handoff';
|
|
20
22
|
export type { ConverseExtract } from './extract';
|
|
21
23
|
export { CANNOT_SEE } from './brain';
|
|
22
24
|
export { MEETING_DEFAULTS, resolveMeetingConfig } from './meeting-config';
|