@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 +7 -7
- package/src/__tests__/converse-brain.test.ts +93 -15
- package/src/__tests__/converse-followups.test.ts +55 -0
- package/src/__tests__/converse-item-answers.test.ts +51 -0
- package/src/__tests__/converse-spoken-form.test.ts +19 -0
- package/src/__tests__/converse.test.ts +92 -1
- package/src/__tests__/item-evidence.test.tsx +22 -0
- package/src/__tests__/overview-page.test.tsx +20 -0
- package/src/__tests__/overview.test.ts +52 -0
- package/src/components/index.ts +1 -0
- package/src/components/pages/TrackerPage.tsx +4 -1
- package/src/components/pages/home/CompactItemRow.tsx +15 -0
- package/src/components/pages/overview/OverviewPage.tsx +173 -0
- package/src/components/pages/overview/index.ts +2 -0
- package/src/corpus/converse/brain.ts +34 -5
- package/src/corpus/converse/followups.ts +70 -0
- package/src/corpus/converse/handle.ts +42 -20
- package/src/corpus/converse/index.ts +1 -0
- package/src/corpus/converse/item-answers.ts +67 -0
- package/src/corpus/converse/spoken-form.ts +25 -0
- package/src/corpus/converse/store.ts +2 -0
- package/src/corpus/converse/transcript.ts +2 -1
- package/src/corpus/converse/types.ts +7 -0
- package/src/corpus/converse/wrap-up.ts +3 -0
- package/src/corpus/entities.ts +1 -0
- package/src/corpus/index.ts +2 -0
- package/src/corpus/nav-copy.ts +1 -0
- package/src/corpus/overview.ts +108 -0
|
@@ -64,6 +64,8 @@ export interface ConversationRecord {
|
|
|
64
64
|
decisions?: string[];
|
|
65
65
|
/** A briefing in progress: the queue of items and the one being asked. */
|
|
66
66
|
briefing?: BriefingState;
|
|
67
|
+
/** The items the last answer listed, for follow-ups ("the second one"). */
|
|
68
|
+
context?: { items: PlayedItem[] };
|
|
67
69
|
}
|
|
68
70
|
|
|
69
71
|
export interface ConversationStore {
|
|
@@ -74,8 +76,11 @@ export interface ConversationStore {
|
|
|
74
76
|
|
|
75
77
|
/** What the assistant works out for one utterance. */
|
|
76
78
|
import type { BriefingState } from './briefing-queue';
|
|
79
|
+
import type { PlayedItem } from './followups';
|
|
77
80
|
|
|
78
81
|
export interface ConverseBrainInput {
|
|
82
|
+
/** The items the last answer listed, in the order they were said: what "the second one" and "that one" mean. */
|
|
83
|
+
context?: { items: PlayedItem[] } | null;
|
|
79
84
|
/** A briefing in progress (the queue and where it is), kept on the conversation; the next answer belongs to it. */
|
|
80
85
|
briefing?: BriefingState | null;
|
|
81
86
|
utterance: string;
|
|
@@ -96,6 +101,8 @@ export interface ConverseBrainOutput {
|
|
|
96
101
|
relayText?: string;
|
|
97
102
|
/** The briefing after this turn: null = over; absent = unchanged. */
|
|
98
103
|
briefing?: BriefingState | null;
|
|
104
|
+
/** The items this answer listed (null clears; absent keeps what was there). */
|
|
105
|
+
context?: { items: PlayedItem[] } | null;
|
|
99
106
|
/** What kind of thing was said (shown by the app, kept on the turn). */
|
|
100
107
|
intent?: ConverseIntent;
|
|
101
108
|
/** The records the answer came from. */
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/** Wrapping up, said short ("parse that note", "that's it", "I'm done", "file it"): a command to the assistant, never something to file. */
|
|
2
|
+
export const WRAP_UP = /^(?:(?:ok(?:ay)?|alright|all right|so)[, ]+)?(?:(?:please |just |go ahead and )?(?:parse|file|save|process|wrap up|wrap|finish|close)(?: out)?(?: that| this| the| my| it| up)*(?: note| notes| conversation| thing)?|that'?s (?:it|all|everything)|that is (?:it|all|everything)|i'?m (?:done|finished)|i am (?:done|finished)|we'?re (?:done|finished)|done|all done|end (?:the )?(?:note|conversation))\W*$/i;
|
|
3
|
+
|
package/src/corpus/entities.ts
CHANGED
|
@@ -725,6 +725,7 @@ export function toCommitment(
|
|
|
725
725
|
? { resolvedBy: asText(pick(data, 'resolved_by', 'resolvedBy')) } : {}),
|
|
726
726
|
resolvedAt: asIso(pick(data, 'resolved_at', 'resolvedAt')),
|
|
727
727
|
...(pick(data, 'owner_name', 'ownerName') ? { ownerName: asText(pick(data, 'owner_name', 'ownerName')) } : {}),
|
|
728
|
+
...(pick(data, 'external_focus_id', 'externalFocusId') ? { externalFocusId: asText(pick(data, 'external_focus_id', 'externalFocusId')) } : {}),
|
|
728
729
|
...(pick(data, 'subject') ? { subject: asText(pick(data, 'subject')) } : {}),
|
|
729
730
|
subjectKey: asText(pick(data, 'subject_key', 'subjectKey')),
|
|
730
731
|
actionKey: asText(pick(data, 'action_key', 'actionKey')),
|
package/src/corpus/index.ts
CHANGED
|
@@ -307,6 +307,8 @@ export type { DueBucket, DueEntry, DueGroup, DueGroups } from './due-groups';
|
|
|
307
307
|
export { STALE_DAYS, groupTracker, isTask } from './tracker-groups';
|
|
308
308
|
export type { TrackerEntry, TrackerGroups } from './tracker-groups';
|
|
309
309
|
export { DEFAULT_TRACKER_SORT, TRACKER_SORTS, commitmentOrder, compareCommitments } from './tracker-sort';
|
|
310
|
+
export { buildOverview, NO_PROJECT } from './overview';
|
|
311
|
+
export type { Overview, OverviewRow, OverviewColumn, OverviewCell } from './overview';
|
|
310
312
|
export { summarizeFocuses } from './focus-overview';
|
|
311
313
|
export type { FocusSummary } from './focus-overview';
|
|
312
314
|
export { focusToGoalRow } from './goal-rows';
|
package/src/corpus/nav-copy.ts
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
export const TAB_COPY = {
|
|
7
7
|
today: { label: 'Today', subtitle: 'Your morning brief and what is due soon.' },
|
|
8
8
|
talk: { label: 'Talk', subtitle: 'Talk or type: plans, questions, notes. Say "parse that note" when you are done.' },
|
|
9
|
+
overview: { label: 'Overview', subtitle: 'Everything in flight, and who each project is waiting on.' },
|
|
9
10
|
plan: { label: 'Plan', subtitle: 'Everything you owe, and what you are aiming for.' },
|
|
10
11
|
more: { label: 'More', subtitle: 'Library, Decisions, Connections.' },
|
|
11
12
|
} as const;
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Overview's numbers: projects (rows) by who each is waiting on (columns). Pure, so the grid is
|
|
3
|
+
* testable without a render. Nothing here names a person, an area or a workflow: the columns are whoever
|
|
4
|
+
* the open items belong to (`ownerName`), "Me" is whoever the caller says is the signed-in user, and a
|
|
5
|
+
* project is any focus. A different account gets different columns from its own data.
|
|
6
|
+
*/
|
|
7
|
+
import type { Commitment, Focus } from './types';
|
|
8
|
+
|
|
9
|
+
const OPEN = new Set(['open', 'in_progress', 'blocked']);
|
|
10
|
+
export const NO_PROJECT = '__none__';
|
|
11
|
+
|
|
12
|
+
export interface OverviewCell {
|
|
13
|
+
count: number;
|
|
14
|
+
/** The most pressing open item here: earliest due date first, then priority. */
|
|
15
|
+
next: Commitment | null;
|
|
16
|
+
}
|
|
17
|
+
export interface OverviewColumn {
|
|
18
|
+
key: string;
|
|
19
|
+
label: string;
|
|
20
|
+
total: number;
|
|
21
|
+
isMe: boolean;
|
|
22
|
+
}
|
|
23
|
+
export interface OverviewRow {
|
|
24
|
+
/** The focus id, or NO_PROJECT for items filed under no project. */
|
|
25
|
+
id: string;
|
|
26
|
+
focus: Focus | null;
|
|
27
|
+
title: string;
|
|
28
|
+
open: number;
|
|
29
|
+
overdue: number;
|
|
30
|
+
blocked: number;
|
|
31
|
+
/** ISO instant of the newest sighting of any of its items. */
|
|
32
|
+
lastActivity: string | null;
|
|
33
|
+
cells: Record<string, OverviewCell>;
|
|
34
|
+
}
|
|
35
|
+
export interface Overview {
|
|
36
|
+
columns: OverviewColumn[];
|
|
37
|
+
rows: OverviewRow[];
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export interface OverviewOptions {
|
|
41
|
+
/** Names that mean the signed-in user (display name, email local part). Case-insensitive. */
|
|
42
|
+
meNames?: string[];
|
|
43
|
+
now?: number;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const norm = (s: string | undefined) => (s ?? '').trim().toLowerCase();
|
|
47
|
+
const ownerKey = (c: Commitment) => norm(c.ownerName);
|
|
48
|
+
const byUrgency = (a: Commitment, b: Commitment) => {
|
|
49
|
+
const da = a.dueAt ? Date.parse(a.dueAt) : Infinity;
|
|
50
|
+
const db = b.dueAt ? Date.parse(b.dueAt) : Infinity;
|
|
51
|
+
if (da !== db) return da - db;
|
|
52
|
+
return (a.priority ?? 9) - (b.priority ?? 9);
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export function buildOverview(focuses: Focus[], items: Array<Commitment & { focusId?: string }>, opts: OverviewOptions = {}): Overview {
|
|
56
|
+
const now = opts.now ?? Date.now();
|
|
57
|
+
const me = new Set((opts.meNames ?? []).map(norm).filter(Boolean));
|
|
58
|
+
const open = items.filter((c) => OPEN.has(c.status));
|
|
59
|
+
const known = new Set(focuses.map((f) => f.id));
|
|
60
|
+
const byFocus = new Map<string, Commitment[]>();
|
|
61
|
+
for (const c of open) {
|
|
62
|
+
// The project comes from the in_focus link; where extraction wrote only the pointer on the row (external_focus_id), use that
|
|
63
|
+
// when it names a real project, so such items are not all lumped under "No project". Read-side only: nothing is written.
|
|
64
|
+
const id = c.focusId || (c.externalFocusId && known.has(c.externalFocusId) ? c.externalFocusId : '') || NO_PROJECT;
|
|
65
|
+
byFocus.set(id, [...(byFocus.get(id) ?? []), c]);
|
|
66
|
+
}
|
|
67
|
+
const live = focuses.filter((f) => f.status !== 'completed' && f.status !== 'cancelled');
|
|
68
|
+
const ids = new Set(live.map((f) => f.id));
|
|
69
|
+
const rowsSrc: Array<{ id: string; focus: Focus | null; title: string }> = live.map((f) => ({ id: f.id, focus: f, title: f.title }));
|
|
70
|
+
// items filed under a closed or unknown project still count: show them under "No project" rather than losing them
|
|
71
|
+
const strayItems = [...byFocus.entries()].filter(([id]) => id !== NO_PROJECT && !ids.has(id)).flatMap(([, v]) => v);
|
|
72
|
+
const noProject = [...(byFocus.get(NO_PROJECT) ?? []), ...strayItems];
|
|
73
|
+
if (noProject.length) rowsSrc.push({ id: NO_PROJECT, focus: null, title: 'No project' });
|
|
74
|
+
|
|
75
|
+
const totals = new Map<string, { label: string; total: number }>();
|
|
76
|
+
const rows: OverviewRow[] = rowsSrc.map((r) => {
|
|
77
|
+
const mine = r.id === NO_PROJECT ? noProject : byFocus.get(r.id) ?? [];
|
|
78
|
+
const cells: Record<string, OverviewCell> = {};
|
|
79
|
+
for (const c of mine) {
|
|
80
|
+
const k = ownerKey(c);
|
|
81
|
+
const cell = (cells[k] ??= { count: 0, next: null });
|
|
82
|
+
cell.count += 1;
|
|
83
|
+
if (!cell.next || byUrgency(c, cell.next) < 0) cell.next = c;
|
|
84
|
+
const t = totals.get(k) ?? { label: c.ownerName?.trim() || '', total: 0 };
|
|
85
|
+
t.total += 1;
|
|
86
|
+
totals.set(k, t);
|
|
87
|
+
}
|
|
88
|
+
const lastActivity = mine.map((c) => c.lastSeenAt).filter(Boolean).sort().at(-1) ?? null;
|
|
89
|
+
return {
|
|
90
|
+
...r,
|
|
91
|
+
open: mine.length,
|
|
92
|
+
overdue: mine.filter((c) => c.dueAt && Date.parse(c.dueAt) < now).length,
|
|
93
|
+
blocked: mine.filter((c) => c.status === 'blocked').length,
|
|
94
|
+
lastActivity,
|
|
95
|
+
cells,
|
|
96
|
+
};
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
const columns: OverviewColumn[] = [...totals.entries()].map(([key, v]) => {
|
|
100
|
+
const isMe = me.has(key);
|
|
101
|
+
return { key, label: isMe ? 'Me' : v.label || 'Unassigned', total: v.total, isMe };
|
|
102
|
+
});
|
|
103
|
+
columns.sort((a, b) => Number(b.isMe) - Number(a.isMe) || Number(a.key === '') - Number(b.key === '') || b.total - a.total || a.label.localeCompare(b.label));
|
|
104
|
+
|
|
105
|
+
const attention = (r: OverviewRow) => (r.focus?.status === 'off_track' || r.focus?.status === 'at_risk' ? 0 : r.blocked ? 1 : r.overdue ? 2 : 3);
|
|
106
|
+
rows.sort((a, b) => (a.id === NO_PROJECT ? 1 : 0) - (b.id === NO_PROJECT ? 1 : 0) || attention(a) - attention(b) || b.open - a.open || a.title.localeCompare(b.title));
|
|
107
|
+
return { columns, rows };
|
|
108
|
+
}
|