Repository navigation
feat(mind): ask the wallet in plain words, Explain, and proactive insights - #118
Merged
Merged
Conversation
The on-device assistant now presents itself as Prismo, KaleidoMind's assistant: friendly, concise and a little playful, in plain language, never joking about money safety and always showing the amount before spending. Tool contracts are unchanged.
A small faceted prism with dot eyes, filled with the 135° green-to-violet brand gradient. Seven moods (idle, listening, thinking, speaking, happy, concerned, sleeping) each get their own pose and motion: breathing, blinks, facet shimmer, hue drift with orbiting dots, a level-driven mouth, a sparkle burst and an amber tint. Motion runs on the UI thread as transforms and opacity over static SVG layers. Loops stop under Reduce Motion, while paused, in the background and on unmount. MindCharacterBadge is a static variant for inline and tab-bar use, with a monochrome mode that follows the tab tint. Pure helpers map chat and voice state to a mood.
The empty chat greets you with a large Prismo, and a small one sits beside assistant replies and the pending-reply row. Its mood follows real state: asleep while the assistant is off or not loaded, thinking while the model loads or reasons, speaking while the reply streams, happy after an approved payment succeeds and concerned on errors. Only the newest reply animates; older avatars are static, and loops pause while the tab is not focused.
… data Rules for English and Italian phrasings (amount, unit, contact, network, period) run first and work without a model. The on-device model only fills gaps, and its JSON is accepted through a schema validator that drops amounts and recipients the user never wrote. Cards take sats, fiat, fees and swap returns from the wallet's price, balances and quotes; questions are answered from balances and Activity.
Prismo replaces the push-to-talk orb: it listens with its facets pulsing to the live mic level, thinks while the reply is prepared and speaks while the answer plays, with a small mic or speaker chip for the tap affordance. It looks happy after an approved payment succeeds and concerned when voice or the model fails. VoiceInput gains an optional onLevel callback that enables metering only when a caller asks for it. The ring pulse behind Prismo now stays still under Reduce Motion.
The tab and the chat header show a static Prismo badge that follows the tab tint: outlined when inactive, filled when selected. The old brain mark is no longer used anywhere and is removed.
… params Send takes an amount in sats regardless of the display unit, Receive an amount, network (Advanced only) and asset, and Swap a pair and amount. Each screen still quotes and confirms on its own.
Type or dictate a request and get a card with the amount, fiat value, recipient, route and estimated fee, or a small answer for balance and spending questions. Review opens the prefilled Send, Receive or Swap screen, so their confirm steps remain the only way to spend. Fees and swap returns come from the wallet's own Send and swap quotes.
…lain words An Explain action on the activity detail sheet (the item, its fee and an RGB transfer's step), the swap failure screen and Send errors opens a small sheet with Prismo. The on-device model gets only the item's structured facts and its answer is kept only if it stays within them; otherwise, or with the model off, a built-in explanation is shown.
Dismissible cards with Prismo and one action each: RGB backup failed or never done, channel funds a recovery phrase can't restore (Advanced), little room to receive on an RGB channel, a stuck swap or unconfirmed payment, a large payment received and low mainnet fees. No model is involved. At most two show at once, fee and activity checks are rate-limited, and dismissals are kept per wallet with a cooldown per insight.
Fraction words use explicit letter classes instead of lookbehind and Unicode property escapes, which also fixes matching an accented word like "metà" at a word end. A test fails if those constructs appear in the KaleidoMind sources.
# Conflicts: # screens/AIAssistantScreen.tsx
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.
Summary
KaleidoMind moves from a separate chat into the wallet itself:
Everything runs on the phone, and money still moves only through the existing Send, Swap and Receive confirm flows.
How it works
services/mindIntents/):validateIntentdrops amounts or recipients that aren't in the user's own words.card.ts):previewSwapQuote;matchContacts, which shows a warning on zero or several matches instead of guessing.services/mindExplain.ts): the model sees only the item's structured facts (no ids or preimages). Its answer is kept only if it is 2–4 sentences and every number appears in the facts; otherwise a built-in explanation is shown.services/insights.ts,useInsights): rule-based, no model.Details
\p{…}so they cannot fail to parse on Hermes; a test guards this.Testing
tscis clean, with about 120 new tests across parsing, schema, cards, the runner, Explain, insights and the sheets.services/kaleidoPay/barkOffer.test.ts, which already fails onmainand is unrelated.Needs a device: