v1.2.0:6 — AI "generate today's workout" from a brain-dump
Add a single-session AI flow alongside program generation: describe a
workout in plain words and get a ready-to-log workout back — exercises
with suggested weights, target reps, and set counts grounded in the
user's recent history. The suggestion can be inline-edited or refined
by sending a follow-up instruction back to the model, then "Use this
workout" pre-fills the normal New Workout form (nothing persists until
the user saves through the regular path).
Why reuse, not fork: the existing program-generation spine (detached
background runner, SSE streaming, lenient-JSON preview, 5 providers,
history context, library name->id mapping) already does the hard parts.
A new AIGeneration.kind discriminant ("program" | "workout", default
"program" via boot-time guarded ALTER) selects the parser and keeps the
ephemeral workout rows out of the program-shaped AI history. Refine is a
fresh generation seeded with the prior suggestion (validated through the
same schema before it re-enters the prompt).
Hand-off is sessionStorage -> /main/workouts/new?from=ai -> AiWorkoutPrefill,
which expands each suggestion into N sets and maps effort by cardio-ness
(Gear for cardio, RPE for strength). EditWorkoutData.id is now optional so
the prefill CREATEs rather than PATCHing a nonexistent id. The AI suggests
each weight in that exercise's effective logging unit (the library JSON
carries a per-exercise unit) so the stored number and unit never diverge.
Built + sideloaded to immense-voyage.local as 1.2.0:6; on-box ALTER and
non-root launch confirmed via start-cli. tsc clean (app + packaging),
251 tests pass, next build + s9pk build succeed.
This commit is contained in:
@@ -221,6 +221,13 @@ if command -v sqlite3 >/dev/null 2>&1 && [ -f "$DB_PATH" ]; then
|
||||
sqlite3 "$DB_PATH" "ALTER TABLE AIGeneration ADD COLUMN durationMs INTEGER;"
|
||||
fi
|
||||
|
||||
# v1.2.0:6: single-workout generation. `kind` discriminates program vs
|
||||
# workout rows; defaults to "program" so existing rows read correctly.
|
||||
if ! sqlite3 "$DB_PATH" "PRAGMA table_info('AIGeneration');" 2>/dev/null | grep -q "|kind|"; then
|
||||
log "adding AIGeneration.kind (default 'program')"
|
||||
sqlite3 "$DB_PATH" "ALTER TABLE AIGeneration ADD COLUMN kind TEXT NOT NULL DEFAULT 'program';"
|
||||
fi
|
||||
|
||||
if ! sqlite3 "$DB_PATH" "PRAGMA table_info('ProgramExercise');" 2>/dev/null | grep -q "|suggestedWeight|"; then
|
||||
log "adding ProgramExercise.suggestedWeight + suggestedWeightUnit"
|
||||
sqlite3 "$DB_PATH" "ALTER TABLE ProgramExercise ADD COLUMN suggestedWeight REAL;"
|
||||
|
||||
@@ -20,6 +20,7 @@ import { v_1_2_0_2 } from './v1.2.0.2'
|
||||
import { v_1_2_0_3 } from './v1.2.0.3'
|
||||
import { v_1_2_0_4 } from './v1.2.0.4'
|
||||
import { v_1_2_0_5 } from './v1.2.0.5'
|
||||
import { v_1_2_0_6 } from './v1.2.0.6'
|
||||
|
||||
/**
|
||||
* Version graph for the `proof-of-work` package.
|
||||
@@ -80,9 +81,14 @@ import { v_1_2_0_5 } from './v1.2.0.5'
|
||||
* v1.2.0:5 — Gear (breathing, 1-5, Brian MacKenzie) replaces RPE as the effort
|
||||
* field for cardio exercises (type "cardio" or "cardio" muscle
|
||||
* group); strength keeps RPE. New SetLog.gear column via boot ALTER.
|
||||
* v1.2.0:6 — AI "generate today's workout": describe a single session and get
|
||||
* a ready-to-log workout (suggested weights/reps from history),
|
||||
* inline-edit + refine-with-AI, then pre-fill the workout log.
|
||||
* Reuses the generation spine via a new AIGeneration.kind
|
||||
* discriminant (boot ALTER, default "program"). No data changes.
|
||||
*/
|
||||
export const versionGraph = VersionGraph.of({
|
||||
current: v_1_2_0_5,
|
||||
current: v_1_2_0_6,
|
||||
other: [
|
||||
v_1_0_0_1,
|
||||
v_1_0_0_2,
|
||||
@@ -104,5 +110,6 @@ export const versionGraph = VersionGraph.of({
|
||||
v_1_2_0_2,
|
||||
v_1_2_0_3,
|
||||
v_1_2_0_4,
|
||||
v_1_2_0_5,
|
||||
],
|
||||
})
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
import { IMPOSSIBLE, VersionInfo } from '@start9labs/start-sdk'
|
||||
|
||||
/**
|
||||
* v1.2.0:6 — AI "generate today's workout" (2026-06-19).
|
||||
*
|
||||
* A new AI flow alongside program generation: describe a single session in
|
||||
* plain words and get a ready-to-log workout back — exercises with suggested
|
||||
* weights + target reps + set counts grounded in recent history. Inline-edit
|
||||
* it, send a follow-up to refine it via the model, then "Use this workout" to
|
||||
* pre-fill the normal New Workout form (nothing persists until you save).
|
||||
*
|
||||
* Reuses the existing generation spine (detached runner / SSE / lenient JSON /
|
||||
* providers / history context) via a new AIGeneration.kind discriminant
|
||||
* ("program" | "workout"). Single-workout rows are ephemeral and excluded from
|
||||
* the program-shaped AI history.
|
||||
*
|
||||
* Additive schema change: the new AIGeneration.kind column (default "program")
|
||||
* is added by the boot-time guarded ALTER in docker_entrypoint.sh, so this
|
||||
* migration stays empty like every other column add. Existing rows read as
|
||||
* "program"; no data changes.
|
||||
*/
|
||||
export const v_1_2_0_6 = VersionInfo.of({
|
||||
version: '1.2.0:6',
|
||||
releaseNotes: {
|
||||
en_US:
|
||||
'New: AI "Today\'s workout". Describe a session in plain words and get a ready-to-log workout with suggested weights and reps from your history. Edit it, refine it with the AI, then pre-fill the workout log. No data changes.',
|
||||
},
|
||||
migrations: {
|
||||
up: async () => {},
|
||||
down: IMPOSSIBLE,
|
||||
},
|
||||
})
|
||||
Reference in New Issue
Block a user