Add risk assessment AI and streak freeze feature#16
Merged
Conversation
Added comprehensive risk+excitement assessment AI responses along with a simple streak freeze feature that may introduce unique risk v. reward dynamics with the streak system, looking for some more further testing and refining
Co-authored-by: Krystal <32627918+krystalenby@users.noreply.github.com> Co-authored-by: MeganRGreenwood <275585135+MeganRGreenwood@users.noreply.github.com> Co-authored-by: Krystal Rose <Krystal.rose@sillylittle.tech> Co-authored-by: Megan Greenwood <mgngwd@sillylittle.tech>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds an AI-assisted safety/risk assessment pipeline for journal entries and introduces a “streak freeze / streak restore” mechanic to the points system, while also making weekly compilation stats selection and AI endpoint handling more robust.
Changes:
- Add local + Worker-refined risk assessment (riskScore/riskLevel) and show supportive/crisis UI after entry submission.
- Add streak freezes/restores with shop purchase flow and cloud-sync persistence.
- Improve weekly projector stats selection (prefer latest delivered weekly package) and harden AI endpoint URL normalization/error details.
Reviewed changes
Copilot reviewed 21 out of 21 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| worker/src/riskAssessment.ts | New Worker route to run AI risk classification and return normalized risk fields/messages. |
| worker/src/index.ts | Routes /risk-assessment requests to the new Worker handler. |
| src/features/safety/riskAssessment.ts | Adds local risk scoring + optional Worker refinement, plus request/response parsing. |
| src/features/safety/flagTerms.ts | Removed older term-flagging implementation in favor of the new risk assessment module. |
| src/features/safety/CrisisResourcePanel.tsx | Adds a reusable crisis resources panel (988 + global directory + optional geolocation hint). |
| src/features/compose/LetterComposer.tsx | Integrates risk assessment into composition flow and shows a post-submit modal for support/crisis. |
| src/db/schema.ts | Adds riskScore / riskLevel to entries and migrates existing rows to defaults (Dexie v6). |
| src/db/validation.ts | Extends Zod validation to include riskScore and riskLevel. |
| src/features/entries/entryService.ts | Persists risk fields from drafts into stored entry rows. |
| src/features/score/scoreService.ts | Implements streak freezes/restores, adds new score snapshot fields, and sync helpers. |
| src/shared/sync/syncService.ts | Syncs streakFreezes and streakRestore through Firestore meta score doc. |
| src/features/shop/Shoppe.tsx | Adds UI/actions to buy streak freezes and restore a recently-broken streak. |
| src/features/score/ScoreTicker.tsx | Displays streak freeze count in the header ticker when present. |
| src/App.tsx | Wires streak freeze count into ScoreTicker. |
| src/features/compilation/weeklyStats.ts | Adds getWeeklyStatsForWeekKey to compute stats for an explicit week. |
| src/features/packages/packageService.ts | Adds getLatestDeliveredWeeklyPackage to find the most recent relevant weekly delivery. |
| src/features/compilation/WeeklyProjector.tsx | Uses latest delivered weekly package to choose week stats; adds fallback handling. |
| src/features/compilation/weeklyAiSummary.ts | Adds normalizeEndpointUrl + improved error details for AI endpoint failures. |
| src/features/debug/DebugPanel.tsx | Adds AI endpoint checker and improves weekly package seeding to match latest entry week. |
| package.json | Bumps app version to 1.10.3. |
| VERSION | Bumps repo VERSION to 1.10.3. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+92
to
+93
| setStats(fallbackStats) | ||
| setDelivered(false) |
Copilot stopped work on behalf of
kiyarose due to an error
June 1, 2026 10:51
Add animation sequences for streak freezes and streak breaking, with focus model Co-authored-by: Krystal Rose <krystal.rose@sillylittle.tech> Co-authored-by: Krystal Enby<32627918+krystalenby@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.