incremnt 0.6.0 → 0.7.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/README.md +0 -3
- package/SKILL.md +57 -0
- package/package.json +4 -2
- package/src/browse.js +7 -1
- package/src/contract.js +57 -21
- package/src/fields.js +41 -0
- package/src/format.js +8 -2
- package/src/lib.js +116 -5
- package/src/mcp.js +60 -4
- package/src/openrouter.js +2 -70
- package/src/queries.js +344 -190
- package/src/remote.js +103 -12
- package/src/summary-evals.js +40 -1
- package/src/sync-service.js +48 -41
- package/src/validate.js +152 -0
package/src/openrouter.js
CHANGED
|
@@ -70,8 +70,7 @@ function exerciseNamesFromContext(source) {
|
|
|
70
70
|
source.exercises?.map((exercise) => exercise.exerciseName ?? exercise.name),
|
|
71
71
|
source.sessions?.flatMap((session) => session.exercises?.map((exercise) => exercise.exerciseName ?? exercise.name) ?? []),
|
|
72
72
|
source.prsThisWeek?.map((pr) => pr.exerciseName),
|
|
73
|
-
source.stalledExercises?.map((exercise) => exercise.exerciseName)
|
|
74
|
-
source.goalProgress?.map((goal) => goal.exerciseName)
|
|
73
|
+
source.stalledExercises?.map((exercise) => exercise.exerciseName)
|
|
75
74
|
]);
|
|
76
75
|
}
|
|
77
76
|
|
|
@@ -108,8 +107,7 @@ function includedSectionsForSurface(surface, source) {
|
|
|
108
107
|
return [
|
|
109
108
|
'week',
|
|
110
109
|
hasItems(source.prsThisWeek) ? 'prs' : null,
|
|
111
|
-
hasItems(source.stalledExercises) ? 'stalled_exercises' : null
|
|
112
|
-
hasItems(source.goalProgress) ? 'goal_progress' : null
|
|
110
|
+
hasItems(source.stalledExercises) ? 'stalled_exercises' : null
|
|
113
111
|
].filter(Boolean);
|
|
114
112
|
default:
|
|
115
113
|
return [];
|
|
@@ -713,12 +711,6 @@ export function formatCycleContext(ctx) {
|
|
|
713
711
|
`Program: ${ctx.programName}, Week ${ctx.cycleNumber}${intentLabel}, ${ctx.totalSessions} session(s).`
|
|
714
712
|
];
|
|
715
713
|
|
|
716
|
-
const phaseLines = formatProgramPhaseContext(ctx.programPhase);
|
|
717
|
-
if (phaseLines.length > 0) {
|
|
718
|
-
lines.push('');
|
|
719
|
-
lines.push(...phaseLines);
|
|
720
|
-
}
|
|
721
|
-
|
|
722
714
|
if (ctx.prioritySignals?.length > 0) {
|
|
723
715
|
lines.push('');
|
|
724
716
|
lines.push('Priority signals (ranked):');
|
|
@@ -798,14 +790,6 @@ export function formatCycleContext(ctx) {
|
|
|
798
790
|
}
|
|
799
791
|
}
|
|
800
792
|
|
|
801
|
-
if (ctx.goalProgress) {
|
|
802
|
-
lines.push('');
|
|
803
|
-
lines.push('Goal progress:');
|
|
804
|
-
for (const g of ctx.goalProgress) {
|
|
805
|
-
lines.push(` ${g.exerciseName}: ${g.progressPercent ?? '?'}% toward ${g.targetE1RM} e1RM`);
|
|
806
|
-
}
|
|
807
|
-
}
|
|
808
|
-
|
|
809
793
|
if (ctx.previousCycles?.length > 0) {
|
|
810
794
|
lines.push('');
|
|
811
795
|
lines.push('Previous cycles:');
|
|
@@ -963,10 +947,6 @@ export function formatWorkoutContext(ctx) {
|
|
|
963
947
|
const timeOfDay = hour < 12 ? 'morning' : hour < 17 ? 'afternoon' : 'evening';
|
|
964
948
|
lines.push(`Completed: ${dayNames[d.getUTCDay()]}, ${timeOfDay}.`);
|
|
965
949
|
}
|
|
966
|
-
if (ctx.programWeekNumber) {
|
|
967
|
-
const phase = ctx.programProgressionType ? ` (${ctx.programProgressionType})` : '';
|
|
968
|
-
lines.push(`Program week: ${ctx.programWeekNumber}${phase}.`);
|
|
969
|
-
}
|
|
970
950
|
if (ctx.sessionsThisWeek) {
|
|
971
951
|
lines.push(`Sessions this week: ${ctx.sessionsThisWeek}.`);
|
|
972
952
|
}
|
|
@@ -1201,12 +1181,6 @@ export function formatCheckpointContext(ctx) {
|
|
|
1201
1181
|
`Program: ${ctx.programName}, Checkpoint at week ${ctx.checkpointWeek} of ${ctx.totalWeeks}.`
|
|
1202
1182
|
];
|
|
1203
1183
|
|
|
1204
|
-
const phaseLines = formatProgramPhaseContext(ctx.programPhase);
|
|
1205
|
-
if (phaseLines.length > 0) {
|
|
1206
|
-
lines.push('');
|
|
1207
|
-
lines.push(...phaseLines);
|
|
1208
|
-
}
|
|
1209
|
-
|
|
1210
1184
|
lines.push('');
|
|
1211
1185
|
lines.push('Exercise targets:');
|
|
1212
1186
|
for (const ex of ctx.exercises) {
|
|
@@ -1419,10 +1393,6 @@ function formatWeeklyCheckinContext(context) {
|
|
|
1419
1393
|
const lines = [];
|
|
1420
1394
|
lines.push(`Today: ${context.todayIso}`);
|
|
1421
1395
|
lines.push(`Week range: ${context.weekRangeIso?.start} to ${context.weekRangeIso?.end}`);
|
|
1422
|
-
const phaseLines = formatProgramPhaseContext(context.programPhase);
|
|
1423
|
-
if (phaseLines.length > 0) {
|
|
1424
|
-
lines.push(...phaseLines);
|
|
1425
|
-
}
|
|
1426
1396
|
lines.push(`Sessions this week: ${context.sessionCount}`);
|
|
1427
1397
|
if (context.adherencePct != null) {
|
|
1428
1398
|
lines.push(`Adherence: ${context.completedSets}/${context.plannedSets} sets (${context.adherencePct}%)`);
|
|
@@ -1446,47 +1416,9 @@ function formatWeeklyCheckinContext(context) {
|
|
|
1446
1416
|
const sign = context.bodyweightDeltaKg >= 0 ? '+' : '';
|
|
1447
1417
|
lines.push(`Bodyweight 7d delta: ${sign}${context.bodyweightDeltaKg}kg`);
|
|
1448
1418
|
}
|
|
1449
|
-
if (Array.isArray(context.goalProgress) && context.goalProgress.length > 0) {
|
|
1450
|
-
lines.push('Goal progress:');
|
|
1451
|
-
for (const g of context.goalProgress) {
|
|
1452
|
-
const deadline = g.finishDate ? ` (finish ${g.finishDate})` : '';
|
|
1453
|
-
lines.push(` - ${g.exerciseName}: ${g.progressPercent}% toward ${g.targetE1RM}kg${deadline}`);
|
|
1454
|
-
}
|
|
1455
|
-
}
|
|
1456
1419
|
return lines.join('\n');
|
|
1457
1420
|
}
|
|
1458
1421
|
|
|
1459
|
-
export function formatProgramPhaseContext(programPhase) {
|
|
1460
|
-
if (!programPhase || typeof programPhase !== 'object') return [];
|
|
1461
|
-
const current = programPhase.current;
|
|
1462
|
-
if (!current?.phase || typeof current.displayWeek !== 'number') return [];
|
|
1463
|
-
|
|
1464
|
-
const describe = (phase) => {
|
|
1465
|
-
if (!phase?.phase) return null;
|
|
1466
|
-
const week = typeof phase.displayWeek === 'number' ? `week ${phase.displayWeek}` : 'week ?';
|
|
1467
|
-
return `${week} ${phase.phase}${phase.isDeload ? ' (deload)' : ''}`;
|
|
1468
|
-
};
|
|
1469
|
-
const describeList = (phases) => {
|
|
1470
|
-
if (!Array.isArray(phases) || phases.length === 0) return null;
|
|
1471
|
-
return phases.map(describe).filter(Boolean).join(', ');
|
|
1472
|
-
};
|
|
1473
|
-
|
|
1474
|
-
const lines = ['Program phase:'];
|
|
1475
|
-
lines.push(` Current: ${describe(current)}`);
|
|
1476
|
-
const previous = describe(programPhase.previousWeek);
|
|
1477
|
-
if (previous) lines.push(` Previous: ${previous}`);
|
|
1478
|
-
const next = describe(programPhase.nextWeek);
|
|
1479
|
-
if (next) lines.push(` Next: ${next}`);
|
|
1480
|
-
if (programPhase.isPostDeloadReturn === true) {
|
|
1481
|
-
lines.push(' Post-deload return: yes');
|
|
1482
|
-
}
|
|
1483
|
-
const range = describeList(programPhase.phasesInRange);
|
|
1484
|
-
if (range) lines.push(` Range phases: ${range}`);
|
|
1485
|
-
const previousRange = describeList(programPhase.previousRangePhases);
|
|
1486
|
-
if (previousRange) lines.push(` Previous range phases: ${previousRange}`);
|
|
1487
|
-
return lines;
|
|
1488
|
-
}
|
|
1489
|
-
|
|
1490
1422
|
export async function generateWeeklyCheckinRecap(context, { apiKey, model, timeoutMs, priorCommitment, user, sessionId, contextMetadata } = {}) {
|
|
1491
1423
|
const contextText = formatWeeklyCheckinContext(context);
|
|
1492
1424
|
const userLines = [fenceContent('training_data', contextText)];
|