neoagent 1.4.12 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -588,7 +588,7 @@ function getAvailableTools(app, options = {}) {
|
|
|
588
588
|
parameters: {
|
|
589
589
|
type: 'object',
|
|
590
590
|
properties: {
|
|
591
|
-
metric_type: { type: 'string', description: 'Metric to query: "steps", "heart_rate", "sleep_session", "exercise_session", "weight". Omit to see what is available.' },
|
|
591
|
+
metric_type: { type: 'string', description: 'Metric to query. Canonical values: "steps" (also accepts: "step", "step_count"), "heart_rate" (also accepts: "heartbeat", "heartrate", "pulse", "bpm"), "sleep_session" (also accepts: "sleep"), "exercise_session" (also accepts: "exercise", "workout", "activity"), "weight" (also accepts: "body_weight"). Omit to see what is available.' },
|
|
592
592
|
limit: { type: 'number', description: 'Max recent records to return (default 10, max 200). Use a small number unless the user explicitly asks for a full history.' }
|
|
593
593
|
}
|
|
594
594
|
}
|
|
@@ -169,13 +169,41 @@ function getHealthSyncStatus(userId) {
|
|
|
169
169
|
};
|
|
170
170
|
}
|
|
171
171
|
|
|
172
|
+
// Aliases map collapsed/synonym forms → canonical stored metric_type values.
|
|
173
|
+
// Applied after camelCase/space normalization, so keys here are already lowercase+underscored.
|
|
174
|
+
const METRIC_TYPE_ALIASES = {
|
|
175
|
+
// heart rate variants
|
|
176
|
+
heartbeat: 'heart_rate',
|
|
177
|
+
heartrate: 'heart_rate',
|
|
178
|
+
heart_beat: 'heart_rate',
|
|
179
|
+
bpm: 'heart_rate',
|
|
180
|
+
pulse: 'heart_rate',
|
|
181
|
+
// sleep variants
|
|
182
|
+
sleep: 'sleep_session',
|
|
183
|
+
sleeping: 'sleep_session',
|
|
184
|
+
// exercise variants
|
|
185
|
+
exercise: 'exercise_session',
|
|
186
|
+
workout: 'exercise_session',
|
|
187
|
+
activity: 'exercise_session',
|
|
188
|
+
// weight variants
|
|
189
|
+
body_weight: 'weight',
|
|
190
|
+
bodyweight: 'weight',
|
|
191
|
+
mass: 'weight',
|
|
192
|
+
// steps variants
|
|
193
|
+
step_count: 'steps',
|
|
194
|
+
stepcount: 'steps',
|
|
195
|
+
step: 'steps',
|
|
196
|
+
};
|
|
197
|
+
|
|
172
198
|
function normalizeMetricType(raw) {
|
|
173
199
|
// Accept any casing/spacing: "HeartRate" → "heart_rate", "Steps" → "steps", etc.
|
|
174
|
-
|
|
200
|
+
const normalized = String(raw || '')
|
|
175
201
|
.trim()
|
|
176
202
|
.replace(/([a-z])([A-Z])/g, '$1_$2') // camelCase/PascalCase → snake_case
|
|
177
203
|
.replace(/[\s-]+/g, '_') // spaces/dashes → underscore
|
|
178
204
|
.toLowerCase();
|
|
205
|
+
// Resolve known synonyms to canonical stored values
|
|
206
|
+
return METRIC_TYPE_ALIASES[normalized] || normalized;
|
|
179
207
|
}
|
|
180
208
|
|
|
181
209
|
function readHealthData(userId, metricType, limit = 50) {
|