@demind-inc/core 1.7.48 → 1.7.50
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/dist/featureFlags.types.d.ts +1 -0
- package/dist/models/Calendar.d.ts +2 -0
- package/dist/models/RichContext.d.ts +166 -0
- package/dist/models/RichContext.js +2 -0
- package/dist/models/index.d.ts +1 -0
- package/dist/models/index.js +1 -0
- package/dist/types.d.ts +2 -1
- package/lib/featureFlags.types.ts +1 -0
- package/lib/models/Calendar.ts +2 -0
- package/lib/models/RichContext.ts +252 -0
- package/lib/models/index.ts +1 -0
- package/lib/types.ts +2 -0
- package/package.json +1 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { DocumentReference } from "@google-cloud/firestore";
|
|
2
2
|
import { TodoAppFrom } from "./TodoTasks";
|
|
3
|
+
import { RichContext } from "./RichContext";
|
|
3
4
|
export type CalendarType = "google" | "outlook" | "lifestack" | "apple";
|
|
4
5
|
export type CalendarScope = "owner" | "writer" | "reader" | "freeBusyReader";
|
|
5
6
|
export type CalendarEventStatus = "confirmed" | "tentative" | "cancelled";
|
|
@@ -46,6 +47,7 @@ export interface CalendarEvent {
|
|
|
46
47
|
eventId: string;
|
|
47
48
|
summary: string;
|
|
48
49
|
description?: string;
|
|
50
|
+
richContext?: RichContext | null;
|
|
49
51
|
start: {
|
|
50
52
|
date: string;
|
|
51
53
|
timeZone: string;
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
export type SignalSource = "location" | "weather" | "energy" | "sleep" | "screen_time" | "commute" | "menstrual_cycle" | "steps" | "medication" | (string & {});
|
|
2
|
+
export interface Location {
|
|
3
|
+
name: string;
|
|
4
|
+
lat: number | null;
|
|
5
|
+
lng: number | null;
|
|
6
|
+
}
|
|
7
|
+
export interface Signal {
|
|
8
|
+
signal_source: SignalSource;
|
|
9
|
+
urgency: "now" | "today" | "info";
|
|
10
|
+
body: string;
|
|
11
|
+
expires_at: string | null;
|
|
12
|
+
data: SignalData | null;
|
|
13
|
+
}
|
|
14
|
+
export type SignalData = {
|
|
15
|
+
name: string;
|
|
16
|
+
distance_m: number | null;
|
|
17
|
+
lat: number | null;
|
|
18
|
+
lng: number | null;
|
|
19
|
+
place_type: string | null;
|
|
20
|
+
} | {
|
|
21
|
+
condition: string;
|
|
22
|
+
temp_c: number | null;
|
|
23
|
+
feels_like_c: number | null;
|
|
24
|
+
rain_probability: number | null;
|
|
25
|
+
uv_index: number | null;
|
|
26
|
+
} | {
|
|
27
|
+
zone: "peak" | "calm" | "low" | "recovering";
|
|
28
|
+
hrv: number | null;
|
|
29
|
+
sleep_score: number | null;
|
|
30
|
+
readiness_score: number | null;
|
|
31
|
+
} | {
|
|
32
|
+
duration_h: number;
|
|
33
|
+
quality_score: number | null;
|
|
34
|
+
deep_h: number | null;
|
|
35
|
+
rem_h: number | null;
|
|
36
|
+
awakenings: number | null;
|
|
37
|
+
} | {
|
|
38
|
+
total_min: number;
|
|
39
|
+
last_2h_min: number | null;
|
|
40
|
+
top_app: string | null;
|
|
41
|
+
} | {
|
|
42
|
+
duration_min: number;
|
|
43
|
+
mode: "transit" | "driving" | "walking" | "cycling";
|
|
44
|
+
origin: string | null;
|
|
45
|
+
destination: string | null;
|
|
46
|
+
} | {
|
|
47
|
+
phase: "menstrual" | "follicular" | "ovulatory" | "luteal";
|
|
48
|
+
day_in_cycle: number;
|
|
49
|
+
energy_modifier: number;
|
|
50
|
+
} | {
|
|
51
|
+
today: number;
|
|
52
|
+
goal: number;
|
|
53
|
+
percent_complete: number;
|
|
54
|
+
} | {
|
|
55
|
+
name: string;
|
|
56
|
+
dose: string | null;
|
|
57
|
+
taken_today: boolean;
|
|
58
|
+
next_due_at: string | null;
|
|
59
|
+
} | Record<string, unknown>;
|
|
60
|
+
export type ActionType = "start_timer" | "open_map" | "open_url" | "log_metric" | "dismiss" | (string & {});
|
|
61
|
+
export type ActionPayload = {
|
|
62
|
+
duration_min: number;
|
|
63
|
+
session_title: string | null;
|
|
64
|
+
} | {
|
|
65
|
+
destination_name: string;
|
|
66
|
+
lat: number;
|
|
67
|
+
lng: number;
|
|
68
|
+
} | {
|
|
69
|
+
url: string | null;
|
|
70
|
+
open_in: "webview" | "browser";
|
|
71
|
+
} | {
|
|
72
|
+
metric_type: string;
|
|
73
|
+
value: number | null;
|
|
74
|
+
unit: string | null;
|
|
75
|
+
} | null;
|
|
76
|
+
export interface Action {
|
|
77
|
+
label: string;
|
|
78
|
+
action_type: ActionType;
|
|
79
|
+
payload: ActionPayload;
|
|
80
|
+
}
|
|
81
|
+
export type ContentType = "workout_plan" | "checklist" | "meal_suggestion" | "transit_route" | "journal_prompts" | "audio_player" | "energy_summary" | "sleep_summary" | "metric_bar" | "meal_plan_week" | (string & {});
|
|
82
|
+
export type ContentPayload = {
|
|
83
|
+
plan_title: string;
|
|
84
|
+
difficulty: "beginner" | "intermediate" | "advanced";
|
|
85
|
+
exercises: {
|
|
86
|
+
name: string;
|
|
87
|
+
sets: number;
|
|
88
|
+
reps: number;
|
|
89
|
+
note: string | null;
|
|
90
|
+
}[];
|
|
91
|
+
} | {
|
|
92
|
+
label: string | null;
|
|
93
|
+
items: {
|
|
94
|
+
text: string;
|
|
95
|
+
done: boolean;
|
|
96
|
+
}[];
|
|
97
|
+
} | {
|
|
98
|
+
venue_name: string;
|
|
99
|
+
dish_name: string;
|
|
100
|
+
dish_tags: string[];
|
|
101
|
+
kcal: number | null;
|
|
102
|
+
image_url: string | null;
|
|
103
|
+
price: number | null;
|
|
104
|
+
rating: number | null;
|
|
105
|
+
menu_url: string | null;
|
|
106
|
+
} | {
|
|
107
|
+
origin: string;
|
|
108
|
+
destination: string;
|
|
109
|
+
depart_by: string;
|
|
110
|
+
} | {
|
|
111
|
+
label: string | null;
|
|
112
|
+
prompts: string[];
|
|
113
|
+
} | {
|
|
114
|
+
track_name: string;
|
|
115
|
+
category: "sleep" | "focus" | "meditation" | "wind_down";
|
|
116
|
+
duration_min: number | null;
|
|
117
|
+
stream_url: string | null;
|
|
118
|
+
} | {
|
|
119
|
+
current_zone: "peak" | "calm" | "low" | "recovering";
|
|
120
|
+
zones: {
|
|
121
|
+
label: string;
|
|
122
|
+
start: string;
|
|
123
|
+
end: string;
|
|
124
|
+
level: "peak" | "calm" | "low";
|
|
125
|
+
}[];
|
|
126
|
+
} | {
|
|
127
|
+
duration_h: number;
|
|
128
|
+
quality_score: number | null;
|
|
129
|
+
deep_h: number | null;
|
|
130
|
+
rem_h: number | null;
|
|
131
|
+
awakenings: number | null;
|
|
132
|
+
chart_data: {
|
|
133
|
+
stage: "awake" | "light" | "deep" | "rem";
|
|
134
|
+
start_min: number;
|
|
135
|
+
end_min: number;
|
|
136
|
+
}[];
|
|
137
|
+
} | {
|
|
138
|
+
label: string;
|
|
139
|
+
value: number;
|
|
140
|
+
unit: string;
|
|
141
|
+
min: number;
|
|
142
|
+
max: number;
|
|
143
|
+
baseline: number | null;
|
|
144
|
+
color_ramp: "red_to_green" | "green_to_red" | "neutral";
|
|
145
|
+
} | {
|
|
146
|
+
days: {
|
|
147
|
+
date: string;
|
|
148
|
+
meals: {
|
|
149
|
+
slot: "breakfast" | "lunch" | "dinner" | "snack";
|
|
150
|
+
dish: string;
|
|
151
|
+
kcal: number | null;
|
|
152
|
+
time: string | null;
|
|
153
|
+
}[];
|
|
154
|
+
}[];
|
|
155
|
+
} | Record<string, unknown>;
|
|
156
|
+
export interface Content {
|
|
157
|
+
type: ContentType;
|
|
158
|
+
payload: ContentPayload;
|
|
159
|
+
}
|
|
160
|
+
export interface RichContext {
|
|
161
|
+
signals: Signal[];
|
|
162
|
+
location: Location | null;
|
|
163
|
+
reminder_min: number | null;
|
|
164
|
+
action: Action | null;
|
|
165
|
+
content: Content | Content[] | null;
|
|
166
|
+
}
|
package/dist/models/index.d.ts
CHANGED
package/dist/models/index.js
CHANGED
package/dist/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CalendarEvent, CalendarRoutineFrom, CalendarTaskFrom, EMASatisfaction, EnergyFeedbackType, EventCategorySet, MealType, MetricActivity, MetricHRValueSet, MetricMealDetail, MetricMealSummary, MetricStressValueSet, PhaseStartEndSet, RoutineActivity, SleepDetail, TaskItem, TaskPriority, TodoAppFrom } from "./models";
|
|
1
|
+
import { CalendarEvent, CalendarRoutineFrom, CalendarTaskFrom, EMASatisfaction, EnergyFeedbackType, EventCategorySet, MealType, MetricActivity, MetricHRValueSet, MetricMealDetail, MetricMealSummary, MetricStressValueSet, PhaseStartEndSet, RichContext, RoutineActivity, SleepDetail, TaskItem, TaskPriority, TodoAppFrom } from "./models";
|
|
2
2
|
export type SupportedTerraProvidersType = "FITBIT" | "OURA" | "GARMIN" | "WHOOP" | "ULTRAHUMAN" | "STRAVA" | "MYFITNESSPAL";
|
|
3
3
|
export type SupportedTerraSDKType = "APPLE" | "GOOGLE_FIT" | "SAMSUNG_HEALTH" | "FREESTYLE_LIBRE";
|
|
4
4
|
export type CircadianPhase = "default" | "wakeup_low" | "wakeup_normal" | "morning_high" | "morning_normal" | "morning_low" | "evening_high" | "evening_low" | "evening_normal";
|
|
@@ -41,6 +41,7 @@ export interface ScheduledAction {
|
|
|
41
41
|
eventFrom?: ScheduledActionEventFrom;
|
|
42
42
|
priority?: TaskPriority;
|
|
43
43
|
actionType?: ScheduledActionType;
|
|
44
|
+
richContext?: RichContext | null;
|
|
44
45
|
}
|
|
45
46
|
export interface ScheduledActionOptions {
|
|
46
47
|
startDate: string;
|
package/lib/models/Calendar.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { DocumentReference } from "@google-cloud/firestore";
|
|
2
2
|
import { TodoAppFrom } from "./TodoTasks";
|
|
3
|
+
import { RichContext } from "./RichContext";
|
|
3
4
|
|
|
4
5
|
export type CalendarType = "google" | "outlook" | "lifestack" | "apple";
|
|
5
6
|
export type CalendarScope = "owner" | "writer" | "reader" | "freeBusyReader";
|
|
@@ -52,6 +53,7 @@ export interface CalendarEvent {
|
|
|
52
53
|
eventId: string;
|
|
53
54
|
summary: string;
|
|
54
55
|
description?: string;
|
|
56
|
+
richContext?: RichContext | null;
|
|
55
57
|
start: {
|
|
56
58
|
date: string;
|
|
57
59
|
timeZone: string;
|
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
export type SignalSource =
|
|
2
|
+
| "location"
|
|
3
|
+
| "weather"
|
|
4
|
+
| "energy"
|
|
5
|
+
| "sleep"
|
|
6
|
+
| "screen_time"
|
|
7
|
+
| "commute"
|
|
8
|
+
| "menstrual_cycle"
|
|
9
|
+
| "steps"
|
|
10
|
+
| "medication"
|
|
11
|
+
| (string & {});
|
|
12
|
+
|
|
13
|
+
export interface Location {
|
|
14
|
+
name: string;
|
|
15
|
+
lat: number | null;
|
|
16
|
+
lng: number | null;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface Signal {
|
|
20
|
+
signal_source: SignalSource;
|
|
21
|
+
urgency: "now" | "today" | "info";
|
|
22
|
+
// Must describe a concrete value (ex: "HRV 64"), not an opinion (ex: "energy is good").
|
|
23
|
+
body: string;
|
|
24
|
+
// ISO 8601
|
|
25
|
+
expires_at: string | null;
|
|
26
|
+
data: SignalData | null;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export type SignalData =
|
|
30
|
+
| {
|
|
31
|
+
// location
|
|
32
|
+
name: string;
|
|
33
|
+
distance_m: number | null;
|
|
34
|
+
lat: number | null;
|
|
35
|
+
lng: number | null;
|
|
36
|
+
place_type: string | null;
|
|
37
|
+
}
|
|
38
|
+
| {
|
|
39
|
+
// weather
|
|
40
|
+
condition: string;
|
|
41
|
+
temp_c: number | null;
|
|
42
|
+
feels_like_c: number | null;
|
|
43
|
+
rain_probability: number | null;
|
|
44
|
+
uv_index: number | null;
|
|
45
|
+
}
|
|
46
|
+
| {
|
|
47
|
+
// energy
|
|
48
|
+
zone: "peak" | "calm" | "low" | "recovering";
|
|
49
|
+
hrv: number | null;
|
|
50
|
+
sleep_score: number | null;
|
|
51
|
+
readiness_score: number | null;
|
|
52
|
+
}
|
|
53
|
+
| {
|
|
54
|
+
// sleep
|
|
55
|
+
duration_h: number;
|
|
56
|
+
quality_score: number | null;
|
|
57
|
+
deep_h: number | null;
|
|
58
|
+
rem_h: number | null;
|
|
59
|
+
awakenings: number | null;
|
|
60
|
+
}
|
|
61
|
+
| {
|
|
62
|
+
// screen_time
|
|
63
|
+
total_min: number;
|
|
64
|
+
last_2h_min: number | null;
|
|
65
|
+
top_app: string | null;
|
|
66
|
+
}
|
|
67
|
+
| {
|
|
68
|
+
// commute
|
|
69
|
+
duration_min: number;
|
|
70
|
+
mode: "transit" | "driving" | "walking" | "cycling";
|
|
71
|
+
origin: string | null;
|
|
72
|
+
destination: string | null;
|
|
73
|
+
}
|
|
74
|
+
| {
|
|
75
|
+
// menstrual_cycle
|
|
76
|
+
phase: "menstrual" | "follicular" | "ovulatory" | "luteal";
|
|
77
|
+
day_in_cycle: number;
|
|
78
|
+
energy_modifier: number;
|
|
79
|
+
}
|
|
80
|
+
| {
|
|
81
|
+
// steps
|
|
82
|
+
today: number;
|
|
83
|
+
goal: number;
|
|
84
|
+
percent_complete: number;
|
|
85
|
+
}
|
|
86
|
+
| {
|
|
87
|
+
// medication
|
|
88
|
+
name: string;
|
|
89
|
+
dose: string | null;
|
|
90
|
+
taken_today: boolean;
|
|
91
|
+
next_due_at: string | null;
|
|
92
|
+
}
|
|
93
|
+
| Record<string, unknown>;
|
|
94
|
+
|
|
95
|
+
export type ActionType =
|
|
96
|
+
| "start_timer"
|
|
97
|
+
| "open_map"
|
|
98
|
+
| "open_url"
|
|
99
|
+
| "log_metric"
|
|
100
|
+
| "dismiss"
|
|
101
|
+
| (string & {});
|
|
102
|
+
|
|
103
|
+
export type ActionPayload =
|
|
104
|
+
| {
|
|
105
|
+
// start_timer
|
|
106
|
+
duration_min: number;
|
|
107
|
+
session_title: string | null;
|
|
108
|
+
}
|
|
109
|
+
| {
|
|
110
|
+
// open_map
|
|
111
|
+
destination_name: string;
|
|
112
|
+
lat: number;
|
|
113
|
+
lng: number;
|
|
114
|
+
}
|
|
115
|
+
| {
|
|
116
|
+
// open_url
|
|
117
|
+
url: string | null;
|
|
118
|
+
open_in: "webview" | "browser";
|
|
119
|
+
}
|
|
120
|
+
| {
|
|
121
|
+
// log_metric
|
|
122
|
+
metric_type: string;
|
|
123
|
+
value: number | null;
|
|
124
|
+
unit: string | null;
|
|
125
|
+
}
|
|
126
|
+
| null;
|
|
127
|
+
|
|
128
|
+
export interface Action {
|
|
129
|
+
label: string;
|
|
130
|
+
action_type: ActionType;
|
|
131
|
+
payload: ActionPayload;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export type ContentType =
|
|
135
|
+
| "workout_plan"
|
|
136
|
+
| "checklist"
|
|
137
|
+
| "meal_suggestion"
|
|
138
|
+
| "transit_route"
|
|
139
|
+
| "journal_prompts"
|
|
140
|
+
| "audio_player"
|
|
141
|
+
| "energy_summary"
|
|
142
|
+
| "sleep_summary"
|
|
143
|
+
| "metric_bar"
|
|
144
|
+
| "meal_plan_week"
|
|
145
|
+
| (string & {});
|
|
146
|
+
|
|
147
|
+
export type ContentPayload =
|
|
148
|
+
| {
|
|
149
|
+
// workout_plan
|
|
150
|
+
plan_title: string;
|
|
151
|
+
difficulty: "beginner" | "intermediate" | "advanced";
|
|
152
|
+
exercises: {
|
|
153
|
+
name: string;
|
|
154
|
+
sets: number;
|
|
155
|
+
reps: number;
|
|
156
|
+
note: string | null;
|
|
157
|
+
}[];
|
|
158
|
+
}
|
|
159
|
+
| {
|
|
160
|
+
// checklist
|
|
161
|
+
label: string | null;
|
|
162
|
+
items: { text: string; done: boolean }[];
|
|
163
|
+
}
|
|
164
|
+
| {
|
|
165
|
+
// meal_suggestion
|
|
166
|
+
venue_name: string;
|
|
167
|
+
dish_name: string;
|
|
168
|
+
dish_tags: string[];
|
|
169
|
+
kcal: number | null;
|
|
170
|
+
image_url: string | null;
|
|
171
|
+
price: number | null;
|
|
172
|
+
rating: number | null;
|
|
173
|
+
menu_url: string | null;
|
|
174
|
+
}
|
|
175
|
+
| {
|
|
176
|
+
// transit_route
|
|
177
|
+
origin: string;
|
|
178
|
+
destination: string;
|
|
179
|
+
depart_by: string;
|
|
180
|
+
}
|
|
181
|
+
| {
|
|
182
|
+
// journal_prompts
|
|
183
|
+
label: string | null;
|
|
184
|
+
prompts: string[];
|
|
185
|
+
}
|
|
186
|
+
| {
|
|
187
|
+
// audio_player
|
|
188
|
+
track_name: string;
|
|
189
|
+
category: "sleep" | "focus" | "meditation" | "wind_down";
|
|
190
|
+
duration_min: number | null;
|
|
191
|
+
stream_url: string | null;
|
|
192
|
+
}
|
|
193
|
+
| {
|
|
194
|
+
// energy_summary
|
|
195
|
+
current_zone: "peak" | "calm" | "low" | "recovering";
|
|
196
|
+
zones: {
|
|
197
|
+
label: string;
|
|
198
|
+
start: string;
|
|
199
|
+
end: string;
|
|
200
|
+
level: "peak" | "calm" | "low";
|
|
201
|
+
}[];
|
|
202
|
+
}
|
|
203
|
+
| {
|
|
204
|
+
// sleep_summary
|
|
205
|
+
duration_h: number;
|
|
206
|
+
quality_score: number | null;
|
|
207
|
+
deep_h: number | null;
|
|
208
|
+
rem_h: number | null;
|
|
209
|
+
awakenings: number | null;
|
|
210
|
+
chart_data: {
|
|
211
|
+
stage: "awake" | "light" | "deep" | "rem";
|
|
212
|
+
start_min: number;
|
|
213
|
+
end_min: number;
|
|
214
|
+
}[];
|
|
215
|
+
}
|
|
216
|
+
| {
|
|
217
|
+
// metric_bar
|
|
218
|
+
label: string;
|
|
219
|
+
value: number;
|
|
220
|
+
unit: string;
|
|
221
|
+
min: number;
|
|
222
|
+
max: number;
|
|
223
|
+
baseline: number | null;
|
|
224
|
+
color_ramp: "red_to_green" | "green_to_red" | "neutral";
|
|
225
|
+
}
|
|
226
|
+
| {
|
|
227
|
+
// meal_plan_week
|
|
228
|
+
days: {
|
|
229
|
+
date: string;
|
|
230
|
+
meals: {
|
|
231
|
+
slot: "breakfast" | "lunch" | "dinner" | "snack";
|
|
232
|
+
dish: string;
|
|
233
|
+
kcal: number | null;
|
|
234
|
+
time: string | null;
|
|
235
|
+
}[];
|
|
236
|
+
}[];
|
|
237
|
+
}
|
|
238
|
+
| Record<string, unknown>;
|
|
239
|
+
|
|
240
|
+
export interface Content {
|
|
241
|
+
type: ContentType;
|
|
242
|
+
payload: ContentPayload;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
export interface RichContext {
|
|
246
|
+
signals: Signal[];
|
|
247
|
+
location: Location | null;
|
|
248
|
+
reminder_min: number | null;
|
|
249
|
+
action: Action | null;
|
|
250
|
+
content: Content | Content[] | null;
|
|
251
|
+
}
|
|
252
|
+
|
package/lib/models/index.ts
CHANGED
package/lib/types.ts
CHANGED
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
MetricMealSummary,
|
|
13
13
|
MetricStressValueSet,
|
|
14
14
|
PhaseStartEndSet,
|
|
15
|
+
RichContext,
|
|
15
16
|
RoutineActivity,
|
|
16
17
|
SleepDetail,
|
|
17
18
|
TaskItem,
|
|
@@ -98,6 +99,7 @@ export interface ScheduledAction {
|
|
|
98
99
|
eventFrom?: ScheduledActionEventFrom;
|
|
99
100
|
priority?: TaskPriority;
|
|
100
101
|
actionType?: ScheduledActionType;
|
|
102
|
+
richContext?: RichContext | null;
|
|
101
103
|
}
|
|
102
104
|
|
|
103
105
|
export interface ScheduledActionOptions {
|