mirror of
https://github.com/bitbaum/heidi.git
synced 2026-12-04 08:38:28 +01:00
batch-2
15
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
e8018631cb |
Chat: translate or talk in one tap, a model you can see and pick, /models (#363)
- Two pills in the composer, «Übersetzen» and «Gespräch» (chatkit's `modes`), remembered in `heidi.chat.prefs.v1` and sent with every message. On Translate the turn gets an instruction that the text is to be carried across, never answered, and never declined for its topic (lib/domain/chat/intent.ts). Reported from a phone: four sentences about tariffs, pasted to be translated, were declined as political analysis. - Under an answer in mode "answer": «Nur übersetzen» resends the line as a translation and leaves the composer on Translate. - The dock gets the model chip (it mounted the sheet with no button). The chip names the model: own key, the free one picked, or the one that wrote the last answer. - The sheet's free-model list is a picker; the pick only reorders the chain (`preferred`), and an id the deployment does not run is ignored. - /models: each free model with what it did here, from every turn since the restart (lib/domain/model/stats.ts) and stored answers of 30 days. - Privacy page declares the new store; /models in the layout audit, noindex and out of the sitemap. Claude-Session: https://claude.ai/code/session_019MDtmtfseicWGK2CMC2U5r Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
d4e9a58580 |
Pay in francs (card, TWINT), visible models, a daily limit with a way on (#362)
- A second way to pay for a pass: Swiss francs on Stripe's hosted page, where the Stripe account's methods (card, TWINT, wallets) are offered. Off until STRIPE_SECRET_KEY and a CHF price are set; each rail is on or off by itself. Stripe is told nothing about the Heidi account. Own webhook path, /api/pay/webhook/stripe. The provider is paykit's (PR bitbaum/paykit#19), copied in lib/pay/stripe-provider.ts until 0.4.0 is released, with a test that fails the day the package has it. - /pass: one card per pass, a price and button per rail; buying is the one filled action. A failed checkout no longer prints "fetch failed". - /owner/payments: each rail, what is set (names only), what is missing, and the webhook addresses to paste. - Chat: a Model button for everyone; the sheet names the free models. - A daily allowance of free turns (100, HEIDI_FREE_TURNS_PER_DAY), three times with a pass, none with an own key; the chat says so and links /pass. - /pass added to the layout audit. Claude-Session: https://claude.ai/code/session_019MDtmteJuDGFouA1itJ5tM Co-authored-by: Claude <noreply@anthropic.com> |
||
|
|
59419a1063 |
release: places on every page, situations as guided runs, profile and Mein Bereich, modular code (#361)
* feat(profile): a learner profile, and a personal page that answers three questions One profile model as a view over the stores that already hold each answer; the setup «Dein Profil einrichten», one question per screen; the profile card on the personal page; «Wo stehe ich?» and «Nutze ich Heidi gut?»; progress kept with the account by default; reminders only when behind the learner's own weekly goal. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019MDtmvb6xi489TfZMg7n9T * docs(profile): record the new sync default and the profile; audit the setup screen Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019MDtmvb6xi489TfZMg7n9T * feat(profile): interests lead the listening One more profile question, «Was interessiert dich?»: nine choices that name the topics every row of the listening register already carries. The listening page opens with the rows that fit, each saying which choice it is there for and how much can be asked about it; «Nutze ich Heidi gut?» names one of them when the thing to do is listen. Chosen in the browser, so the page stays cached; stored as a field of the profile record. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019MDtmvb6xi489TfZMg7n9T * fix: an eight-character password floor, a localised investors door, page titles and four layout leftovers - A new password needs eight characters (sign-up, change, reset), through a plugin the account package accepts; signing in with an older, shorter password still works. The message is in all seven languages. - The investors door says «Passwort / Öffnen» in the reader's language. - A failed sign-in, the unsubscribe page and the signed-in personal page have their own titles; a test holds every page to one. - The kept sentence under a saved word is no longer hyphenated («Schlüs- / sel» at 320px). - «Warum die Übungen so gebaut sind» is a closed row with a chevron. - The account forms' primary button is black, like every other. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019MDtmvb6xi489TfZMg7n9T * refactor(sync): the merge policy is a tested function; the profile says when sync failed What one pull changes in this browser moved out of a useEffect into lib/domain/progress/merge.ts (planMerge, decodeDevices, statusAfter), with tests for every rule. The runner only fetches and writes. A failed request and a 401 used to be swallowed; the personal page went on saying progress was stored with the account. They are now reported through an in-memory status, and the sync line shows when it last got through, that it did not (with a retry), or that this browser is signed out (with the way in). One deliberate difference: a device that holds no bridge/difficulty choice no longer hides an older device's choice from a third one. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019MDtmvb6xi489TfZMg7n9T * refactor(practice): one recordAnswer, a tested and resumable test run, exercise words by context Items 2, 3, 7, 13, 16 and the practice and test screens of 12, which share files. recordAnswer (lib/domain/practice/record.ts) is the one place an answer is written into history, model, memory and the day. The sitting and the warm-up wrote it out twice with different rules and the test a third time. Decided: the first answer teaches (the sitting's rule); the day counts from the first answer, so a warm-up left half way now counts (the sitting's rule won); a test answer counts for the day only, kept on purpose and said why. The test's draw and its stored shape are lib/domain/practice/test-run.ts, tested. A run survives a reload (heidi.practice.test.v2, per course, on the privacy page), keyed by sitting, with the clock held as a deadline. practice-session.tsx 620 -> 217 and test-session.tsx 427 -> 146: state and rules to use-sitting.ts, use-test-run.ts and lib/domain/practice/sitting-run.ts (tested); LevelRow, UsedUp, the test's start and result screens, and the warm-up's result are their own files. The six dictionary slices every exercise read as props come from one provider (exercises/words.tsx); the pages build them with exerciseWords(). heidi.voice.v1 is on the privacy page, so 'delete everything on this device' removes it; privacy.test.ts now checks both directions. The warm-up and the home page's speech bubble take the variety from the pack instead of writing 'gsw', and the leak ratchet covers app/. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019MDtmvb6xi489TfZMg7n9T * revert(auth): accounts stay the package's; no password rule of Heidi's own Sign-up and sign-in behave exactly as @bitbaum/accountkit defines them. The eight-character floor added here as a local plugin is removed, with its message and note; a rule about passwords belongs in the package, for every app at once, or nowhere. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019MDtmvb6xi489TfZMg7n9T * refactor(model): one chain, a tested judgeTake, and the speaking check says why it has nothing Items 4 and 8. lib/domain/model/chain.ts: modelChain() and ownChain() replace four copies of usableChain(freeChain("HEIDI")), and hold the health tracker three routes imported from the chat's route file. A test fails on a fifth copy. lib/domain/speaking/judge.ts: the take's judgement (request reading, the bridge/target gate, the model call, the gate on the suggestion) with tests and an injectable model. api/speaking/take/route.ts 222 -> 45 lines. The route's answer now says which kind of nothing it is (opinion), and the screen reads the status too: a rate limit, a model that could not be reached and a model with nothing to add each have their own sentence, in seven languages. Before, all three printed 'Heidi has nothing to add right now'. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019MDtmvb6xi489TfZMg7n9T * feat(shell): an error screen inside the site, and loading states where they cannot change a status code Item 5. app/[locale]/error.tsx: a page that throws keeps the header, footer and chat, says so in the reader's language, and offers retry and the way home. Its five words come from the layout through a small context, so the dictionaries are not shipped to the browser. loading.tsx is NOT at app/[locale]/, on purpose. It was added and measured: a loading file starts the response before the page runs, so 9 of 22 probed addresses changed status (every unknown page 404 -> 200, /account and /portal 307 -> 200). The same screen is instead the loading state of the six routes that can only answer 200 (vocabulary, speaking, listen, profile, settings, warmup), and a test fails if a loading file is put above a page that calls notFound() or redirect(). Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019MDtmvb6xi489TfZMg7n9T * fix(a11y): the two modal sheets are real modals, and an accessibility pass over existing screens Item 6. The sitting's settings and the model connection claimed aria-modal on a plain div with no focus trap. Both are now chatkit's Sheet (a native dialog opened with showModal): focus stays inside, the page behind is inert, Escape closes, and the opener gets focus back. A test fails on aria-modal anywhere else. The pass, in code: - the model sheet's close button was labelled with a multiplication sign; it is the package's labelled 44px button now (model.close, 7 languages) - tap targets under 44px raised: the settings chip, saved words' export and clear, a take's delete, a failed chat bubble's retry, the word popover's button, the invite link's rotate - a listening question marked the right option by outline colour alone; it carries the drill's tick and cross - seven error lines appeared without role=alert (topics, rounds, recorder) Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019MDtmvb6xi489TfZMg7n9T * refactor(chat): one way to follow a conversation, and the dock in three files Items 10 and 12 (dock). chat.tsx, the dock and the group chat each scrolled a marker into view on every change of the messages. That is now chatkit's useStickToBottom behind one small hook (chat/use-follow.ts): the thread is followed until the reader scrolls up, so a token or a message from someone else no longer pulls them away from an older answer. chat/dock.tsx 577 -> 235: the panel is chat/dock-panel.tsx (242), and the two facts only a browser knows about the launcher (is it lying on a control, how tall is it) are chat/use-dock-launcher.ts. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019MDtmvb6xi489TfZMg7n9T * refactor: answer view, round list and chat workspace under 300 lines, with their logic in lib Item 12, the remaining three. chat/answer-view.tsx 421 -> 185: the glosses, the suggestions and the row of buttons are their own files; what the row holds (ownRowItems) moved to lib/domain/chat/row.ts with tests. round-list.tsx 415 -> 216: the form to open a round is round-open.tsx; what a viewer may do with a round (roundChoices) and the request a host's form becomes (newRoundBody) are lib/domain/speaking/round-view.ts with tests. chat/workspace.tsx 415 -> 263: the transport is a hook, the words handed to chatkit's ChatApp are workspace-words.ts (tested in all seven languages), and the offer to keep a browser conversation is adopt-prompt.tsx. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019MDtmvb6xi489TfZMg7n9T * refactor(http): one id pattern, one organiser check, one audio-upload guard Item 11. The UUID pattern was defined in eleven files; it is lib/http/ids.ts. organiserGroup was written out in the invite and the team route; it is in lib/domain/groups/store.ts beside groupById. The bounded read of an uploaded recording, copied between the two transcription routes, is lib/http/audio-upload.ts with tests. A test fails on a second definition of any of the three. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019MDtmvb6xi489TfZMg7n9T * chore: remove dead code and dictionary keys nothing reads Item 15. scripts/responsive-audit.mjs is superseded by scripts/audit/responsive.mjs, which package.json's audit:responsive runs; nothing referenced the old one. Exports with no reader anywhere (code, tests or scripts), found with knip and confirmed by search: draftTransport, CowLockup, useHistoryView, recordFor, Prose, countNewSince, isChannelId, isVideoId, lastChanged, moveId, forgetInterest (account deletion removes those rows in erase.ts), isObjective, stretchOf, essaysAbout. useTheme is used only in its own file and is no longer exported. 36 dictionary keys whose name appears nowhere outside the dictionaries, in all seven languages: home.{trustTitle,trustBody,trustLink,pillarsTitle, methodLink,researchLink,contributeTitle,contributeCta}, pillars, check.{failShort,noteTitle}, technology.directionLabel, privacy.updatedLabel, contribute.{needTitle,needList}, auth.{portalLead,notSignedIn}, streak.goalLabel, practice.{correctIs,buildPrompt,verifyPrompt,typeLabel, testAnswer,testDone}, essays.notTranslated, review.noneHint, organisations.momentLabel, shell.{wordsTitle,wordsDue,wordsNone,wordsOpen, courseSteady,resumeTitle,resumeProgress,resumeNone,resumeStart}. Keys read by id (privacy.flows.*, chat.learn.*Label, feedback reasons) were checked and kept. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019MDtmvb6xi489TfZMg7n9T * fix(a11y): the modal sheet gives focus back to what opened it Found in the browser: closing the model sheet with its close button left focus on <body>. The opener was read in an effect, which runs after the sheet's own effect has already moved focus into the dialog. It is read while rendering now. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019MDtmvb6xi489TfZMg7n9T * fix(shell): no focus ring round the error screen's heading It is focused by the page so a screen reader starts there; the ring drawn round it read as a text field. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019MDtmvb6xi489TfZMg7n9T * refactor(components): one folder per feature under _components The flat folder of 131 files is sorted the way chat/, exercises/, profile/, session/ and speaking/ already were: shell, shared, home, languages, dialect, dashboard, vocabulary, listening, channels, groups, rounds, sync, practice, situations, warmup, voice, byok, auth, essays. Files moved with git mv; no barrel files, as before. The stores that are storage and nothing else (practice, focus, streak, warm-up, video), the one write path for an answer and the API error wording moved to lib/browser and lib/http. Tests that scanned or named the old paths follow, and the two that read 'this folder' still read every component. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019MDtmvb6xi489TfZMg7n9T * feat(listen): «Für dich» is the first thing under the title The rows that fit a learner's interests, or the one card that asks for them, sat below the diglossia warning. They now come straight after the title and its lead; the warning, the day's picks and the whole register stay below. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019MDtmvb6xi489TfZMg7n9T * chore(i18n): drop footer.varietyName, which nothing reads Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019MDtmvb6xi489TfZMg7n9T * chore: remove four exports and three types nothing references Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019MDtmvb6xi489TfZMg7n9T * fix(listen, profile): the interest tiles stay under the finger; the sync choice is one column on a phone Found walking the release at 390px. /listen: the first tile tapped in the invite card already makes a pick, and the card turned into the list at that moment, with the tiles pushed below three rows. The card now stays a card until «Fertig», and then the list is brought to the top of the screen. Mein Bereich, signed in: the two answers to the sync notice sat side by side inside the profile card, some 130px each, and «Nur auf diesem Gerät behalten» stood four lines tall. One column below sm. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019MDtmvb6xi489TfZMg7n9T * feat(situations): the logic of a guided run through one situation A situation was a reference list, and practising it was a random draw of eight questions. This adds what a guided five-minute run needs, as pure functions with typed results and no screens. lib/domain/situations: - planRun: every heard line in pack order with one question about its meaning, then up to two lines built from their words and said aloud, then the whole exchange again. Deterministic for a seed; a stored run is rebuilt from its step ids (heidi.situation.run.v2, per course, declared on the privacy page). - situationProgress: followed x of y and new / started / followed / due, read from the learner model's line traces and the memory's due dates. A run's answers are recorded by recordAnswer; nothing else is stored. - nextSituation, orderSituations: one recommendation with its reason, and the list with the learner's own situations first. lib/situations: optional speaker, addressee, register, answers, reviewed on a line and beats on a scene, with a validator test. Read from what the packs and the reply questions already state (lines.ts); beats are written for the fourteen scenes that were deepened by ten appended lines. Fixes at the cause: - a sitting on a scene no longer takes a quarter of its questions from the neighbouring scenes, and no longer asks a word inside a line of another scene; - a wrong meaning in «Stimmt das?» is the same sentence type as the right one wherever the scene has such a line; - the speaking task list can be held to one scene. Strings for the future screens are under situationRun in all seven dictionaries. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019MDtmvb6xi489TfZMg7n9T * feat(design): every main page opens with a place, lists are rows, and a sitting ends as a moment Shared primitives in _components/shared: Scene (a full-height photograph with the page's one headline, one line and one action on it, white on a shade in both themes), RowList/RowLink (lists as rows with hairlines, no cards), SectionHeading, and Ending (one full-screen ending for practice, the warm-up, the test and a used-up scope). The type scale is three roles in globals.css: headline, subhead, kicker. Home, practice, listening, speaking, the situations list, languages, about and Mein Bereich each open with their own Swiss place, by day and by night: 16 photographs from Wikimedia Commons, author and licence read on each file's page and listed in lib/config/photos.ts (credits on the Impressum). During an exercise the question stands alone, without a box. Motion is CSS only and off under prefers-reduced-motion. Removes hero-photo.tsx and the card boxes around lists on these pages. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019MDtmvb6xi489TfZMg7n9T * feat(situations): a situation is a guided run, and every ending hands on to one A situation page was a reference list with «Üben» at the bottom. It is now the opener of a five-minute run, one thing per screen: - /situations/<id>: a photograph of the place, one sentence, lines and minutes, one button (start, or pick up at the step it was left on); the review state said once; the old list one quiet link away (./lines). - /situations/<id>/run: each heard line alone with its one question, then the German; two lines to build and to say aloud with the speaking recorder held to this scene (played back, never marked); the whole exchange again without German, by speaker and paced; the shared ending with ONE next situation and its reason. Every answer goes through the one ledger; the place is kept. - /situations: a run left half way pinned on top, the learner's own situations, then each domain, as rows with their state. The twenty-chip picker on /practice and the board of figures are this list now. - The endings of practice, the test and the warm-up offer a situation when one is the learner's next step; the home page leads a new visitor to the warm-up; «Weiter: <situation>» on the home card and the personal page. - The warm-up's pointer now holds: its own answers made the scene it points at read "started", so it was never recommended. Design: during an exercise only close, progress and the question remain (the sitting's name and choices are behind one button in the bar); kickers and actions on one line at 390px; rows instead of boxes on listening, speaking, grammar and vocabulary; on a wide screen the shade is only where the words are. Openers with a crane, a scaffold or a flat sky are replaced, and the situations open with their own places (Wikimedia Commons, credited in lib/config/photos.ts). The responsive audit walks a run through every kind of step to its ending. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019MDtmvb6xi489TfZMg7n9T * fix(photos): the care briefs open on the lake, and the night opener has no cranes The two pictures of the hospital were a dark office front behind a parked car, and they opened every care situation. No better licensed picture of the place was found, so the care scenes open on the lake by day and at dawn, both already in the register. The blue-hour picture on the home page, the practice page and the tram brief is replaced by one without building cranes (Dark Blue Zurich, kuhnmi, CC BY 2.0, read on the file's page at Wikimedia Commons). The tram brief keeps the tram's front on a phone and leaves the car beside it out. The three unused files and their entries are removed. The alt texts of the removed pictures go with the next commit, which touches the same dictionaries. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019MDtmvb6xi489TfZMg7n9T * feat(situations): a run is one part of a situation, about five minutes A run through a whole situation was twenty-two steps, seventeen of them the same «Stimmt das?». A run now takes one part: a beat where the scene has one, about eight heard lines otherwise, with up to two lines to build, one to say aloud and the replay of that part. The next run goes on with the next part, read from the ledger (no second record); once every part has been gone through, a run revisits the part with the most lines missed or due. The brief says what the next run is (heard lines, minutes, part n of m), the ending counts the part and, while a part is ahead, its one next step is that part. Progress on the list still reads across the whole situation. Questions vary: a «Stimmt das?» can be asked the other way round as three meanings of the same scene, recorded against the same item, so one shape does not come three times running where the line can be asked another way, and the claims put to the learner are wrong about as often as right. The claim is drawn as a claim, in its own labelled frame, not as the line's translation. Stored runs keep their shape; the replay's step id now names its part, so a run stored before this is planned afresh. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019MDtmvb6xi489TfZMg7n9T * fix(model): the free chain is built in one place, pass model included Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019MDtmvb6xi489TfZMg7n9T --------- Co-authored-by: Claude <noreply@anthropic.com> |
||
|
|
28e9950014 |
Pass codes, a pass that buys a stronger model, and passes for organisations (#360)
A pass changed one number nobody reaches, was sold only for Bitcoin, and was switched off. This makes a pass worth having and gives an organisation a way to get one for each of its people. - Pass codes (lib/pay/codes.ts, drizzle/0020_pass_codes.sql): the owner issues one code per person at /owner/pass-codes, each person redeems theirs on /pass. A code grants once, through paykit's extendEntitlement, and only its hash is stored. Needs no price and no OrangeCat. - /pass takes a code whether or not passes are sold for Bitcoin; a pass is a pass without a price being set (hasPass no longer depends on one). - The model a pass buys (lib/domain/model/pass-model.ts): one paid row in front of the free chain, named by HEIDI_PASS_MODELS, gated by ai-kit's spend rules. Off until configured; /pass promises it only then. - Fixed: a pass tripled the allowance only in /api/chat. Saved conversations, where a pass holder writes, counted at the open rate. - /organisations: a card for passes for a team, with a mail link. - Wording in all seven interface languages; privacy page names pass_codes; account deletion keeps a redeemed code used and unattributed. Claude-Session: https://claude.ai/code/session_019MDtmteJuDGFouA1itJ5tM Co-authored-by: Claude <noreply@anthropic.com> |
||
|
|
edf2cd32c5 |
release: informal address everywhere, engine clean-up, account limits, owner numbers (#358)
Claude-Session: https://claude.ai/code/session_019MDtmvb6xi489TfZMg7n9T Co-authored-by: Claude <noreply@anthropic.com> |
||
|
|
28d5e9f214 |
feat(pay): a time-boxed pass, paid in Bitcoin to Heidi's OrangeCat project through @bitbaum/paykit (off until configured) (#294)
* fix(privacy): never show an email address as a person's public name Sign-up asks for no name, so requireActor's `name || email` made the email the display name of nearly every account. It was stored on speaking topics, rounds, attendance and group members, and the topics board is readable signed out: GET /api/speaking/topics returned the proposer's address. - publicName(): the chosen name, else a stable '#XXXX' handle from the actor id - migration 0011 writes the same handle over stored addresses (UPDATE only) - public topic/round lists return an account id only to its owner Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019MDtmvF6Smf3iMYnGBqi12 * feat(auth): account mail in the reader's language The shared template is English only. Through accountkit's render slot, the verify / sign-in link / reset mails are written in the language of the page the link lands on (its callbackURL); locales without copy use German. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019MDtmvF6Smf3iMYnGBqi12 * fix(header): render the account control at request time in every build authEnabled is read at module load, so a build without BETTER_AUTH_SECRET prerendered every page with no sign-in control, and CI's layout audit measured a header narrower than production's. connection() + authStatus() make the header the same in every build; CI now starts with a throwaway secret so the audits see the real header. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019MDtmvF6Smf3iMYnGBqi12 * fix(ui): one primary action on the home fold; dock off phone auth forms - 'Jetzt testen' jumps to the chat, which on desktop is the column beside it: shown on phones only, leaving one primary button in the desktop fold - the floating dock launcher covered the sign-in form's buttons at 390px; hidden on phone-sized account forms only (guarded list updated) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019MDtmvF6Smf3iMYnGBqi12 * fix(security): outbound fetches, feed parsing and upload limits - channels: every feed/redirect/audio/transcript fetch goes through publicFetch (ai-kit validateFetchTarget per hop, 8 MB body ceiling); a signed-in user could previously make the box fetch internal addresses - push: subscribe only accepts real browser push service endpoints - sweep: one channel that throws is recorded as failed instead of failing the whole hourly sweep forever; entity decoder no longer throws or emits NUL - a pasted transcript never replaces the publisher's/platform's - feeds write at most 200 newest items (Postgres parameter limit) - synced progress kept for at most 10 devices per learner - transcribe routes refuse a declared oversize body before parsing it Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019MDtmvF6Smf3iMYnGBqi12 * chore(packages): chatkit 0.23, plan bindings, experience ceiling, proxy.ts - @bitbaum/chatkit ^0.23.0 (the registered release) - package-plan: bindings matched to the code (createAuthMailer in mail.ts, ChatApp in workspace.tsx); experience ceiling set at zero - the five dialect/transcript text boxes carry experience-exempt reasons: dictation would turn dialect into Standard German (HEIDI.md §6) or compete with the page's own recorder - middleware.ts -> proxy.ts (Next 16 deprecation) - drop the dead limitkit git allowBuilds entry (limitkit is on npm) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019MDtmvF6Smf3iMYnGBqi12 * docs(changelog): 2026-11-09 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019MDtmvF6Smf3iMYnGBqi12 * feat(design): adopt @bitbaum/design-tokens faces and composition grammar The type stack asked for Helvetica Neue, which only Apple ships: Windows drew Arial and Android Roboto. Inter and IBM Plex Mono are now self-hosted from the package (app/fonts.ts, generated by design-tokens-next-fonts, latin, latin-ext and cyrillic), and composition.css is loaded. Heidi keeps its own palette, as the package README asks of a product with its own brand. Also the keyframes for the sitting celebration. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019MDtmvF6Smf3iMYnGBqi12 * feat(practice): ask what the learner needs Swiss German for 'Meine Situationen': a learner picks the situations they actually face, and every practise button (Today, the dock, the welcome-back card) draws from them through a new multi-scene scope (?scenes=a,b). One choice is the ordinary scene scope; none is everything. Device-only, declared on the privacy page. The signed-in home leads with it; the warm-up invite is a quieter line under it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019MDtmvF6Smf3iMYnGBqi12 * feat(home): shorter first screen, welcome back, a finish worth reaching - home at 390px: 10,415px -> 7,270px; the personal moments stay without their paragraphs, society's moments move to /organisations - a returning signed-out learner gets their next step above the intro - the end of a sitting shows the day earned and the week filling (no score) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019MDtmvF6Smf3iMYnGBqi12 * feat(voice): server voice when the device has no German voice Read-aloud only used the browser synthesiser, so most Windows/Linux machines said 'no voice'. /api/speak reads the line with a German Gemini voice (GEMINI_API_KEY, already on the box): generateContent on gemini-2.5-flash-preview-tts, then the interactions route on gemini-3.8-flash-lite-tts; PCM wrapped as WAV; rate-limited, 600 chars, small cache. The device's own voice is still tried first, the label stays 'german', and a failed server call reads exactly as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019MDtmvF6Smf3iMYnGBqi12 * fix(chat): 'sign in to keep it' keeps it without asking twice Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019MDtmvF6Smf3iMYnGBqi12 * docs(changelog): situations, voice, home Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019MDtmvF6Smf3iMYnGBqi12 * feat(practice): choose your situations on /practice too A signed-out learner has no signed-in home, so /practice is where they say what they need Swiss German for. The tiles drop their decorative checkbox: at 390px it left 94px for «Treppenhaus» and «Вечернее беспокойство»; the fill and aria-pressed carry the state. responsive audit: 1386 renders, 0 overflow. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019MDtmvF6Smf3iMYnGBqi12 * feat(practice): instant, unmistakable feedback on every answer The right answer used to turn black whether or not it was picked, and 'wrong' had no colour, so a learner had to read the bar to know. Now: the tapped option turns green with a tick or red with a cross (pop/shake, off with reduced motion), the right one is outlined green, and the verdict is a tinted strip with a varied word of encouragement. A right answer moves on by itself after 1.3s (countdown on 'Weiter'; 'Warum?' holds it); a wrong one keeps its explanation. A short vibration on phones. '3 in Folge' when true. New correct/incorrect colour roles in light and dark. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019MDtmvF6Smf3iMYnGBqi12 * feat(practice): no two sittings alike orderSession takes a seeded random and uses it only where the order was arbitrary (the alphabetical tie-break between equally due, equally weak, equally fresh questions and kinds); every new sitting gets a fresh seed. Options, word banks and matching columns are laid out afresh each time a question is shown (present.ts), answers remapped. Same seed = same sitting, no seed = the old order; due and weak items still come first (tested). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019MDtmvF6Smf3iMYnGBqi12 * feat(practice): build the sentence, 'Stimmt das?', and a recognise-then-produce ladder - build: the Zurich words of a line the learner says (3-9 words), shuffled with one stranger from the same scene, tapped into order, marked by the app (134 items). Production that is objectively checkable. - verify: a heard line with a meaning beside it, true or not, one tap; false meanings come from the same scene (275 items). - ladderOf: until a line is recognised reliably, recognition forms come first; afterwards production forms. A tie-break after schedule and pressure, never before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019MDtmvF6Smf3iMYnGBqi12 * docs(changelog): practice rebuilt Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019MDtmvF6Smf3iMYnGBqi12 * style(practice): answer feedback in Heidi's own colours No green: it belonged to no other screen. The feedback roles now alias the palette: right is ink (the action colour, black / white in dark) with a tick; wrong is the flag red the theme reserves for errors, as an outline on the existing pale red tint rather than a red slab; the revealed answer is outlined in ink. The verdict strip is neutral grey or pale red; the end-of- sitting check and week cells are ink. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019MDtmvF6Smf3iMYnGBqi12 * feat(practice): one measure of distance from German, and a level on every exercise lib/domain/vocabulary/distance.ts classifies a Zurich word against its German as same/close (incl. a dropped -ch/-n: au, no), rule (free once one of the pack's sound correspondences is applied: Chind, chaufe), far (nöd, öppis) or trap (the pack's mistakenFor: Estrich). The vocabulary page's 'guessable' now delegates to it. levels.ts gives every generated item a level (1 like German, 2 by a rule, 3 different) on source.level, server-side: 400 / 593 / 1964 of 2957. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019MDtmvF6Smf3iMYnGBqi12 * feat(practice): skills and levels tracked; sittings move up a level as it holds - kinds/meta.ts: what each kind tests (understand, words, sounds, forms, articles, produce) and its rung, in one Record typed against the kinds; the ladder's private list of kind names is gone. - the learner model gains skills and levels axes (old records load); its axes are one MODEL_AXES list that observing, decoding and device sums read. - frontierOf: level 1 until it holds (>=12 answers, <=20% missed), then 2, then 3; stretch ranks after schedule, pressure and ladder. Skills and levels report; they do not add pressure. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019MDtmvF6Smf3iMYnGBqi12 * feat(home): 'Was sitzt' — answers by skill and by distance from German Right/missed counts per skill and per level, 'holds' on the same bar as the level frontier, and the level the learner is working at. Counts, not a score. Seven languages. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019MDtmvF6Smf3iMYnGBqi12 * feat(listening): dialect podcasts get a labelled German rendering and questions Measured 2026-11-09: no product or public model writes spoken Zurich German in dialect spelling reliably (best ~46% words right); Whisper renders it into Standard German at ~23% WER, mostly rewordings. So a dialect episode with no publisher transcript is no longer refused: the opening minutes are rendered by the existing recogniser and stored as transcript.source 'rendering', labelled on every screen as German 'sinngemäss — nicht der Dialekt, wie er klingt' (lang=de); questions are asked about content only. Nothing reads a dialect form from it (HEIDI.md updated). - channels followed by feed/app are matched to the register by name on the publisher's domain (lib/channels/spoken.ts), also at request time for channels followed before - migration 0012 re-offers episodes stored as 'none' (UPDATE only) - question prompt stays variety-neutral (leak test) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019MDtmvF6Smf3iMYnGBqi12 * fix(practice): what a walkthrough of every exercise found Played a sitting end to end in a browser at 390px and fixed what read wrong: - Self-check cloze said "which word is missing?" with nowhere to answer; it now says to answer aloud or in your head, then reveal. - A word's "Why?" was the same advice for every word. It now follows the distance classification: close to German, a named sound rule with the pack's example (ruleBehind), or a word to learn. - Match grids could be solved by shape (four "add an n" verbs) and could offer one meaning twice (Hoi/Salü = Hallo). Grids now mix closeness and hold at least two words German does not give away; tests pin both. - A checked sentence build kept tile padding, scattering the words; it is now one line with misplaced words marked. - Writing "nid" now notes the pack's house form "nöd" (preferredForms on the display projection; no component imports the full pack). - The finish recap printed the German answer as the missed dialect word; recapOf gives both sides. "1 kommen nochmals" is pluralised in 7 languages. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019MDtmvF6Smf3iMYnGBqi12 * feat(account): ask once about progress sync; finish the walkthrough fixes Signed up and used a new account on two browsers: - A new account synced nothing and said nothing; the switch lived only in settings. The signed-in home asks once (SyncOffer), either answer is kept; sync stays off until chosen. turnSyncOn/keepSyncOff are shared with the settings switch. - «Meine Situationen» joins synced progress as the `focus` key, decoded on the server like every other key, and adopted on a device only where nothing is chosen. Privacy register and sync copy say so in 7 languages. Two-device check: device two shows the situations, is not asked again. - Verification mail no longer says it "finishes" sign-up for an account that already works. The OrangeCat one-click sentence shows only where the button is (methods.signin). - Chat footer shows the model's name (modelLabel), not the route id; a German reader's gloss is not repeated; chat asks ai-kit for light reasoning so the first words come sooner. - compareWords no longer offers a typed word that matches one pack word as another's near miss. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019MDtmvF6Smf3iMYnGBqi12 * feat(mail): account mail as laid-out HTML through mail-kit 0.3.0 The verify, sign-in-link and reset mails were plain text. They now carry the fleet's one layout (@bitbaum/mail-kit renderMail): Heidi's red and cow mark, a heading, one button, the sign-in code to type on another device, a note, and a footer that says why the mail arrived. Dark mode follows the reader's client. The plain-text version is unchanged and still sent alongside. Security mail carries no unsubscribe (footer.unsubscribe: null), by design. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019MDtmvF6Smf3iMYnGBqi12 * feat(mail): an opt-in evening reminder that is quiet by construction One email when questions are due, off until the learner switches it on in the settings (offered with progress sync on, since the server reads what is due only from a syncing device). - lib/mail/reminder-policy.ts decides, and errs toward silence: opted in, verified address, not on day one, 18:00 in their own zone, at most every other day, five or more due, not if they practised today, and none after three in a row went unanswered. Pure, with tests. - The mail uses the fleet layout (@bitbaum/mail-kit renderMail): count, the streak only from two days, one real due line from the pack, one button, the reason it came, preferences and unsubscribe. Six languages; worded as a good moment, never as loss (HEIDI.md §3), with a test on loss words. - One-click unsubscribe: List-Unsubscribe + -Post headers (RFC 8058) and a footer link to a page with one button (a GET changes nothing, so a link scanner cannot unsubscribe anyone). Signed, non-expiring token. - mail_preferences (migration 0013), /api/mail/preferences, /api/mail/unsubscribe, /api/cron/reminders (hourly, CRON_SECRET). - Privacy register: the preference row and the mail vendor. - Checked end to end against local Postgres: sends once at 18:00, refuses a duplicate hour, refuses the next day, counts an unanswered one, unsubscribes from the page and from the one-click POST, rejects forged tokens. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019MDtmvF6Smf3iMYnGBqi12 * fix(account): deleting an account deletes the person; 404s lead home Found by using Heidi as its users do (64-scenario run, then deleting a test account and counting rows): - Deleting an account removed the login but left the person's synced progress, reminder setting, language, conversations, group memberships, follows, push subscriptions and certificates in the database, attached to nobody. lib/domain/account/erase.ts now removes them in one transaction after the deletion succeeded (a wrong password erases nothing). A group they made passes to its longest-standing member; their group messages stay for the others, unattributed. erase.test.ts walks the schema and fails when a table with a person column is not handled. Verified against Postgres: wrong password 400 and nothing erased; right password, every row gone. - Most unknown URLs (a typo, a removed page, /xx/…) showed Next's bare English "404" with no header and no way home, because the root layout lives under [locale]. app/global-not-found.tsx answers in the URL's or the browser's language and links home (experimental.globalNotFound). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019MDtmvF6Smf3iMYnGBqi12 * fix(settings): no reminder switch for accounts that share no address A person who signs in with Google or GitHub through the shared sign-in shares no email address with Heidi by design, so a reminder could never reach them, yet Settings offered the switch and it did nothing. It is not offered now. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019MDtmvF6Smf3iMYnGBqi12 * wip: automated passes through paykit * fix(dock): the bar never lies on a control, and the page ends clear of it The Practise / Ask Heidi pill covered Start on /practice at 390px, the password field on sign-in and the warm-up's Try it at 768px. It now checks what is under its resting place and slides away while that is a control, at every width. The footer ends one pill, its offset and the safe-area inset higher, so the last row of links is never under it. The lists the feedback widget's button sat on are marked data-fc-avoid, which the widget honours. Claude-Session: https://claude.ai/code/session_019MDtmsubNtjznXC5pMf4fD * fix(mail): send as Heidi's own domain once it is verified, and say which sender is in use Account mail carried the retired FleetCrown name in its From line. A sender cannot be renamed on faith: mail from a domain the key has not verified is refused. Heidi now asks the mail service which domains this deployment's key may send from and uses heidi.orangecat.ch, then orangecat.ch, as soon as one is verified; until then the shared sender stays. /api/health reports the From line in use and the domains the key knows. Claude-Session: https://claude.ai/code/session_019MDtmsubNtjznXC5pMf4fD * fix(legal): the Impressum names the Heidi project, privacy gives each vendor's company and country, and the offer to care homes says where it stops - Impressum: operated by the Heidi project (bitbaum), with the contact address; no person, no postal address, and no promise of one. - Privacy: each company that answers messages is listed with its legal entity and country, linked to the page that states it; no row names a company twice. - Organisations: a paragraph beside the offer says Heidi is for practising, not for the bedside, and that no personal or health details belong in it. Claude-Session: https://claude.ai/code/session_019MDtmsubNtjznXC5pMf4fD * docs(changelog): keep main's 10 November entries beside this branch's Claude-Session: https://claude.ai/code/session_019MDtmsubNtjznXC5pMf4fD * docs: the recipe for cloning Heidi into a sibling language app, and one source for the product name docs/clone-a-language-app.md: what is config, what is content and what stays in packages, in the order the steps happen. The product name was written in five places; the share card, the title template, the landing config, the manifest and the account mail now read ASSISTANT_NAME, so a clone changes it once. Claude-Session: https://claude.ai/code/session_019MDtmsubNtjznXC5pMf4fD * fix(mail): the reminder carries the same verified sender as account mail Claude-Session: https://claude.ai/code/session_019MDtmsubNtjznXC5pMf4fD * wip: privacy row for passes * wip: service test for the whole payment path * feat(pay): a time-boxed pass, paid in Bitcoin to Heidi's OrangeCat project through @bitbaum/paykit Off until a price is configured. When on: a signed-in learner gets an invoice from OrangeCat through paykit, Heidi stores which learner it was for, and the pass is granted once when OrangeCat's payment.settled webhook arrives or the open checkout page's poll sees it paid. A pass triples the chat allowance. Claude-Session: https://claude.ai/code/session_019MDtmsubNtjznXC5pMf4fD * chore: keep package-plan.json's formatting Claude-Session: https://claude.ai/code/session_019MDtmsubNtjznXC5pMf4fD --------- Co-authored-by: Claude <noreply@anthropic.com> |
||
|
|
fb10722852 |
feat(chat): the answer feedback loop — thumbs, transcript export, nightly review (#205)
* feat(chat): the answer feedback loop — thumbs, transcript export, nightly review Every answer in Heidi's chat now carries chatkit 0.14's thumbs. A thumb down asks why in one tap (the reasons in all seven site languages) and the thumb is kept in a new `chat_feedback` table through `POST /api/chat/feedback` (zod, chat-rate limited, same-origin; a saved conversation's thumb needs its owner, the browser-only draft's needs nobody). `GET /api/chat/review-export` hands the fleet's nightly reviewer the saved conversations of the last day — bearer `CHAT_REVIEW_TOKEN` compared in constant time, 401/503 as the spec says, at most 50 conversations of 30 turns, no deleted ones, the gate's verdicts as steps, the thumbs beside them, never an actor id, a name or an address — with Heidi's scope read from her own system prompt rather than typed twice. The fleet's one row under an answer (Copy · Listen · thumbs) replaces the second Speak Heidi drew on the explanation; her own Speak and its caveat stay on the dialect lines, where which voice the device has is a claim worth making. Migration 0009 via drizzle-kit; the export is tested against an in-memory Postgres with Heidi's migrations applied. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018WZnBnaLP6RhwFkLxRTKgE * test(chat): the no-database cases take DATABASE_URL away, not assume it CI runs the unit tests against a Postgres service with every migration applied, so the two "no database on this deployment" cases met a database and got the 201 and the 200 they guard against. Each now removes DATABASE_URL for its own duration and restores it; the routes read it at call time, so the 503 path is what runs. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018WZnBnaLP6RhwFkLxRTKgE --------- Co-authored-by: Claude <noreply@anthropic.com> |
||
|
|
25d45963c2 |
Heidi answers what you wrote last, Swiss German all the way through, and starting again is one tap (#146)
* fix(chat): Heidi answers the newest message, and starting again is one tap - Render the model prompt ourselves: earlier turns marked as answered context, the newest message set apart. threadkit's flat transcript made «Pire» after three «Le Bilan» turns get a fourth «Le Bilan» sentence in 4 of 6 live runs; none after. - Heidi's past turns carry the dialect line she wrote; the draft route accepts it in history. Context capped at 20 turns on every surface. - Prompt: answer only the newest message; a lone word asks about that word. - decodeAnswer keeps mode 'answer' instead of collapsing it to 'understand'. - One NewChatButton: phone toolbar above the chat, dock header icon, sidebar. - Chats fit above the phone keyboard (interactive-widget + visualViewport). - /chat gets a fresh key per request so the header's Chat link never re-renders the conversation just left; sidebar closes on Escape. Co-authored-by: Cursor <cursoragent@cursor.com> * feat(i18n): Swiss German first, and Heidi explains in it in every conversation - Language menu, footer and settings share MENU_ORDER: dialect first. - A saved conversation follows the page's locale on every message instead of the one it was created in (stored locale is the fallback). - Suggestion labels come from a closed list and render via the dictionary; tones are translated; 'bridge' is no longer printed as a label. - Prompt: every 'english' field is written in the explanation language. - forReader strips translations of dialect suggestions for readers whose locale is the taught variety. - lang on explanation text is the reader's locale, not 'en'. Co-authored-by: Cursor <cursoragent@cursor.com> * feat(i18n): a signed-in learner's language follows them to every device Picking a language in the header, footer or settings saves it to the account (new additive table `preferences`, migration 0006). Every sign-in returns through /api/account/language, which puts the saved language into the page the learner lands on. German stays the default; signed out, nothing is stored. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(chat): the phone toolbar fits 320px in every language «Nouvelle conversation» beside «Conversations» overflowed a 320px phone by 17px (layout audit, fr/chat). Both buttons now shrink to an ellipsis. Co-authored-by: Cursor <cursoragent@cursor.com> --------- Co-authored-by: Cursor <cursoragent@cursor.com> |
||
|
|
2745804212 |
feat(chat): Heidi reads screenshots on the free models (#106)
* feat(chat): Heidi reads screenshots on the free models
A person attached a screenshot on a phone and was told, in German, that
"Heidi ist gratis, und die kostenlosen Modelle können keine Bilder lesen" —
go and get an API key. That sentence was not true of free models. It was true
of a chain nobody had taught to route.
`google/gemma-4-26b-a4b-it:free` was ALREADY in the chain this app installs,
and loki probed it live on 2026-08-13 with a test image and it answered
correctly. What was actually wrong: `freeChain()` is ordered for text, so a
screenshot met four Groq links that cannot read it before reaching one that
can. ai-kit 1.11 routes on that — once, for the whole fleet — so this app gets
to delete a refusal rather than build a second vision chain the way loki did.
WHAT CHANGES FOR A VISITOR
Attach a picture with no key at all. That is the whole feature.
- /api/chat no longer answers 400 "Reading a picture needs your own model".
Pictures are still VALIDATED here and are no longer REFUSED here: whether
one can be read is the chain's question, and it can answer it itself.
- The attach button is live without a key. `canSee` is now `true` when
nothing is connected, because the free chain sees.
- A CONNECTED key still decides for itself, and this is why the check
survives rather than being deleted: a brought key REPLACES the free chain,
so someone on Groq or DeepSeek — text-only, both in our allowlist —
genuinely cannot send a picture. Telling them to attach one would be a
worse lie than the old one.
A NEW OUTCOME, NOT A NEW FAILURE
`respondInThread` gains `blind`: a picture arrived and nothing reachable can
read one. Its own status because it needs the opposite sentence to a failed
turn. "Heidi could not answer just now, try again in a moment" invites a retry
that cannot work — no model in reach has eyes and none will grow them in a
minute. ai-kit decides it BEFORE any request, so it is always free and always
certain. It reaches the reader as 415 on the stateless route, a `blind` flag
on the stored one, and its own `kind` on the stream.
415 and not 503: the client keys its sentence on the STATUS and never on a
flag in the body (see `errorFor`, and the incident that taught it). 503 would
say Heidi is unconfigured, which is false — everything except reading pictures
works.
THE COPY, IN SEVEN LANGUAGES
`connectLead`, `modelBody` and `attachNeedsKey` all asserted that free models
cannot read pictures. Rewritten in en/de/fr/it/ru/rm/gsw to say what a key
actually buys — sharper answers on a dense screenshot, and calls on the
visitor's vendor rather than ours — and `attachNeedsKey` now names the real
case: the model you connected cannot read pictures. Plus `cannotSeePicture`,
the one sentence the blind outcome needs.
The docblock in byok.ts that stated the false claim is corrected in place,
with what it cost: every visitor who attached a screenshot got a 400 telling
them to buy something Heidi could already do, for months, on the strength of a
comment nobody re-read.
NOTE ON THE LOCKFILE
package.json asks for ^1.11.0, which is merged on ai-kit's main and not yet on
npm — the publish needs a tag push, and the session that merged it was refused
one. The lockfile updates with one `pnpm install` the moment 1.11.0 is
published, and CI is red until then. Deliberately not hand-patched.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014RpRyAd15YvFmQ1c1p1Rsk
* test(chat): pin the new picture contract, not the old refusal
Two tests asserted that a picture without a brought key answers 400. That is
the behaviour this branch removes, so they failed — correctly, and on exactly
the line that needed a decision rather than a deletion.
The sentence above them read "only a brought key can see". That was never true
of free models: `google/gemma-4-26b-a4b-it:free` was already in the chain this
app installs, and loki probed it live reading an image. It was true of a chain
with no vision routing, which ai-kit 1.11 fixed for the whole fleet.
So the guard is REPLACED by a stricter pair rather than dropped:
a MALFORMED picture is still refused 400 (this was never covered)
a VALID picture is no longer refused not 400
The first half matters most. The suite pinned "refused for lacking a key" and
never once pinned "refused for being malformed" — so removing the wrong guard
without adding this would have left the validation path untested.
The second is asserted as "not 400" rather than as a specific success,
deliberately: this deployment has no key at all, so the turn lands on the
unconfigured path already pinned below. The claim is only that the PICTURE is
not what stopped it.
The file header is corrected too, because it counted the old refusal among the
guards. Refusing a picture for lacking a key was not a guard; it was a wrong
belief about free models, and a test that pins a wrong belief makes it
permanent.
`pnpm run verify` green: format, lint, typecheck, 855 tests.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014RpRyAd15YvFmQ1c1p1Rsk
---------
Co-authored-by: Claude <noreply@anthropic.com>
|
||
|
|
19853d7cc0 |
feat(chat): the explanation arrives as it is written (#67)
* feat(chat): the explanation arrives as it is written
Heidi had no streaming at all: every answer appeared at once, after a silent
wait of up to 25 seconds. ai-kit gained `completeStream` and an `ai-kit/sse`
subpath precisely so nine apps would stop hand-rolling this — four SSE readers
across the fleet, two of them dropping frames on chunk boundaries.
ONLY THE EXPLANATION STREAMS, AND THAT IS A SAFETY PROPERTY. `text` is prose
in the reader's own language and `parse.ts` is explicit that it must not face
the variety gate. Everything the gate DOES judge — the dialect line, the
suggestions — waits for `parseAnswer`, along with the invented-correspondence
strip, the gloss-against-itself drop and the degenerate-loop refusal. A learner
cannot audit dialect (§2), so a form shown before it is checked, even for a
second, is the one failure this product is built to prevent. The prose streams;
the language waits for the checker.
Which needed a new primitive. The answer is a JSON object, so raw tokens would
show `{"mode":"understand","text":"Sie f`. `extractJson` already repairs
truncated JSON and cannot help: it repairs by cutting back to the last COMPLETE
value, so a string still being written is discarded and the explanation would
appear in one jump when its closing quote arrived. `partial.ts` reads a
half-written string instead — a real scan tracking string state, not a regex,
because the one thing people paste into this product is text they did not
write, which is occasionally JSON. Its test asserts the property that matters
under streaming: EVERY prefix of a real answer is showable, never leaking a
quote, a brace or half an escape sequence.
Streaming is an observation on the same turn, not a second path. Pass `onText`
and `respondInThread` calls `completeStream` instead of `complete`; threadkit
still decides whether Heidi speaks, and every guard still runs on the whole
answer. A separate streaming-respond would have been the third copy of that
wiring, and the second one already drifted.
One route, not two. The rate limit, the input ceiling, the picture checks and
the history rebuild are identical and are the part that must not diverge; only
the reply shape differs, at the last possible moment. Nine tests assert the
guards hold through BOTH shapes — a streaming request that skipped the ceiling
would let anyone post a novel and have it forwarded a token at a time. Verified
by hand too: a 2,500-character input is refused 400 with `stream: true`.
`/api/chat` moves to relative `.ts` imports so node's runner can exercise it,
the convention `app/api/check/route.ts` already documents. The wire contract
moved to `lib/domain/chat/events.ts` rather than living in the route: the
client needs it, and a browser module importing a server module for its types
works only until somebody adds a value import beside it.
A terminal event is mandatory. A stream has already sent its headers when
something goes wrong, so it cannot report a status — every turn ends with
exactly one of answer, silent or error, and a stream that closes without one is
a failure, because silence is not a status.
Verified locally: correct SSE headers including the `no-transform` and
`x-accel-buffering: no` that stop a proxy delivering the whole answer in one
piece; the client decodes the stream and produces the specific localised
message rather than a generic failure; the blocking path still answers JSON.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* docs: the canonical doc records how streaming works, and what it refuses to stream
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
||
|
|
f34cf3f409 |
feat: Heidi on every page, an account menu, learnable reference pages, and what the field can actually do (#66)
* feat(chat): Heidi on every page, and an account menu instead of two boxes Chat is how people use this product and it existed on two surfaces out of eleven. A reader on /grammar had to notice the nav, work out which of eight links was the chat, and lose the page they were reading. Signed in it was worse: the locale root is the dashboard, so the landing page had no composer anywhere on it. The dock is the same conversation as the home fold and /chat, because all three now read one store through use-draft-chat.ts. Pages that already hold a conversation mark themselves with data-chat="surface" and globals.css hides the dock over them — CSS rather than a pathname list, because whether the locale root holds a chat depends on whether the visitor is signed in, which a route table cannot know and the rendering page always does. The header carried a gear icon beside a pill with a green dot that nothing measured. One avatar menu replaces both; what is in it comes from ACCOUNT_MENU_KEYS in routes.ts, so an entry naming a page the site does not have is a build error. Three things found on the way, each a defect nobody had reported: - Escape-to-close was written twice and the copies disagreed — one returned focus to its trigger, one dropped it to the top of the document. A third copy was in model-sheet.tsx. One implementation now, in use-dismiss.ts. - The mobile menu had aria-expanded and no dismissal at all: Escape did nothing, an outside tap did nothing, and a browser Back left it open over the new page. Found by the test that asserts every aria-expanded control uses the hook. - /api/chat carried a second copy of the turn wiring that respond.ts exists to own — including an `as unknown as` cast that ai-kit 1.x had already made unnecessary, which is the copies having drifted. The route is ~45 lines shorter and every surface now shares one turn. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * fix(chat): the dock panel sat on top of its own launcher Measured on screen at 1280px, not reasoned about: at `bottom-4` the card covered the button that opened it, so on a laptop the control that closes the dock was underneath the dock. `sm:bottom-20` clears it. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * feat(settings): a theme control, for the palette that was already written globals.css has carried a full dark palette since the cow retheme, in blocks guarded on `data-theme` — and nothing in the product ever set that attribute. The palette was unreachable: a reader whose device is light could not ask for dark, and one whose device is dark could not ask for light. Three states, not two. "System" is the default and follows the device, including when the device changes at dusk; a two-state toggle has to pick a side at first paint and is then wrong for half the readers until somebody touches it. The choice is stamped by an inline script before first paint. An effect would run after it, so a reader who chose dark would watch a white page flash to black on every navigation — worse than having no toggle. Two things that cost a debugging cycle each are pinned by tests: - `createBrowserStore` writes through JSON.stringify, so the stored value is `"dark"` WITH quotes. Comparing it to `dark` fails silently and the only symptom is the flash the script exists to prevent. The test runs the script for real against both encodings rather than grepping it for `setAttribute`. - localStorage THROWS in a private window and where site data is blocked. This runs before React, so an uncaught throw would take the page down. `suppressHydrationWarning` on <html> is the documented fix for an attribute a pre-paint script sets deliberately, and it covers that element only — a real mismatch inside the page still fails loudly. Verified in the browser: the warning was there, and is gone. Also: limitkit moves from `github:bitbaum/limitkit#v0.2.0` to `^0.2.0` on npm, same version. Under pnpm 11 a git-hosted dependency's prepare build is refused without an allowBuilds entry, so the install resolves to a package with no dist and CI fails on an import resolving to nothing. fleet/SHARED.md names heidi specifically for this. Confirmed after reinstall: node_modules/limitkit now has dist. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * fix(chat): a letter pasted into a GROUP got none of the message handling `pastedContext` tested `authorId === LEARNER_ID`, which is the id the SOLO thread stamps on the reader's turns. In a group every human carries their own OrangeCat actor id and none of them is LEARNER_ID, so the loop walked every message, matched nothing, and returned "". Pasting a landlord's letter into a study group quietly got no structure, no header parsing and no guaranteed reply offer — and looked exactly like a letter that had been handled. "Not Heidi" is the test that is true on both thread shapes. Pinned, along with the latest-turn-only rule and the two cases that must stay silent. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * fix(chat): seven defects from review, one of them mine and critical The critical one was introduced by the dismiss consolidation. `useDismiss`'s navigation effect fired on the INITIAL commit as well as on changes, and the model sheet passes `open: true` because it exists only while open — so pressing "connect your own model" opened a sheet that closed in the same tick. BYOK, and with it every picture, was unreachable. No test could catch it. The first repair was a "skip the first run" ref, and it was wrong: `reactStrictMode` is on, React invokes each effect twice in development, and the ref persists across both — the guard was spent on the first invocation and the second closed the sheet anyway. Measured in the browser, the sheet still refused to open. Comparing the stored pathname asks what the effect actually means — "have we navigated?" rather than "is this the first run?" — and is correct under both. Verified in the browser: the sheet opens, Escape closes it, and the nav panel still closes on a real navigation. The rest: - French and Italian envelopes were mis-parsed. `À :` and `A:` are one letter and the pattern demanded two, so the recipient line ended the header block: a French message lost its subject and leaked `À : … / Objet : …` into the body, and an Italian one fell below the two-header floor and was not recognised as a message at all. The earlier tests passed only because they omitted the recipient line, which no real mail client does. - The pasted body was being concatenated into the SYSTEM prompt — up to 4,000 characters written by whoever wrote to the reader, given the authority of our own rules. It is not repeated at all now: the paste is already in the conversation as the reader's own turn, in the user role, which is the privilege level it should have. The envelope fields stay, capped and fenced as data, and the model is told to report an instruction aimed at it rather than act on it. - Asking the same word twice did nothing the second time, then replayed it later: the dedupe key was the text, so the effect returned early without clearing the pending ask. It is a monotonic id now. Verified: two presses, two turns. - Navigating closed the dock and discarded an in-flight answer, because `useConversation` has no abort handling. The dock lives in the layout to outlive the page under it, and following a grammar link from an answer is a move this product encourages — so it opts out of navigation dismissal. - Signed in, Settings and Sign out moved inside a client-component menu, so a reader with JavaScript off lost the only route to their own settings. The footer carries a plain link now, for signed-in and signed-out alike. - Closing the panel on a phone dropped focus to <body>: the launcher is `display:none` there, so `.focus()` was a silent no-op. - The account menu pointed `aria-controls` at an element that does not exist while it is closed. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * feat(technology): what a computer can and cannot do with Swiss German §8 is an overclaim register — a list of things this product must not say, the largest of which is that it transcribes dialect. The strongest form of that discipline is not a promise to be careful; it is publishing what the field can actually do, with the numbers, so a reader can hold our claims against it. Five public speech corpora with hours, speakers, regions and licences; three ASR results as word error rate on one test set so they can be compared; four speech-synthesis systems; three language models. Thirteen new sources, each opened and checked against the claim it supports. The central fact needs no argument once the table is on screen: almost every Swiss German speech corpus pairs dialect SPEECH with STANDARD GERMAN text, because in a diglossic country writing down what was said is a translation task, not a transcription one. That is why Heidi's dictation produces Standard German, and the page now shows why rather than asserting it. Three things a product page would not say: the best verifiable Swiss German WER is 12.1% and those weights are unpublished; most voices sold as "Swiss German" are Swiss STANDARD German read aloud; and Apertus carries 6,000 Swiss German post-training examples while publishing no dialect evaluation at all — marked `dialect not evaluated`, which is the difference between a claim and a result. Positioned beside /method rather than inside it: /method argues how Heidi teaches and rests on acquisition research; this rests on language-technology research and argues nothing about teaching. Indexed, because someone searching for "Swiss German speech recognition" is looking for exactly this and will otherwise find a vendor selling them Swiss Standard German. The numbers live in lib/research/language-tech.ts, not the dictionaries — a figure is not translatable and seven copies of "343 hours" are seven chances for one to become 340. The English `note` on each row is maintainer copy and is NOT rendered: providers.ts already records what happens when an English source-copy field reaches a component, and the first draft of this page repeated that mistake in four tables before it was caught on screen. Every label a reader sees is localised, verified in German and French. The article-URL rule widened to admit ACL Anthology and CEUR records. That is not a loosening: this literature publishes at ACL, where the Anthology record IS the permanent identifier. An arXiv preprint still enters through a DOI and says "preprint" in its venue, so a reader is told what they are looking at. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> |
||
|
|
95d3ab3262 |
feat(chat): the chat gets a room of its own (#48)
* feat(chat): conversations that survive a reload, for people who signed in The chat has been the product wearing a marketing site: the assistant works, and then you reload and it is gone. This is the storage half — schema, rules, queries and routes — with no UI yet, so the risky part lands reviewable on its own. Not reusing the group tables. `invite_token` is NOT NULL UNIQUE and is a credential: every private chat would mint a joinable room key. And deletion runs the opposite way — a group keeps `left_at` rows precisely so old messages stay authored, while a private conversation must be destroyable. Decisions the schema states out loud: - `image_count`, never the images. Attachments would be the largest rows and the most private artefact the product touches. The count is enough for a reopened thread to say a picture was here. - `locale` on the conversation. Reopening a thread from a browser negotiated to French must not switch Heidi mid-conversation. - Delete destroys. The conversation row is tombstoned so a deleted id keeps answering a stable 404; the messages are hard-deleted in the same transaction. A `deleted_at` that leaves the words in the table is a lie the privacy section would then have to tell. - The caps refuse; they never prune. Dropping someone's oldest thread to make room is data loss dressed as a feature. `APP_TABLES` gains both tables — it is the only detector for the postgres-owns-the-table grant failure, and missing it leaves /api/health green while every write 500s. The new store suite asserts that check passes. Nothing anonymous reaches the database: no cookie-minted pseudo-actor, which would be a tracking id whose rows nobody can ever authenticate to delete. `/api/conversations/import` adopts a signed-out draft only when asked, and rebuilds every field — ids, authorship, timestamps and the decoded answer — because a draft lives in localStorage, where anyone with a dev console writes. `requireActor` moves to lib/domain/actor.ts; groups/session.ts stays as a thin delegator on purpose, because groups/routes.test.ts stubs authorisation by mocking that module at its resolved file URL. Also ends a duplication the linter caught: MAX_IMAGES existed four times — two routes, the composer, and a dead copy a refactor left behind. It now lives with the server-side validation, which is the side that enforces it. 275 tests, 31 of them new. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FzYBD3sZroCAYeRgTYrpfT * feat(chat): the chat gets a room of its own The assistant worked and then you reloaded and it was gone. `/chat` is the same conversation with space to be one: a transcript that scrolls inside the viewport, a composer that stays put, and — signed in — the thread you had yesterday in a sidebar you can resume, rename and delete. The home page box and the full-screen chat are ONE conversation, not two. Both read the same store, so "Vollbild öffnen" continues the thread and coming back to the home page finds it still going. Nothing is transferred: a transcript in a query string would land in the access log, the Referer header and browser history. Signed out still works, and nothing anonymous reaches the database. **Two bugs this found, both by reloading the page rather than by reading it:** - The persist effect ran on mount with an empty thread and CLEARED the draft it was about to restore. Visiting the home page would have wiped a conversation without touching anything. Writing now waits for the seed. - Seeding through the subscribed store value raced its own `ready` flag — two independent `useSyncExternalStore` subscriptions with nothing ordering them, so the draft could still be null on the tick `ready` flipped, seeding an empty thread and marking the job done. It reads the store directly instead. **The chrome escape is one CSS rule**, keyed on `body:has([data-chrome="chat"])`, not a second root layout. There can only be one root layout — `<html lang>` has to carry the real language of the page — and navigating between two of them costs a full document reload, so every trip from the home page into the chat would throw the app away and start again. `min-height: 0` on `main` is the load-bearing line: a flex child refuses to shrink below its content, so without it the page grows instead of the transcript scrolling. `dvh`, not `vh`, or the composer hides under iOS Safari's toolbar. **Signed-in visitors land in the chat**, decided in middleware rather than in the page. Calling `auth()` in `page.tsx` reads a cookie, which would opt the `priority: 1` marketing page into dynamic rendering for every visitor. Crawlers are always signed out, so they still get the home page — confirmed in the build output, where `/[locale]` is still SSG. The decision itself is pure and tested (`lib/i18n/landing.ts`), including the case that would have bounced `/de/chat` to itself forever. **The conversation row is created on the first message**, not when the page opens, so a "new chat" button that gets pressed and abandoned leaves nothing behind. Which row a transport writes to lives in its own closure with an in-flight promise, because React state is not visible to the second message of a fast double-send — which is how one conversation becomes two. HEIDI.md §5, §9 and §10 rewritten. §10 was four sentences of intent written when there was nothing to be private about; there is now, so it says what actually happens — where a signed-out conversation lives, that delete destroys the messages, that pictures are counted and forgotten, and that adoption is offered rather than assumed. Verified with `pnpm run verify` (290 tests) and against a production build in a browser at 1280px and 390px: reload restores, home↔chat keeps the thread, the body does not scroll, the footer is gone, the header is static. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FzYBD3sZroCAYeRgTYrpfT --------- Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> |
||
|
|
0a9c1cd43f |
fix(limits): every public endpoint ran with no rate limit (#16)
Found by being asked which shared packages Heidi actually uses. It uses
ai-kit and threadkit. It was not using limitkit, and the reason is the
one SHARED.md predicts: I did not grep the registry before building.
That was not a style miss. Three endpoints were reachable by anyone
with curl and none had a ceiling:
/api/chat spends from a free-tier AI budget shared with every
other visitor
/api/model/check makes a real outbound call with whatever key it is
handed — the one endpoint here that could be used
to test stolen credentials in bulk
/api/check pure and local, but still a way to occupy the box
limitkit ships the algorithm and the HTTP edges and deliberately NO
limit values, because how many a route allows is app semantics. So the
numbers live in lib/domain/limits.ts with the reason each one is what
it is — a limit with no stated reason is one that gets "temporarily"
raised.
chat 30 / 5 min — generous: a real conversation is a dozen
turns, and someone working through a long WhatsApp
thread must never meet this
model-check 6 / 5 min — nobody legitimately needs more than a few
attempts to paste a key correctly
dialect-check 120 / 1 min — free to run; only about not letting one
client monopolise the box
Verified against a running server: six probes pass, the seventh gets
429 with Retry-After and X-RateLimit-*, and the same address still has
its full dialect-check allowance — budgets are per endpoint, so
spending one cannot lock someone out of another.
Stated plainly in the module: this reads forwarded headers, so it is a
rate limit and not a security boundary. It exists to stop accidental
and casual abuse from spending a budget that belongs to everybody.
pnpm-workspace.yaml gains an allowBuilds entry — limitkit is a git
dependency and pnpm 11 silently installs NOTHING without it, so the
install "succeeds" and the package is simply absent.
145 tests.
Claude-Session: https://claude.ai/code/session_01FzYBD3sZroCAYeRgTYrpfT
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
||
|
|
ef54559395 |
feat(byok): bring your own model, and Heidi can read a screenshot (#14)
Reading a picture is the highest-value thing someone can hand this product — the WhatsApp message they cannot read IS the problem, and making them retype dialect they cannot spell in order to ask about it is a barrier we put there ourselves. No model in the free chain can see. Paying for everyone's vision calls would mean charging for Heidi, so the capability goes to whoever brings a key. Everything else stays free, and the reason is stated in the UI rather than implied. It is not really "attachments" — it is USE YOUR OWN MODEL. Answers get better across the board; pictures are the part you cannot get otherwise. SECURITY, WHICH IS MOST OF THIS - A fixed provider ALLOWLIST, never a base URL from the browser. The obvious design — paste your endpoint and your key — is a server-side request forgery hole with a friendly form around it: our server would post a credential to 169.254.169.254 because a visitor asked it to. Asserted by a test that tries exactly that. - Keys live in the visitor's localStorage. Not a cookie: a cookie rides along on every request to this origin whether or not they chose to make it, which is precisely what a bearer credential must not do. - The key is used for one request and dropped. Never stored, never logged, never echoed back — redact() runs before anything reaches a log line, because a vendor error can quote the request that carried the credential. - A line break in a key is refused; that is where header injection starts. Images must be inline data URLs, never a remote URL we would then go and fetch. - Their key, their quota: dailyTokens is 0, so our fair-share pool never believes it has capacity it does not own. - One link, no fallback. Falling through to our free models after their paid model failed would answer a picture with something that cannot see, and bill our budget for it. PRODUCT AND UX - The attach button is ALWAYS visible and never disabled. Without a vision model it opens the explanation — a greyed-out button with a tooltip teaches nobody why. - Nothing says "saved" without proof. Connecting makes one real, 64-token call and reports what came back, including the vendor's own words on failure: "model not found" and "insufficient credit" are the two things a person actually needs to hear. Absence of failure is not evidence of success. - Where the key goes is stated above the field, not linked from a footer. - Screenshots arrive by paste, drag, or picker, and are downscaled to 1024px IN THE BROWSER before upload. Vision models bill by tile and the person paying is the one who brought the key — sending a 4 MB phone screenshot charges them for detail no model needs to read a chat bubble. It also means the raw screenshot, which may show far more of their phone than the message, never leaves at full fidelity. - The connected model shows in the header and on every answer, so it is visible that their key is actually being used. ai-kit carries all of it: the BYOK chain is an ordinary Provider, so timeouts, the three kinds of 429 and error shapes are unchanged. Its ChatMessage.content is typed `string` while the implementation forwards image parts untouched — widening that belongs in the fleet's AI layer, and the one cast crossing the gap is named so it can be deleted in a single edit. Also fixed: two more setState-in-effect errors, both derived state pretending to be synced; and the provider notes were English source copy rendered into a German dropdown — the same leak class as before, now asserted against. 137 tests. Claude-Session: https://claude.ai/code/session_01FzYBD3sZroCAYeRgTYrpfT Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> |
||
|
|
b756931030 |
feat(chat): a conversation, not a form with a mode switch (#12)
The thing this replaces had two tabs — Verstehen / Sagen — and the
tabs were the bug. Someone arrives with a communication problem, not
with a decision about which of our tools to use. Making them classify
their own problem first is our internal structure pushed onto them,
and it is the oldest way to make software feel like software.
There is one input now. The model decides what was wanted and reports
which it decided, and a follow-up ("warum sagt man nöd?") is an
ordinary next message rather than a new query with no past. Verified:
a question about an earlier turn is answered from the transcript.
BOTH PACKAGES, EACH DOING ITS OWN JOB
threadkit owns the thread — who participates, what each may see, and
WHETHER the assistant speaks. ai-kit owns the model call — which
vendor, and what to do when one dies. Neither knows the other exists;
the seam is a `complete` callback.
That is overkill for a two-party chat and exactly right for the next
feature: a group thread with a tutor in it is the same object with a
longer participant list, not a migration. Every schema that encodes
"one human and one bot" is correct until the day a third participant
joins. threadkit also already encodes the social rule we would have
got wrong — two participants means the assistant IS the conversation
and answers every turn; three or more means it waits to be addressed.
Its default aliases are the generic role and "ai", so in a group
"heidi, was heisst das?" would have been ignored while "assistant,..."
worked. Caught by a test, fixed with ASSISTANT_NAME from config so a
Lesya deployment inherits it.
FOUND BY USING IT, NOT BY READING IT
- A 502 rendered as "not configured". The client keyed on the route's
`operator` flag, which is set for BOTH no-key (503) and call-failed
(502) — telling a visitor the product was unconfigured when a vendor
had merely blipped. Now keyed on status.
- An ENGLISH error string surfaced on a German page, because the client
rendered the server's message. Those are written once, for a log. The
client uses its own strings now.
- Retry stacked a second copy of the question under the first instead
of replacing the failed turn.
- A looping answer reached the screen: „verbi" ist ein Kurzwort für
„verbi" = „verbi". Fluent, confident, empty — and a learner cannot
tell, because not understanding is the state they are already in.
Now refused as a failed turn. Tuned quiet: a word must be 4+ chars
and repeat 5+ times, so ordinary emphasis passes.
- Suggested replies came back in Standard German, which defeats the
entire point of "schreiben wie jemand von hier".
- The reply framing addressed the reader as the sender ("Du sagst")
when they had RECEIVED the message.
- Three suggestions all labelled "neutral".
Dictation uses the browser's own recogniser: free, instant, no audio
leaves the device — and explicitly NOT a claim to transcribe dialect,
which nothing does well. Hidden where unsupported rather than present
and inert.
Also: two real React errors in the dictation hook (a ref written
during render, setState inside an effect), fixed with
useSyncExternalStore rather than suppressed. And a favicon, because a
404 on every page load is sloppy.
Chat copy in all six languages. 113 tests.
Claude-Session: https://claude.ai/code/session_01FzYBD3sZroCAYeRgTYrpfT
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
|