Compare commits

...
96 Commits
Author SHA1 Message Date
waoziandClaude Opus 5.5 9d38ed4111 Record the Moto phone check for Inner Breeze 2.1.33 on its final sources
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-13 23:52:48 -03:00
waoziandClaude Opus 5.5 9ccdf55f1e Give Android's native library room for Lumi's guides and the sync fixes
The 32-bit x86 library reached 5.03 MB in the release build, just over
its 5 MB budget, from app code that 2.1.33 adds. The budget exists to
catch megabytes of images embedded in the library; 5.5 MB still does.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-13 23:50:05 -03:00
waoziandClaude Opus 5.5 f428bd1d60 Record the Moto phone check for Inner Breeze 2.1.33 with the overlay and sync fixes
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-13 23:43:00 -03:00
waoziandClaude Opus 5.5 70ea8d02ab Open add-on links and app shortcuts above the Apps library
A practice, Habits or break settings opened from the browser add-on, or
an app opened from a shortcut, started underneath the Apps library when
it was showing, so nothing seemed to happen. They now close it and any
dialog first. The web smoke test waits for the practice screen to draw
instead of two browser frames, and 2.1.33's notes cover the sync fix.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-13 23:36:20 -03:00
waoziandClaude Opus 5.5 ad401376ef Keep newer synced habit settings and days when an older copy saves
A device saving its habit list wrote every habit and day from memory, so
an app that had been open while sync stored newer values underneath put
the older ones back, on this device and through sync on every other
device. A save now writes only what changed since the list was loaded:
settings left alone keep the synced values, unchanged days are not
rewritten, and a habit deleted elsewhere stays deleted.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-13 23:18:27 -03:00
waoziandClaude Opus 5.5 6f24fc5099 Refresh every Play listing: Lumi short description, 12 languages, new feature graphic and screenshots
The store listing now opens with "Lumi guides your day" in every language
the app speaks: Czech, Indonesian, Italian, Japanese, Korean, Russian and
Chinese are new, each with the trailer. Phone and tablet screenshots show
the current app, and the feature graphic matches the trailer. Tesseract now
gets an enlarged read of small tablet text before a screenshot check fails.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-13 23:15:01 -03:00
waoziandClaude Opus 5.5 c3f312d63d Add the vertical 36-second short of the Inner Breeze trailer
short.json cuts Lumi's intro, Tai Chi, habits, "just ask" and the end card
over sections of the trailer score, joined just before their onsets.
mix.py --short and compose.py --short render it at 1080x1920 from portrait
keyframes with the real app screens in a phone above TikTok's caption area.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-13 23:12:45 -03:00
waoziandClaude Opus 5.5 886152ddf6 Add the "A Day with Lumi" trailer sources and link the public trailer
The 65-second Inner Breeze trailer is public on YouTube and set as the
preview video of every Google Play listing language. design/promo-film
keeps its plan, Lumi's chosen voice takes, the score, storyboard keyframes
and the scripts that mix the soundtrack and compose the cut with the real
app screens.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-13 22:52:47 -03:00
waoziandClaude Opus 5.5 1881d3fdcd Release the apps rebuilt for Inner Breeze 2.1.33 with new versions
Habits, Practices, Lists, Diary and Leaderboard came out of the newer
toolkit as different packages under their old versions, so the node
refused to publish them and the new Lumi and root package with them. They
are now Habits 1.0.5, Practices 1.1.5, Lists 1.0.6, Diary 1.1.10 and
Leaderboard 1.0.2, and root package 2.1.30 brings them with Lumi 1.4.0.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-13 22:51:53 -03:00
waoziandClaude Opus 5.5 39fc01dbe6 Choose a push app from a clean list, or None to turn push off
Setting up push now opens a list with each installed push app's icon and
name and the app it uses, like other UnifiedPush apps do, and a None row
that turns push notifications off until an app is chosen again. On Google
Play builds the list shows Google's notifications, and None stops them.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-13 22:49:25 -03:00
waoziandClaude Opus 5.5 9039dabef1 Record the Moto phone check for Inner Breeze 2.1.33 with the sync fixes
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-13 22:40:00 -03:00
waoziandClaude Opus 5.5 2b072674e5 Download before sending after an update, and fill habit settings an older version dropped
A device updated from an older version could send its habits back without
the settings that version didn't keep, such as questions, a span or a
schedule, and because it sent them as new they replaced the full habits on
the account and its other devices. An updated device now downloads every
record before it sends any, then sends its changes right away in a second
exchange. While that download is applied, a habit's missing icon, days,
reminder, schedule, questions or span come from the account's record even
where the device's copy looks newer; settings it already has stay.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-13 22:34:25 -03:00
waoziandClaude Opus 5.5 2128cd310d Never drop synced fields an app version doesn't know
Each device now keeps every synced record with all its fields, as it
arrived or left. When it sends a record again, its own fields go on top of
that copy, so an older version never removes fields a newer version added,
on its own device or for the account's other devices. Clearing local sync
data or resetting sync clears these copies too.

A new check lists every field the sync reads from records. When that list
changes, STORAGE_SYNC_RECORD_FIELDS has to rise with it, so every device
downloads its records again once and gets the new fields.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-13 22:21:23 -03:00
waoziandClaude Opus 5.5 e03f548923 Add the habit sync fix to 2.1.33's notes
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-13 22:16:02 -03:00
waoziandClaude Opus 5.5 bc97010372 Download synced records again after an update that knows more of their fields
A habit set up on one device came to another as a plain checkbox: the
other device received it while on an older version, which kept only the
fields it knew, and its sync position then moved past that record, so
updating never brought the habit's questions, span or schedule. Each
device now downloads every record once when its app understands more
synced fields than the version that received them, and later field
additions only need to raise that version.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-13 22:15:51 -03:00
waoziandClaude Opus 5.5 b151dfc2cc Record the Moto phone check for Inner Breeze 2.1.33 on its final sources
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-13 22:11:04 -03:00
waoziandClaude Opus 5.5 94c7f0da20 Use the latest Kryon, with buttons that can show a detail line
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-13 22:06:12 -03:00
waoziandClaude Opus 5.5 13ea94d18d Keep the web Sun Salutation frame check from failing on slow CI runners
CI runners draw the practice canvas at only about 46 fps, so the 45 fps
floor failed whenever a runner had a few late frames. A practice that fell
to the idle rate draws at 30 fps; a 40 fps floor, matching the 25 ms median
limit, still catches that.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-13 22:06:12 -03:00
waoziandClaude Opus 5.5 aa427a6772 Ship the root package with Lumi 1.4.0 for Inner Breeze 2.1.33
The root package carries every app for offline use. With Lumi 1.4.0 inside
it needs Inner Breeze 2.1.33's host interface too, so it is now root package
2.1.30 for interface 8 and older apps are not offered a package they cannot
open. The package check now refuses a root package that declares an older
interface than any app it carries.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-13 22:06:12 -03:00
waoziandClaude Opus 5.5 2e4924726f Agree to Lumi's online terms in the diary spelling test
Spelling checks follow Lumi's online switch and terms, so the test now
checks that an offline check sends nothing, then agrees before the checks
that reach the node.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-13 21:55:14 -03:00
waoziandClaude Opus 5.5 70fd19bd06 Link the smooth frame requests into the E-List screen test
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-13 21:42:21 -03:00
waoziandClaude Opus 5.5 9c57c99591 Record the Moto phone check for Inner Breeze 2.1.33 with Lumi's settings page
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-13 21:33:29 -03:00
waoziandClaude Opus 5.5 01e0a4b341 Add Lumi's settings page, her swirl and visible progress bars to 2.1.33's notes
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-13 21:28:57 -03:00
waoziandClaude Opus 5.5 6fc41dd50f Open Lumi's settings inside Lumi, and let her swirl when tapped
The wrench in Lumi's title bar now opens Lumi's own settings page in place
of the chat instead of a Lumi tab in Settings, and one tap on its Back, or
the system Back, returns to the chat. Lumi's messages about her settings
now point to the wrench in her title bar, in every language.

Tap Lumi beside one of her messages and she swirls twice around her place,
just for fun. App packages can ask for smooth frames while they animate, so
the swirl stays fluid on phones.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-13 21:28:36 -03:00
waoziandClaude Opus 5.5 0e74f0b5e0 Fill progress bars with the theme's breathing circle color
In many themes the button color, which progress bars used to fill with,
sits so close to the track that a bar looked empty: Sun Salutation's breath
bar in the Sweet theme never seemed to fill. Progress bars now fill with the
theme's breathing circle color, which every theme sets apart.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-13 21:28:31 -03:00
waoziandClaude Opus 5.5 b66c054b3f Test that Lumi's guide keeps the full frame rate
The frame pacing link test now provides the guide's animation state, which
frame pacing reads since Lumi's guides arrived, and checks that a flying,
typing or speaking Lumi lifts an idle phone back to 60 fps.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-13 21:02:39 -03:00
waoziandClaude Opus 5.5 4e1b7dc586 Record the Moto phone check for Inner Breeze 2.1.33
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-13 21:01:03 -03:00
waoziandClaude Opus 5.5 1fabf1e49c Release Inner Breeze 2.1.33
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-13 20:56:01 -03:00
waoziandClaude Opus 5.5 6ed02bca7d Let Sun Salutation follow your breath, pose by pose
Each step shows its pose name with Breathe in or Breathe out, and every
pose lasts one breath. The old default tempo of 8 s slowing to 5 s moves
to the new breath tempo once; a tempo you chose yourself stays.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-13 20:55:33 -03:00
waoziandClaude Opus 5.5 bfbaa1bb73 Open about two seconds faster on slower Android phones
Inner Breeze now uses the Ziran toolchain that reads its app packages
through a block buffer. On a Moto e6 play the first screen appears after
about 3 s instead of 5 s, and practices still run at 57.7 fps.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-13 20:53:30 -03:00
waoziandClaude Opus 5.5 1603c58b1b Look for the Apps shortcut at the bottom of the desktop rail
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-13 20:24:33 -03:00
waoziandClaude Opus 5.5 216d56bf29 Say that Lumi's terms keep server backups about a month
Backups on the node and on the developer's machine are now deleted after
31 days.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-13 20:24:33 -03:00
waoziandClaude Opus 5.5 caad34ba05 Ask about Lumi's online terms when it opens, with a connection button
Opening Lumi now shows its online terms right away until you answer
them, once each time Inner Breeze starts: "Not now" keeps Lumi offline
until the next start or until you tap the connection button. Terms you
withdrew, or Lumi switched offline, aren't asked about again.

The title bar's Offline/Online switch is now a connection button: a
connected icon while Lumi is online, a disconnected one while it is
offline, and one tap to switch. Its label still says Online or Offline.
Without the terms agreed, a tap shows them. A wrench beside it opens
Settings > Lumi.

The icons come from the MingCute icon package, which Inner Breeze now
uses for its apps.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-13 20:24:33 -03:00
waoziandClaude Opus 5.5 58db559a7d Let Lumi answer what it understood but couldn't do itself
When a request names several matching items, none, or an app that isn't
installed, Lumi says so itself instead of passing the request to the AI.
Offline, these answers no longer turn into "I didn't understand that".
Only requests Lumi can't read go to the AI when it is online.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-13 20:24:33 -03:00
waoziandClaude Opus 5.5 fafc8bedb2 Check diary spelling and choose habit icons only when Lumi is online
Diary spelling checks and automatic habit icons now follow Lumi's online
switch and terms. Until Lumi is online under its terms, nothing is sent
for them: the diary offers no spelling corrections, and habits show their
practice's icon or their first letter. Switching Lumi offline ends a
check or icon request in flight, and habits still waiting for an icon are
asked about again once Lumi is online.

Lumi's terms now say that a spelling check sends the entry being checked
and that habits without an icon send their names and descriptions, that
the server doesn't store or log that text and counts these requests in
the same daily allowance, and that with your own AI provider these two
still go to Inner Breeze's server.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-13 20:24:33 -03:00
waoziandClaude Opus 5.5 63d556914c Show a span habit's statistics about its length first
A habit that measures start to end shows its spans' length, on target
count and chart right under its streak, and its start and end questions
no longer get time charts of their own.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-13 20:24:33 -03:00
waoziandClaude Opus 5.5 77c920e0c7 Lumi understands habits offline and asks before going online
Lumi now reads habit requests on the device, in every app language and
in English beside it: add, rename, pause, resume or delete a habit, set
its days and its reminder, count it to a target or measure it from start
to end with a good length, and give it questions with their good
answers. For example "add a habit push ups every day at 8", "jumping
rope should ask how many I did, higher is better", "my eating window is
good at most 8 hours" or "remind me to meditate at 7". Lumi always asks
before it deletes a habit, and answers with what changed in the habit
editor's words. What it can't read whole goes to the AI when online.

Lumi starts offline, and offline it sends nothing at all: no AI request,
no feedback delivery or reply check, and no Telegram messages. A switch
in Lumi's new title bar turns it online. The first time, Lumi shows its
online terms: what is sent, where it goes, what Inner Breeze's server
keeps and for how long, safety, and how to withdraw. The answer syncs to
the account's other devices and can be withdrawn in the new Settings >
Lumi, or from the terms themselves.

Settings > Lumi can also send Lumi's AI requests straight to your own
OpenAI-compatible provider, with its base URL, API key and model. The
key stays in this device's settings: it is never synced, shown again or
written to a log, and goes only into that provider's Authorization
header. The terms then name that provider, and another address asks
again.

The online model gets the same new habit tools: create, rename, pause or
resume, read, and delete, which only asks in the chat. A reminder can
now change without changing a habit's days. Secure fields paste from
their menu, so a key can be pasted on a phone.

Lumi 1.4.0 needs host interface 8, which this build provides.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-13 20:24:33 -03:00
waoziandClaude Opus 5.5 efd5fc2dcd Let Lumi guide her own chat
The first time you open Lumi, she shows where you talk with her and what
you can ask, and that a slash lists everything she can do. When the
online switch is there, a second step explains it: offline she
understands you on your device and sends nothing; online she asks an AI
model when she can't understand you herself. Both lines are typed and
spoken in every language (24 clips, 0.66 MB, within the raised budgets).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-13 20:24:33 -03:00
waoziandClaude Opus 5.5 bfae215a20 Let Lumi guide Lists, Diary, Leaderboard, Settings, Profile and Statistics
The first time you open each of these screens, Lumi flies in and shows
what it is for in two or three short steps, typed and spoken like the
other guides: switching and editing lists and adding items; the diary's
days, Today and the calendar, and its page and tools; the leaderboard's
practices and ranking; the sections of Settings, and Cue volume and
Appearance in them; your picture, account, week and pages in Profile;
and a habit's figures and charts in Statistics. Each guide waits until
its screen shows everything it explains, and shows once.

The size budgets grew by 6 MB each for Lumi's added narration (192 clips,
3.89 MB): the Linux binary to 52 MB, the app package to 48 MB, the
single-ABI APK to 47 MB, and the universal APK and bundle to 55 MB.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-13 20:24:33 -03:00
waoziandClaude Opus 5.5 d08f3efc44 Give a span habit one Good when, on its start question
A habit that measures start to end is judged by the length of its spans,
whenever they start. When it asks a time question, that question is its
start: its card holds the span's Good when, its start and end questions
no longer offer earlier or later goals, and the tracking options no
longer repeat Good when.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-13 20:24:33 -03:00
waoziandClaude Opus 5.5 57c6bc1b9a Let Lumi guide each screen: she flies, types and speaks
The first-run guides for Apps, Practice and Habits are now Lumi's. She
flies to each highlighted control and hovers beside her bubble with
gently beating wings, while her line types into the bubble and she says
it in the Leda voice, in the app's language. One tap shows the whole
line, the next goes on; Back, Next, Close, the arrow keys and Escape work
as before, and screen readers always get the whole text. Her voice
follows Cue volume and stops when the step or the screen changes.

Every guide line is rewritten in her words in all twelve languages, and
the Habits guide now explains counts, questions, spans and statistics.
While the practice guide is open, the arrow keys and swipes no longer
choose another practice under it, which started the guide over.

The size budgets grew by 4 MB for Lumi's spoken guide: 144 short voice
clips (3.6 MB) and her flight sprite.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-13 20:24:33 -03:00
waoziandClaude Opus 5.5 66e45bf882 Show Inbe's own logo in the desktop tray
The tray icon comes from the app's own icon, saved in the data folder,
so an older install's icon in the desktop theme no longer shows instead.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-13 20:24:32 -03:00
waoziandClaude Opus 5.5 e5da57ef3f Aim at the habit edit action from the open table's columns
Opening a habit's details makes the table scroll, and the scroll bar moves
the day columns 10 px left; the tap hit the edit button's edge with Noto
Sans and missed it by a pixel with CI's DejaVu Sans. Measure the columns
after opening and tap its middle.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-13 19:39:16 -03:00
waoziandClaude Opus 5.5 4e55fd44f1 Fix the storage SQL and habit table tests for 2.1.32
The storage SQL test schema gains habits' span columns and habit_changes;
the habit table test taps the edit action again if a slow runner drops it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-13 18:01:58 -03:00
waoziandClaude Opus 5.5 bfea2cca93 Give the Settings and Lumi Ziran tests the Plot package path
Statistics now draws Plot's band chart, and these tests compile modules
that reach it; CI failed with "package import plot/band_chart needs a
project".

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-13 17:22:53 -03:00
waoziandClaude Opus 5.5 1bb872d4c6 Check that a restored account queues its habit changes
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-13 17:14:23 -03:00
waoziandClaude Opus 5.5 53c9c090a8 Record the 2.1.32 phone check with the habit fixes: 57.7 fps
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-13 17:05:37 -03:00
waoziandClaude Opus 5.5 73373344b8 Show a habit entry's answers as question and value
An entry's card shows each question, muted, with its answer in bold
under it, and no longer repeats a span's start question. Entries of
habits that do not measure spans show no time.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-13 17:02:24 -03:00
waoziandClaude Opus 5.5 27287d967d Note 2.1.32's habit fixes within the Play notes limit
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-13 16:59:00 -03:00
waoziandClaude Opus 5.5 3b13f3d407 Fix habit spans and entries; judge habits against your average
- A tap on a running span's half-filled day opens it instead of ending
  it. Its end is picked there, set with Now, or cleared with the time
  picker's Clear so the span keeps running.
- Entries saved before entries existed open, edit and save again; their
  longer ids no longer fail to load.
- A habit linked to no practice no longer shows every practice's
  sessions.
- A span habit's time questions are its start and end, so the start is
  not asked twice; other habits' entries ask no time.
- Spans are good by their length, whenever they start: shorter or longer
  than your average, at least, at most or between hours and minutes.
- Number and time questions can be judged against your average; new ones
  start that way. Skip marks a day done without answers.
- Every change of a habit's settings is kept and synced, and each entry
  is judged by the goal it had then. Statistics charts shade the good
  range as it was each day, show a value's day and goal on hover or tap,
  and list the habit's changes.
- Lumi can set a span's good length and average goals.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-13 16:57:56 -03:00
waoziandClaude Opus 5.5 9f42816441 Paint the Tai Chi course with Tibetan cut-out characters
The studio now opens on the full form with a painted 2D Tibetan monk, in
the hand-painted cut-out style of Sun Salutation, and offers a second
painted character, a Tibetan woman. Both play every lesson and the full
form over the same solved body as the 3D figures.

Each character is a generated turnaround plus three part sheets (heads and
torsos in five views, limbs and hands, shoes), cut into transparent parts
by tools/cut-parts.py. src/painted/figure.js projects the solved joints
flat along the view, bends the painted arms and legs along their bones,
follows the spine with the torso, and switches head, torso, hand and shoe
drawings as each part turns.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-13 16:00:33 -03:00
waoziandClaude Opus 5.5 6fd1dbbb27 Record the 2.1.32 phone check of the shorter app update question
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-13 15:57:12 -03:00
waoziandClaude Opus 5.5 466b5614d3 Answer the Apps update question in the web music test
The music check moves between screens through Apps, which now asks once
about app updates and would take the test's next click. Its setup declines
updates like the screenshot runs do.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-13 15:54:26 -03:00
waoziandClaude Opus 5.5 54c3fce061 Say briefly that only the apps inside update themselves
Owner feedback: the Apps question had too much text. It now asks whether
Lumi, Diary and the other apps inside Inner Breeze may update themselves
from waozi.xyz, notes the store does not check them, and that Inner Breeze
itself still updates through the store. About lists only the apps inside
Inner Breeze; its restart notice for a downloaded root stays above them.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-13 15:44:11 -03:00
waoziandClaude Opus 5.5 4615f6d558 Record the 2.1.32 phone check: 57.7 fps on the Moto
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-13 15:39:34 -03:00
waoziandClaude Opus 5.5 42965e39cd Note 2.1.32's habit, app update and counter changes
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-13 15:34:41 -03:00
waoziandClaude Opus 5.5 88a81baf27 Draw circle counts and times in the accent's ink
The Ziran port dropped the circle-ink class, so the breathing count, the
meditation time and the practice window's label used the theme's text
color: white on the light accent circle in dark themes. Use circle-ink
again, now the accent's computed ink like the circle's ring and ticks.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-13 15:34:37 -03:00
waoziandClaude Opus 5.5 f45362ef1b Pin Kryon with the time picker and strong titles
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-13 15:30:23 -03:00
waoziandClaude Opus 5.5 d9b20cc05c Pick habit times with a time picker
Times in the Habits screens are picked with a time picker instead of
typed as hours and minutes. The entry dialog's time, a span's start and
end, answers to time questions, and the times of a time question's good
range in the editor each open an hour and a minute column, with Now and
Done. A span's end stays empty while it runs, and an end before its
start is still on the next day. Number goals are typed as before.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-13 15:27:21 -03:00
waoziandClaude Opus 5.5 d468bbd351 Give the Habits pages clearer cards and titles
The Habits pages take the approved redesign. Titles are strong, labels
beside their figures are muted, and related things sit together on
rounded cards.

- Habits: an open habit's history, statistics and editor buttons and its
  streak and week sit together on a tinted panel, the figures on cards
  with the habit's colour along their edge.
- A day's screen: each entry is a card with its time, its buttons, and
  each answer on its own line; a running span's End now is on its card.
  Each practice's sessions and rounds share a card of their own.
- The entry dialog starts its strong title at the left with the day
  below it, and a number answer takes the dialog's width.
- The count dialog's title and count are strong, and Done is the
  dialog's main button.
- The editor's title is strong, each question has its own card, the
  week's days spread across the row, and Delete Habit is a quieter red
  beside Save, above a line that parts them from the form.
- Statistics: the habit's name and "Statistics" stay clear of the page
  as it scrolls; figures, charts and a written question's latest answers
  sit on rounded cards, and each question's title is strong.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-13 15:24:11 -03:00
waoziandClaude Opus 5.5 02a3ed19eb Ask in Apps before app packages update themselves; ship an F-Droid APK
Packages come from waozi.xyz, not the app store, so automatic updates now
wait for an answer. Apps asks once with two equal buttons and says the store
does not check these updates; Settings > About changes the answer. The new
key replaces cells_auto_update, which was saved as on without asking.

F-Droid rebuilds Inbe and compares it with our signed APK. Release builds
now also sign the universal APK built with -PfDroidBuild (self-update off)
and publish it as inbe-VERSION-fdroid.apk for F-Droid's Binaries field.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-13 15:20:29 -03:00
waoziandClaude Opus 5.5 ae88371737 Measure spans without a good length
A habit that measures spans from start to end now only measures them: the
editor no longer has a "Good length" row under "Measure start to end",
and a span is not judged good or bad. Its statistics show the spans'
average and longest length, a bar per span and when they started and
ended, without an on-target count or a goal line. Questions keep their
good answers.

Lumi's set_habit_tracking sets check, count with a target, or span, and
her context no longer lists a span goal.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-13 14:47:20 -03:00
waoziandClaude Opus 5.5 9d985b69d1 Keep habit days as entries: spans, good ranges and Lumi setup
A habit's days now hold entries, several a day. An entry has its time,
or a span's start and end, and its answers. Tapping a day that is done
opens the day's screen, the same screen as a practice's sessions, which
lists its entries to change or delete, ends a running span, and adds
another entry. A habit with questions asks them in the entry dialog;
counting habits open the day's entries from their count dialog.

A habit can measure spans instead of counting, such as a fasting window:
a tap starts the span and the day shows half filled, the next tap ends
it. Number and time questions, yes or no questions and spans can say
what is good: at least, at most or between two values, after, before or
between two times, a yes or a no, or a good length. The habit's
statistics colour each value by its goal, count how many were on target,
draw the goal on the chart, and show spans' average and longest length
and when they started and ended.

Entries sync to the other devices as their own encrypted records, with
deletions; older versions of the app keep a habit's questions and span.
Answers from the build before entries become entries of their days.

Lumi sets a habit's tracking with set_habit_tracking (check, count to a
target, or spans with good lengths) and its questions and good answers
with set_habit_questions; a question that keeps its words keeps its
answers. Her context lists both for each habit.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-13 14:38:38 -03:00
waoziandClaude Opus 5.5 2f7802661a Let a habit day's entry open over the day's screen too
The dialog that asks a habit's questions becomes the dialog of one entry
of a day. Besides the habits screen, it opens over the day's screen of
entries and sessions, where an entry is added or changed; its law now
states both screens.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-13 14:38:16 -03:00
waoziandClaude Opus 5.5 bd08f39532 Upload Lists' lists and items as kept, not deleted
When a list or item was uploaded, the check for whether it had been
deleted ran an empty query and so always answered yes. Every list and
item reached the sync node marked deleted, and other devices dropped
them. The check now reads the record's deleted mark, so lists and items
arrive on other devices again; only deleted ones upload as deletions.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-13 14:38:11 -03:00
waoziandClaude Opus 5.5 ab99d83b7a Keep habit checks and Off/On toggles inside their space
A completed day's check is now one smooth stroke centred on its dot and
sized to it, so it stays inside the dot at any display scale instead of
a jagged mark that reached its edge. The Off/On toggles of Counter mode
and the practice settings take the room their labels need and stay
inside their cards. Opening a habit's card in the habit list scrolls the
list so the whole card shows.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-13 14:12:37 -03:00
waoziandClaude Opus 5.5 ad02c7d1cf Let habits ask questions when a day is done, with their statistics
A habit's editor now has "Ask when done": add questions, each with its
words and how it is answered, as text, a whole number, a time or yes or
no. A habit without questions works as before. With them, tapping an
open day shows the questions, and Done records the answers and marks the
day. Tapping a day that is done shows its answers to change, like a
practice's session data, with Not done to open the day again. Counting
habits show their questions under the count steps.

Each answer keeps its question's words, so earlier days read the same
after a question is reworded or removed. Questions travel with the habit
and answers with the day to every device, only inside the encrypted
records; older versions of the app keep them.

The habit's statistics add up each question over the last 30 days: the
average and earliest to latest of times, with a dot per day, bedtimes
around midnight averaging correctly; the average and total of numbers
with a bar per day; how often the answer was yes; and the latest written
answers.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-13 13:56:21 -03:00
waoziandClaude Opus 5.5 af64e57a1d Give a habit's day questions their own dialog on the Habits screen
A habit's questions for a day, and the answers of a day that is done,
open in a dialog of their own. Like the count dialog, it belongs to the
Habits screen in either tab and closes when the app leaves it; a new law
states this, and the remaining dialogs may still appear anywhere.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-13 13:56:21 -03:00
waoziandClaude Opus 5.5 3efed6e1f4 Merge a waiting sync review instead of asking
When the server sends a full snapshot that would have stopped for a
review, the app now merges it as soon as the screen is idle: each record
keeps the side that changed it last, and local records stay. Only a
snapshot that cannot be read and applied whole still opens the review.
A desktop with Patterns sessions hit this on every full snapshot.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-13 13:23:29 -03:00
waoziandClaude Opus 5.5 02c8c3793b Serve the Tai Chi studio on a port that is free here
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-13 02:11:13 -03:00
waoziandClaude Opus 5.5 baab6abf7a Ship Habits' off-day taps with the next release
Habits 1.0.5 could not be published on its own: other apps' packages
changed without new versions, and the node publishes them together.
Older apps never let a day off the schedule be tapped, so the change
only matters with the new app and goes out with it, versioned then.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-13 02:10:21 -03:00
waoziandClaude Opus 5.5 c79a92725e Animate a full Tai Chi course in a Three.js review studio
The Yang 24-form, taught in eight lessons after a Foundations module,
is written as choreography data rather than video: a 3D rig, a pose
solver with knee-over-toe leg IK, balance over the feet and planted
feet that never slide, and every movement as a demo, a slow breakdown
with cues, and a follow-along on both sides. Sage Bun and Sage Male
are the 3D figures.

design/tai-chi holds the studio, motion checks, headless review
renders and the export to docs/tai-chi-24.json. Inbe's code is not
changed; app playback is a later decision.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-13 02:08:17 -03:00
waoziandClaude Opus 5.5 7c490d8fdf Let habits repeat on a schedule that keeps their history
A habit's schedule now reads as one sentence in its editor: "Every week",
"Every 2 days", "Every month", "Every year", a formula, or no set days,
with - and + for how often. Weekly habits show the seven days as circles
lit in the habit's color; tap a day to turn it on or off. Monthly habits
pick days of the month, the last day, or a weekday such as the last
Friday; yearly habits pick a month and day. A formula plans days with
numbers such as days, weekday and nth, for example "days % 3 = 0".
"Remind me at" sends the habit's notification on its planned days, or is
Off.

A changed schedule plans the days from today on. Earlier days keep the
schedule they had and nothing recorded is removed. In the habit table
only planned days have a circle; a day off the schedule still opens, and
what was recorded on it shows faded. Schedules travel with the habit to
other devices; older versions of the app keep them and see a weekday
mask that matches where one can.

Lumi sets any of these schedules and the notification with the new
set_habit_schedule tool and reads each habit's schedule in her context.
The editor's sections are always open under plain headings, and the
icons show one row with ... for the rest. New and default habits start
without a notification instead of one at midnight. Habits 1.0.5 lets
days off the schedule be opened and counted.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-13 01:55:41 -03:00
waoziandClaude Opus 5.5 556bdd3552 Give completed habit days the same raised look as open ones
The filled day circle was flat next to the open circle's rim, inset and
highlight. It now has a darker rim, a shaded lower edge and a highlight,
and a bold check stroked like Kryon's Checkbox, placed on whole pixels
so every day's check looks the same.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-13 01:17:23 -03:00
waoziandClaude Opus 5.5 c7ed67e2dc Open no tray icon during screenshot runs
A screenshot run on a private display still reached the session bus
through XDG_RUNTIME_DIR and added an Inner Breeze icon to the user's
panel, which came back with every test run.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-13 01:08:51 -03:00
waoziandClaude Opus 5.5 f4fac28598 Select the daily target's number when it is tapped
Kryon 532c4d6c selects a numeric field's whole number when a tap focuses
it, so typing a new habit daily target replaces the old one instead of
adding digits to it; the lock moves to it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-12 21:05:48 -03:00
waoziandClaude Opus 5.5 125484d157 Let habits have a daily target above 99
The daily target in the habit editor is now a number field between the
- and + buttons: it takes digits only, opens the number keyboard on
Android, and allows targets up to 9999 instead of stopping at 99.
Requested in Lumi feedback from Inner Breeze 2.1.31.

Kryon d7454f8f adds the numeric text field mode, so the Android activity
takes the numeric flag in setTextInputState; the lock moves to it (it
also brings fbc07f54, held-key repeat).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-12 19:11:08 -03:00
waoziandClaude Opus 5.5 e2b0b260d4 Record the 2.1.32 phone check: 57.7 fps on the Moto
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-12 18:53:43 -03:00
waoziandClaude Opus 5.5 08eb898ee3 Release Inner Breeze 2.1.32
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-12 18:49:19 -03:00
waoziandClaude Opus 5.5 aa36952508 Keep the habit table's hover highlight inside the table
A habit row, an inactive habit's row and the inactive habits' header
reacted across the table's full width, so their rounded hover and press
highlight covered the table's border and met the lines between rows at
odd corners. They now react a little inside the row, and the highlight
stays clear of both.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-12 15:52:52 -03:00
waoziandClaude Opus 5.5 028b2db469 Give the fake key input in text tests the key repeat check
Text fields now ask raylib whether a held key repeated, so the tests that
stand in for raylib's keyboard answer that too. The text input test now
also checks that a held Backspace repeats and a held paste does not.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-12 15:03:44 -03:00
waoziandClaude Opus 5.5 3c43b92209 Show inactive habits as a section at the end of the habit table
Inactive habits are no longer a dropdown pinned to the bottom of the
screen: their header row ends the habit table and scrolls with it, and a
tap shows or hides their rows below it. A habit dragged onto the section
becomes inactive; an inactive one dragged up into the habits becomes
active again in that place.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-12 15:00:49 -03:00
waoziandClaude Opus 5.5 0a92b02cdf Fit the habit table to narrow screens and choose icons with GLM
On a narrow screen the habit table no longer runs past its edge: rows
show a smaller icon without the name, and when even that does not fit,
fewer past days. A habit without an icon of its own and no practice to
suggest one gets one chosen by the Waozi node's GLM service from the
habit icons, or keeps its first letter when none fits; an icon chosen in
the editor, including the letter, is never replaced.

Holding Backspace, Delete or an arrow key in a text field now repeats
like in any text editor instead of acting once.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-12 14:55:59 -03:00
waoziandClaude Opus 5.5 ef652f8179 Show habits as a table with an icon for each habit
Habits is now one table: the day names across the top, today first, and
a row for each habit with its icon, its name and a circle for each of
the last seven days. Long names end in an ellipsis. Tapping a habit
opens its history, statistics, editor, streak and this week's count
below its row; rows drag to another place or into Inactive habits.

Each habit can choose one of 36 MingCute icons in its editor; without
one it shows its linked practice's icon or the first letter of its
name. The icon is a new habits.icon column (0 after the upgrade) and
travels in the habit's sync record. The Complete today button is gone,
since the Today column does the same.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-12 13:57:18 -03:00
waoziandClaude Opus 5.5 09702e144d Make habits inactive by dragging them into an Inactive habits dropdown
The Inactive habits dropdown is always below the habit list. A card
dragged onto it becomes inactive; a habit dragged out of it into the
list becomes active again. It replaces the Deactivate button.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-12 13:17:26 -03:00
waoziandClaude Opus 5.5 f6e340b2b7 Skip package publishing until a changed package has a new version
The node rightly refuses changed bytes under the version it serves, so
every source change without a version bump turned App packages red. The
publisher now compares with the served releases first: changes without
a new version wait for the next one with a notice, unchanged packages
upload nothing, and only a new version mixed with an unversioned change
still fails.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-12 13:09:27 -03:00
waoziandClaude Opus 5.5 b6a7743aca Put Deactivate on the open habit card and scroll while dragging at the edge
Deactivate was hidden in the habit editor; it is now the open card's
fourth action beside history, statistics and editing. A dragged card
held near the list's top or bottom, or past it, scrolls the list, faster
the further it goes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-12 13:09:27 -03:00
waoziandClaude Opus 5.5 1d1eb49946 Let habit cards be dragged into another place
With a mouse a card follows a press that moves; on a touch screen a
card is lifted after a short hold, so a swipe still scrolls the list.
A card dropped on another takes that card's place.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-12 12:40:02 -03:00
waoziandClaude Opus 5.5 7a81e00d5e Show the donation reminder only after a practice finished on this device
Sessions synced from another device raised the count past the next
reminder and opened it again on the desktop, after it had already been
shown and dismissed on the phone where the practice was finished.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-12 12:40:02 -03:00
waoziandClaude Opus 5.5 e83dae0e70 Show that a practice finished in the floating window
A practice that ended while Android showed it in the floating window
kept its last picture there, such as a meditation stuck at 0:00, and
opening the window back into the app returned to the dead practice page
instead of its results. The window now says Finished above the
practice's name and its main results: rounds and best hold for Wim Hof,
the duration for meditation, the duration and cycles for patterns and
the repetitions for Sun Salutation. A meditation waiting at its end to
be extended shows the same. The results change made outside the app's
frame is now reported to the router, so the app opens on the results.

Checked on an Android 12 Pixel 3a emulator: a one-minute meditation and
a five-minute pattern finished in the floating window, showed Finished
with their results, and opened back on the results screen.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-11 22:35:02 -03:00
waoziandClaude Opus 5.5 c473e276cd Open the floating window when switching apps from Recents
During a practice, Home opened the floating window but switching to
another app through Recents or the quick switch along the gesture bar
did not. Android 12 keeps the app resumed behind Recents and moves Home
forward before opening the chosen app, so Android refused the floating
window when the app paused, even from onUserLeaveHint ("refused" is now
logged with its cause). The app now enters while still resumed, when
Recents announces itself by closing system dialogs with the reason
"recentapps". The notification shade sends no such reason and still
leaves the app in place.

Checked on an Android 12 Pixel 3a emulator: Home, Recents then another
app, gesture Recents then another app and the quick switch all open the
floating window; the notification shade does not.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-11 22:28:49 -03:00
waoziandClaude Opus 5.5 a18e6bf419 Let habits be deactivated and dragged back into the list
A habit's editor now has Deactivate beside Delete. A deactivated habit
keeps its days but leaves the habit list, today's count, reminders, the
desktop tray and Lumi. A button at the bottom of Habits shows the
deactivated habits; dragging one into the list makes it active again in
the place it is dropped.

The flag is a new habits.deactivated column (the upgrade adds it as 0)
and travels in the habit's sync record. The server does not store it
yet, so each device keeps its own choice, as with schedules and
reminders.

Requested in Inner Breeze feedback from the owner's account (2.1.29,
Pixel 3a).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-11 22:25:47 -03:00
waoziandClaude Opus 5.5 7d65025806 Record the 2.1.31 phone check: 57.7 fps on the Moto
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-11 20:12:08 -03:00
waoziandClaude Opus 5.5 1eb5fd3de2 Release Inner Breeze 2.1.31
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-11 20:09:13 -03:00
waoziandClaude Opus 5.5 ccbad38a60 Fail the phone check when the app comes back shifted
The check measured the layout shift after leaving and resuming a practice
but only warned, so 2.1.28 to 2.1.30 passed with the app shifted after the
floating window. A shift above 2 now fails the check and the release gate.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-11 20:04:47 -03:00
waoziandClaude Opus 5.5 4097ce5d79 Keep the app inside the screen after the floating window
Android's floating window gives Inbe's window a shadow that makes its
drawing surface 18 pixels larger on every side, and keeps it after the
window opens back to full screen. The app then sat under the camera and
status bar, ran into the navigation and lost its sides. The activity now
reports its window size and Kryon draws and takes touches inside the
window's part of the surface; the floating window itself still fills its
whole surface, without a border.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-11 20:04:47 -03:00
813 changed files with 45556 additions and 2095 deletions

No files matched your search

+1 -1
View File
@@ -134,7 +134,7 @@ jobs:
build/startup-quit-test/
build/lumi-ui-test/
build/lumi-history-ui-test/
build/habits-cards-ui-test/
build/habits-table-ui-test/
build/lists-ui-test/
build/sync-review-ui-test/
build/data-back-ui-test/
+13 -4
View File
@@ -122,7 +122,7 @@ jobs:
build/startup-quit-test/
build/lumi-ui-test/
build/lumi-history-ui-test/
build/habits-cards-ui-test/
build/habits-table-ui-test/
build/lists-ui-test/
build/sync-review-ui-test/
build/data-back-ui-test/
@@ -808,6 +808,14 @@ jobs:
--stacktrace
make android-copy-release-apks
make android-copy-bundle
# F-Droid rebuilds the universal APK with -PfDroidBuild and copies
# this APK's signature onto it, so the two must match byte for byte.
./droid/gradlew -p droid assembleRelease -PfDroidBuild=true \
-Pkeystore.path="$HOME/.android/inbe-release.keystore" \
-Pkeystore.alias="$KEY_ALIAS" \
-Pkeystore.password="$KEYSTORE_PASSWORD" \
--stacktrace
make android-copy-fdroid-apk
- name: Preserve Android Native Crash Symbols
uses: actions/upload-artifact@v4
@@ -826,7 +834,8 @@ jobs:
echo "Could not read APP_VERSION_STRING"
exit 1
fi
for apk in "build/android/inbe-$VERSION.apk" "build/android/inbe-$VERSION-gplay.apk"; do
for apk in "build/android/inbe-$VERSION.apk" "build/android/inbe-$VERSION-gplay.apk" \
"build/android/inbe-$VERSION-fdroid.apk"; do
if [ ! -f "$apk" ]; then
echo "Missing universal APK: $apk"
exit 1
@@ -983,12 +992,12 @@ jobs:
channels+=("--channel" "rpm-$arch=$rpm")
done
# Directly installed APKs update themselves from these channels;
# the Google Play build updates through the store.
# the Google Play and F-Droid builds update through their stores.
while IFS= read -r apk; do
abi="$(basename "$apk" .apk)"
abi="${abi#inbe-$VERSION}"
case "$abi" in
-gplay) continue ;;
-gplay|-fdroid) continue ;;
"") channels+=("--channel" "android=$apk") ;;
*) channels+=("--channel" "android$abi=$apk") ;;
esac
+34
View File
@@ -1,4 +1,38 @@
# Changelog
## [2.1.33] - 2026-10-13
### Added
- Lumi guides you through each screen.
- Lumi understands habit requests offline.
- Lumi asks before going online.
- Your own AI provider for Lumi.
- Tap Lumi and she swirls.
### Changed
- Sun Salutation follows your breath.
- Span habits: one Good when, length first in statistics.
### Fixed
- Synced habit settings and days never revert to older copies.
- Android: opens about two seconds faster.
- Desktop tray shows the current logo.
- Progress bars fill visibly in every theme.
## [2.1.32] - 2026-10-13
### Added
- Drag habits to reorder or deactivate them.
- Habits get icons, schedules, times and daily questions.
- Questions can compare with your average.
- Apps asks before downloading app updates.
### Changed
- Habits is a table of the last seven days.
### Fixed
- Android: the floating practice window opens from Recents and shows results.
- The donation reminder shows on one device only.
- Held keys repeat in text fields.
- The breathing count is readable; older habit entries edit again.
## [2.1.31] - 2026-10-11
### Fixed
- Android: after the floating practice window, the app fits the screen again instead of running under the status bar and navigation and losing its sides.
## [2.1.30] - 2026-10-11
### Fixed
- Long menus, such as the colour theme, scroll by touch and open at your choice.
+49 -6
View File
@@ -416,6 +416,7 @@ cells: $(CELL_BUNDLES) $(INBE_BUNDLE) $(INBE_FULL_BUNDLE)
.PHONY: lumi-test
lumi-test: cells
sh tests/lumi_engine_test.sh
python3 tests/lumi_habit_intent_test.py
.PHONY: lumi-ui-test
lumi-ui-test: $(TARGET)
@@ -675,7 +676,7 @@ MEDITATION_AUDIO_TRACKS := \
include mk/package-freebsd.mk
.PHONY: web-canvas web-canvas-smoke-test web-compare-test web-side-by-side-test all native kryon-host install install-user uninstall stage package-freebsd deb package-deb deb-check rpm package-rpm rpm-check snap package-snap snap-cache-clean flatpak package-flatpak podman-check validate-desktop run tui run-tui run-termi run-termi-direct run-fresh screenshot test ci dist appimage click click-verify vendor-prebuilds vendor-prebuilds-native vendor-prebuilds-web vendor-prebuilds-windows font-subsets font-bundle-check clean clean-linux clean-native clean-vendor-builds windows-setup windows-setup-check android-avd android-audio-e2e android-check-keystore android-copy-assets android-copy-debug-apks android-copy-release-apks android-copy-bundle android-smoke android-local-properties android-debug android-release android-bundle android-install android-install-release android-clean android-rebuild validate-meditation-audio package-unpackaged-assets windows-runtime-assets-check windows windows64 web web-tools-check web-smoke-test web-smoke-test-firefox web-smoke-test-librewolf site site-release-assets-check chrome-web-store chrome-web-store-test firefox-addons firefox-addons-lint firefox-addons-source-zip verify-firefox-addons sync-web-icons social-install social-login social-draft social-x-draft social-post social-x-post social-x-post-dry-run social-post-dry-run
.PHONY: web-canvas web-canvas-smoke-test web-compare-test web-side-by-side-test all native kryon-host install install-user uninstall stage package-freebsd deb package-deb deb-check rpm package-rpm rpm-check snap package-snap snap-cache-clean flatpak package-flatpak podman-check validate-desktop run tui run-tui run-termi run-termi-direct run-fresh screenshot test ci dist appimage click click-verify vendor-prebuilds vendor-prebuilds-native vendor-prebuilds-web vendor-prebuilds-windows font-subsets font-bundle-check clean clean-linux clean-native clean-vendor-builds windows-setup windows-setup-check android-avd android-audio-e2e android-check-keystore android-copy-assets android-copy-debug-apks android-copy-release-apks android-copy-fdroid-apk android-copy-bundle android-smoke android-local-properties android-debug android-release android-bundle android-install android-install-release android-clean android-rebuild validate-meditation-audio package-unpackaged-assets windows-runtime-assets-check windows windows64 web web-tools-check web-smoke-test web-smoke-test-firefox web-smoke-test-librewolf site site-release-assets-check chrome-web-store chrome-web-store-test firefox-addons firefox-addons-lint firefox-addons-source-zip verify-firefox-addons sync-web-icons social-install social-login social-draft social-x-draft social-post social-x-post social-x-post-dry-run social-post-dry-run
.PHONY: zi-check
.PHONY: clean-text-api-check package-check secret-check secret-check-history hooks-install test-tui-screenshot test-termi-screenshot test-termi-screenshot-direct
.NOTPARALLEL: all native test visual-test ci zi-check dist windows windows64 android-release android-bundle click deb package-deb rpm package-rpm snap package-snap flatpak package-flatpak
@@ -731,6 +732,12 @@ break-rules-test: $(ZI2C_BIN)
sun-salutation-test: $(ZI2C_BIN)
@sh tests/sun_salutation_zi_test.sh $(ZIRAN_BUILD_DIR)/bin
.PHONY: habits-table-layout-test
habits-table-layout-test: $(ZI2C_BIN)
@sh tests/habits_table_layout_test.sh $(ZIRAN_BUILD_DIR)/bin
test: habits-table-layout-test
.PHONY: sun-salutation-assets-test
sun-salutation-assets-test:
python3 tests/sun_salutation_assets_test.py
@@ -941,7 +948,7 @@ native-text-pixels-test: $(TARGET)
sh $(KRYON_DIR)/tests/raylib_text_pixels_test.sh
# Run every visual suite and retain a receipt even when an earlier suite fails.
VISUAL_TEST_TARGETS := practice-images-ui-test leaderboard-ui-test native-screenshot-test native-text-pixels-test native-zoom-test native-visual-test launcher-ui-test settings-sidebar-ui-test startup-quit-ui-test locale-render-ui-test lumi-ui-test lumi-history-ui-test habits-cards-ui-test lists-ui-test sync-review-ui-test data-back-ui-test
VISUAL_TEST_TARGETS := practice-images-ui-test leaderboard-ui-test native-screenshot-test native-text-pixels-test native-zoom-test native-visual-test launcher-ui-test settings-sidebar-ui-test startup-quit-ui-test locale-render-ui-test lumi-ui-test lumi-history-ui-test habits-table-ui-test habit-schedule-tool-test habit-tracking-tool-test lists-ui-test sync-review-ui-test data-back-ui-test
visual-test: $(TARGET) $(INBE_FULL_BUNDLE)
env -u DISPLAY -u WAYLAND_DISPLAY -u XAUTHORITY -u GDK_DISPLAY \
-u DBUS_SESSION_BUS_ADDRESS -u SESSION_MANAGER YUE_DESKTOP_RECOVERY=0 \
@@ -990,6 +997,7 @@ $(KRY_GEN_STAMP): Makefile ziran.lock $(ZI2C_BIN) $(ZI_SRCS) $(KRYON_ZI_MODULES)
--module-path $(KRYON_DIR)/src/backend \
--module-path $(GAME2D_DIR)/src \
--module-path qrcode=build/packages/qrcode/src \
--module-path plot=build/packages/plot/src \
--module-path $(ZIRAN_DIR)/std \
--module-path build/packages/daochi-client \
-o $(KRY_GEN_DIR) $(ZI_SRCS)
@@ -1005,6 +1013,7 @@ $(WEB_GEN_STAMP): Makefile ziran.lock $(ZI2C_BIN) $(ZI_SRCS) $(KRYON_ZI_MODULES)
--module-path $(KRYON_DIR)/src/backend \
--module-path $(GAME2D_DIR)/src \
--module-path qrcode=build/packages/qrcode/src \
--module-path plot=build/packages/plot/src \
--module-path $(ZIRAN_DIR)/std \
--module-path build/packages/daochi-client \
-o $(WEB_GEN_DIR) $(ZI_SRCS) $(KRYON_DIR)/src/backend/canvas_raster.zi $(KRYON_DIR)/src/backend/canvas_audio.zi $(KRYON_DIR)/src/backend/page_route.zi
@@ -1025,6 +1034,7 @@ $(WINDOWS_GEN_STAMP): Makefile ziran.lock $(ZI2C_BIN) $(ZI_SRCS) $(KRYON_ZI_MODU
--module-path $(KRYON_DIR)/src/backend \
--module-path $(GAME2D_DIR)/src \
--module-path qrcode=build/packages/qrcode/src \
--module-path plot=build/packages/plot/src \
--module-path $(ZIRAN_DIR)/std \
--module-path build/packages/daochi-client \
-o $(WINDOWS_GEN_DIR) $(ZI_SRCS)
@@ -1053,6 +1063,7 @@ zi-c-plan9: $(KRY_GEN_STAMP)
--module-path $(KRYON_DIR)/src/backend \
--module-path $(GAME2D_DIR)/src \
--module-path qrcode=build/packages/qrcode/src \
--module-path plot=build/packages/plot/src \
--module-path $(ZIRAN_DIR)/std \
--include-dir build/packages/kryon/include --include-dir src \
--include-dir $(KRY_GEN_DIR) --include-dir vendor-builds/sqlite \
@@ -1288,9 +1299,9 @@ embedded-image-assets-check: $(EMBEDDED_ASSETS_C)
icon-sheets-check: $(PACKAGES_MK)
python3 tests/icon_sheets_test.py $(KRYON_DIR)/src/ui/icon.zi
.PHONY: habits-cards-ui-test
habits-cards-ui-test: $(TARGET)
bash tests/habits_cards_ui_test.sh "$(abspath $(TARGET))"
.PHONY: habits-table-ui-test
habits-table-ui-test: $(TARGET)
bash tests/habits_table_ui_test.sh "$(abspath $(TARGET))"
.PHONY: lists-ui-test
lists-ui-test: $(TARGET)
@@ -1839,6 +1850,14 @@ test: style-apply-zi-test
appearance-ui-test: $(TARGET) $(INBE_FULL_BUNDLE)
sh tests/appearance_ui_test.sh $(abspath $(TARGET))
.PHONY: habit-schedule-tool-test
habit-schedule-tool-test: $(TARGET) $(INBE_FULL_BUNDLE)
sh tests/habit_schedule_tool_test.sh $(abspath $(TARGET))
.PHONY: habit-tracking-tool-test
habit-tracking-tool-test: $(TARGET) $(INBE_FULL_BUNDLE)
sh tests/habit_tracking_tool_test.sh $(abspath $(TARGET))
.PHONY: audio-settings-test
audio-settings-test: $(ZI2C_BIN)
@env -u DISPLAY -u WAYLAND_DISPLAY \
@@ -2628,6 +2647,16 @@ android-copy-release-apks: | $(ANDROID_BUILD_DIR)
fi; \
cp "$$gplay_universal" "$(ANDROID_BUILD_DIR)/$(APP_NAME)-$(APP_VERSION)-gplay.apk"
# F-Droid rebuilds this universal APK with -PfDroidBuild and copies its
# signature, so run after a signed assembleRelease -PfDroidBuild=true.
android-copy-fdroid-apk: | $(ANDROID_BUILD_DIR)
@fdroid_universal="$$(find droid/app/build/outputs/apk -path '*/release/*' -name "app-universal-release*.apk" | head -n 1)"; \
if [ -z "$$fdroid_universal" ] || [ ! -f "$$fdroid_universal" ]; then \
echo "No universal F-Droid APK was produced"; \
exit 1; \
fi; \
cp "$$fdroid_universal" "$(ANDROID_BUILD_DIR)/$(APP_NAME)-$(APP_VERSION)-fdroid.apk"
android-copy-bundle: | $(ANDROID_BUILD_DIR)
bash scripts/check-android-optimization.sh droid/app/build/outputs/bundle/gplay/app-gplay.aab
@found=0; \
@@ -2939,9 +2968,15 @@ sync-recovery-test: build-laws $(ZI2C_BIN)
test: sync-recovery-test
.PHONY: sync-record-fields-test
sync-record-fields-test:
python3 tests/sync_record_fields_test.py
test: sync-record-fields-test
# Validate before producing release packages, including direct artifact targets.
$(APPIMAGE_TARGET) $(DEB_TARGET) $(RPM_TARGET) $(SNAP_TARGET) $(FLATPAK_TARGET) $(CLICK_TARGET) $(CHROME_WEB_STORE_ZIP) $(FIREFOX_ADDONS_ZIP): | version-check
android-release android-bundle android-copy-release-apks android-copy-bundle windows-setup site: version-check
android-release android-bundle android-copy-release-apks android-copy-fdroid-apk android-copy-bundle windows-setup site: version-check
# Actual artifacts are gated too, including direct and incremental builds.
$(TARGET) $(KRYON_HOST_TARGET) $(WIN64_TARGET) $(WEB_JS_TARGET) $(WEB_CANVAS_TARGET): $(SYNC_RETRY_SOURCE) | build-laws
@@ -3143,6 +3178,14 @@ lumi-feedback-delivery-test: $(ZIRAN_BIN) $(LIBOQS_A) | build-laws
test: lumi-feedback-delivery-test
# Offline and before the agreement Lumi sends nothing; an own provider gets
# its key only in its Authorization header.
.PHONY: lumi-connection-test
lumi-connection-test: $(ZIRAN_BIN) $(LIBOQS_A) | build-laws
@sh tests/lumi_connection_test.sh $(ZIRAN_BIN) $(LIBOQS_A)
test: lumi-connection-test
.PHONY: diary-spelling-test diary-history-test
diary-spelling-test: $(ZIRAN_BIN) $(LIBOQS_A) | build-laws
@sh tests/diary_spelling_test.sh $(ZIRAN_BIN) $(LIBOQS_A)
+9 -2
View File
@@ -141,8 +141,15 @@ approved public or unlisted YouTube upload with embedding enabled before it can
be added to the listing. Pass `--video-url https://www.youtube.com/watch?v=VIDEO_ID`
to the listing uploader, or configure `PLAY_VIDEO_URL`. To update only the
video, use `PLAY_COMMIT=1 python3 scripts/upload-play-screenshots.py --video-only --video-url URL`.
The approved [Lumi preview](https://www.youtube.com/watch?v=XESpbMRaz4o) is
available on YouTube and configured in the English Google Play listing.
The [Inner Breeze trailer](https://www.youtube.com/watch?v=GTly6Fu5zPk),
"A Day with Lumi", is public on YouTube and configured in every Google Play
listing language.
`design/promo-film/` holds the trailer's sources: `film.json` (clips, voice
times, app-screen inserts), `narrate.py` (Lumi's voice), `score.py` (music),
`mix.py`, `keyframes.py` and `compose.py`, which renders the cut with the real
app screens into `build/promo-video/`. `mix.py --short` and
`compose.py --short` render the 36-second vertical short from `short.json`,
the portrait keyframes in `keyframes-vertical/` and sections of the same score.
Screenshot publishing still requires the complete current
capture, visual review, export and locked build preflight.
+4
View File
@@ -1,5 +1,9 @@
# Changelog
## [1.1.10] - 2026-10-13
- Maintenance release for Inner Breeze 2.1.33.
## [1.1.9] - 2026-10-11
### Changed
+5
View File
@@ -1,5 +1,10 @@
# Changelog
## [1.0.5] - 2026-10-13
- Maintenance release for Inner Breeze 2.1.33.
- Requires Inner Breeze 2.1.28 or later.
## [1.0.4] - 2026-10-10
- Requires Inner Breeze 2.1.28 or later.
+10 -2
View File
@@ -31,14 +31,22 @@ HabitsApply :: (message: HabitsMessage) -> HabitsMessage {
return message
}
if message.action == HABITS_DAY_ACTION {
if message.modal_active || message.index < 0 || message.index >= message.count ||
(!message.scheduled && !message.completed) {
// Days off the habit's schedule open and count like planned days.
if message.modal_active || message.index < 0 || message.index >= message.count {
return message
}
if message.counter_enabled != 0 {
message.day_action = ifx message.decrement then HABITS_DAY_DECREMENT else HABITS_DAY_COUNT
} else if message.linked_count > 0 {
message.day_action = HABITS_DAY_LINKED
} else if message.span {
// A tap starts the habit's span, the next ends it; a day with
// spans opens their data.
message.day_action = HABITS_DAY_SPAN
} else if message.question_count > 0 {
// The day opens its questions, or the data of a done day,
// instead of being marked or cleared.
message.day_action = HABITS_DAY_QUESTIONS
} else {
message.day_action = HABITS_DAY_TOGGLE
}
+5
View File
@@ -1,5 +1,10 @@
# Changelog
## [2.1.30] - 2026-10-13
- Bring Lumi 1.4.0, Habits 1.0.5, Practices 1.1.5, Lists 1.0.6, Diary 1.1.10 and Leaderboard 1.0.2.
- Requires Inner Breeze 2.1.33 or later.
## [2.1.29] - 2026-10-11
- Bring Lumi 1.3.9, Diary 1.1.9, Lists 1.0.5 and Leaderboard 1.0.1.
+4
View File
@@ -1,5 +1,9 @@
# Changelog
## [1.0.2] - 2026-10-13
- Maintenance release for Inner Breeze 2.1.33.
## [1.0.1] - 2026-10-11
- Scrollbars use your theme's colours and show how much of the list is in view.
+4
View File
@@ -1,5 +1,9 @@
# Changelog
## [1.0.6] - 2026-10-13
- Maintenance release for Inner Breeze 2.1.33.
## [1.0.5] - 2026-10-11
- Scrollbars use your theme's colours and show how much of the list is in view.
+12
View File
@@ -1,5 +1,17 @@
# Changelog
## [1.4.0] - 2026-10-13
### Added
- Lumi understands habit requests on your device, in every app language: add, rename, pause, resume or delete a habit, set its days and reminder, count it or measure it from start to end, and give it questions with what a good answer is. For example “add a habit push ups every day at 8”, “jumping rope should ask how many I did, higher is better” or “my eating window is good at most 8 hours”. Lumi asks before it deletes a habit.
- A title bar with a connection button that switches Lumi between offline and online, and a wrench that opens Lumi's settings; Back returns to the chat. Lumi starts offline and goes online only after you agree to its online terms, which say what is sent, where it goes and what is kept. Until you answer, Lumi shows them when you open it, once each time Inner Breeze starts.
- Lumi's settings: read or withdraw the online terms, and use your own OpenAI-compatible AI provider with its address, key and model instead of Inner Breeze's server.
- Tap Lumi beside her message and she swirls around, just for fun.
### Changed
- Offline, Lumi sends nothing: no AI requests, no feedback delivery and no Telegram messages until you switch it online.
- Lumi answers a request it understood but couldn't carry out itself, such as a name that matches several items, instead of asking the AI.
- Diary spelling checks and automatic habit icons follow the same switch and terms. Until then the diary offers no spelling corrections, and habits show their practice's icon or their first letter.
- Requires Inner Breeze 2.1.33 or later.
## [1.3.9] - 2026-10-11
### Fixed
- Scrolling the command list keeps the keyboard open.
+9
View File
@@ -123,6 +123,12 @@ LumiProgressIntent :: (input: string, commands: LumiCommands) -> LumiAction {
}
LumiIntent :: (input: string, commands: LumiCommands) -> LumiAction {
return LumiIntentWith(input, commands, true)
}
// Without shorthand, "add" and "done" alone are left for habit requests
// such as "add a habit ...", which Lumi reads before them.
LumiIntentWith :: (input: string, commands: LumiCommands, shorthand: bool) -> LumiAction {
input = LumiTrim(input)
progress := LumiProgressIntent(input, commands)
if progress.kind != 0 {
@@ -254,6 +260,9 @@ LumiIntent :: (input: string, commands: LumiCommands) -> LumiAction {
}
}
// Common English shorthand remains available beside translated commands.
if !shorthand {
return LumiAction.{}
}
add := LumiArgument(input, "add")
if add.count > 0 {
return LumiAction.{.kind = LUMI_ADD_TODO, .title = add}
+286
View File
@@ -0,0 +1,286 @@
// What Lumi says after a habit request it understood on the device, and
// the small readers lumi.zi uses to run it through the host's app tools,
// the same validated tools the online model calls. Nothing here calls the
// host, so the phrase tests run it as it is.
#import "vec"
#import "text"
#import "json_scan"
#import "byte_text_linux"
#import, file "habit_intent.zi";
#import, file "habit_patterns.zi";
#import, file "../../src/cells/lumi_types.zi";
LUMI_HABITS_MAX :: 48
// The translated words of Lumi's habit answers. Most are the habit
// editor's own, so Lumi and Habits describe a change alike.
LumiReplyWords :: struct {
created: string
renamed: string
paused: string
resumed: string
question_added: string
question_removed: string
every_day: string
every_n_days: string
days: [7]string
reminder: string
no_reminder: string
check: string
count: string
span: string
yes: string
no: string
longer: string
shorter: string
later_than_average: string
above_average: string
earlier_than_average: string
below_average: string
after: string
at_least: string
before: string
at_most: string
between: string
and_word: string
}
LumiToolOk :: (result: string) -> bool {
at := FieldAt(result, 0, "ok")
return at >= 0 && MatchLiteral(result, at, "true")
}
LumiToolText :: (result: string, name: string) -> string {
bytes: [256]u8
count := ReadStringText(result, FieldAt(result, 0, name), bytes[:])
if count <= 0 || count >= 256 {
return ""
}
return LumiOwned(TextFromBytes(bytes[:count]))
}
// Fills %s and %d in a translated template, in order.
LumiFill :: (template: string, values: []string) -> string {
out: Vec(u8)
used: s32 = 0
at: s64 = 0
while at < template.count {
if template[at] == cast(u8)37 && at + 1 < template.count &&
(template[at + 1] == cast(u8)115 || template[at + 1] == cast(u8)100) &&
used < cast(s32)values.count {
BuilderPrint(*out, "%", values[used])
used += 1
at += 2
continue
}
unused VecPush(out, template[at])
at += 1
}
return BuilderFinish(out)
}
LumiNumberText :: (value: s32) -> string {
out: Vec(u8)
BuilderPrint(*out, "%", value)
return BuilderFinish(out)
}
// A time of day as habits show it: 07:00.
LumiDayTimeText :: (minutes: s32) -> string {
out: Vec(u8)
hour := minutes / 60
minute := minutes % 60
BuilderPrint(*out, "%", ifx hour < 10 then "0" else "")
BuilderPrint(*out, "%:", hour)
BuilderPrint(*out, "%", ifx minute < 10 then "0" else "")
BuilderPrint(*out, "%", minute)
return BuilderFinish(out)
}
LumiGoalValue :: (plan: LumiHabitPlan, value: s32) -> string {
if plan.unit == LUMI_UNIT_NUMBER {
return LumiNumberText(value)
}
if plan.unit == LUMI_UNIT_LENGTH {
return LumiClockText(value)
}
return LumiDayTimeText(value)
}
// A goal in the words the habit editor uses: "At most 8:00", "Before
// 07:00", "Above my average".
LumiGoalText :: (words: LumiReplyWords, plan: LumiHabitPlan) -> string {
time := plan.unit == LUMI_UNIT_TIME || (plan.unit == LUMI_UNIT_ANY && plan.answer == LUMI_ANSWER_TIME)
if plan.goal == LUMI_GOAL_YES { return words.yes }
if plan.goal == LUMI_GOAL_NO { return words.no }
if plan.unit == LUMI_UNIT_LENGTH && plan.goal == LUMI_GOAL_ABOVE {
return words.longer
}
if plan.unit == LUMI_UNIT_LENGTH && plan.goal == LUMI_GOAL_BELOW {
return words.shorter
}
if plan.goal == LUMI_GOAL_ABOVE {
return ifx time then words.later_than_average else words.above_average
}
if plan.goal == LUMI_GOAL_BELOW {
return ifx time then words.earlier_than_average else words.below_average
}
out: Vec(u8)
if plan.goal == LUMI_GOAL_AT_LEAST {
BuilderPrint(*out, "% ", ifx time then words.after else words.at_least)
BuilderPrint(*out, "%", LumiGoalValue(plan, plan.low))
} else if plan.goal == LUMI_GOAL_AT_MOST {
BuilderPrint(*out, "% ", ifx time then words.before else words.at_most)
BuilderPrint(*out, "%", LumiGoalValue(plan, plan.high))
} else {
BuilderPrint(*out, "% ", words.between)
BuilderPrint(*out, "% ", LumiGoalValue(plan, plan.low))
BuilderPrint(*out, "% ", words.and_word)
BuilderPrint(*out, "%", LumiGoalValue(plan, plan.high))
}
return BuilderFinish(out)
}
LumiScheduleText :: (words: LumiReplyWords, plan: LumiHabitPlan) -> string {
if plan.repeat == LUMI_REPEAT_DAILY || (plan.repeat == LUMI_REPEAT_DAYS && plan.weekdays == 127) {
return words.every_day
}
if plan.repeat == LUMI_REPEAT_EVERY {
values: [1]string = .[LumiNumberText(plan.every)]
return LumiFill(words.every_n_days, values[:])
}
out: Vec(u8)
first := true
for day: cast(s32)0..cast(s32)6 {
if (plan.weekdays & (1 << day)) != 0 {
BuilderPrint(*out, "%", ifx first then "" else ", ")
BuilderPrint(*out, "%", words.days[day])
first = false
}
}
return BuilderFinish(out)
}
// What Lumi says it did: the habit's name in bold, then one line per change.
LumiHabitReply :: (words: LumiReplyWords, plan: LumiHabitPlan, title: string) -> string {
out: Vec(u8)
BuilderPrint(*out, "**%**", title)
if plan.kind == LUMI_HABIT_CREATE {
BuilderPrint(*out, "\n%", words.created)
}
if plan.kind == LUMI_HABIT_RENAME {
values: [2]string = .[title, plan.name]
BuilderPrint(*out, "\n%", LumiFill(words.renamed, values[:]))
}
if plan.kind == LUMI_HABIT_PAUSE {
BuilderPrint(*out, "\n%", words.paused)
}
if plan.kind == LUMI_HABIT_RESUME {
BuilderPrint(*out, "\n%", words.resumed)
}
if plan.kind == LUMI_HABIT_ASK || plan.kind == LUMI_HABIT_UNASK {
values: [1]string = .[plan.question]
template := ifx plan.kind == LUMI_HABIT_ASK then words.question_added else words.question_removed
BuilderPrint(*out, "\n%", LumiFill(template, values[:]))
if plan.kind == LUMI_HABIT_ASK && plan.goal != 0 {
BuilderPrint(*out, "\n%", LumiGoalText(words, plan))
}
return BuilderFinish(out)
}
if plan.repeat != 0 {
BuilderPrint(*out, "\n%", LumiScheduleText(words, plan))
}
if plan.reminder == 1 {
values: [1]string = .[LumiDayTimeText((plan.hour - 1) * 60)]
BuilderPrint(*out, "\n%", LumiFill(words.reminder, values[:]))
} else if plan.reminder == 2 {
BuilderPrint(*out, "\n%", words.no_reminder)
}
if plan.mode == LUMI_MODE_CHECK {
BuilderPrint(*out, "\n%", words.check)
} else if plan.mode == LUMI_MODE_COUNT {
values: [1]string = .[LumiNumberText(plan.target)]
BuilderPrint(*out, "\n%", LumiFill(words.count, values[:]))
} else if plan.mode == LUMI_MODE_SPAN {
BuilderPrint(*out, "\n%", words.span)
if plan.goal != 0 {
BuilderPrint(*out, ": %", LumiGoalText(words, plan))
}
}
return BuilderFinish(out)
}
// Adds the paused habits a read_context result lists.
LumiPausedHabits :: (context: string, habits: []LumiHabitRef, count: s32) -> s32 {
list := FieldAt(context, 0, "paused_habits")
total := ArrayCount(context, list)
for index: cast(s32)0..total - 1 {
if count >= cast(s32)habits.count {
break
}
at := ElementAt(context, list, index)
id_bytes: [64]u8
title_bytes: [64]u8
id_count := ReadStringText(context, FieldAt(context, at, "id"), id_bytes[:])
title_count := ReadStringText(context, FieldAt(context, at, "title"), title_bytes[:])
if id_count <= 0 || id_count >= 64 || title_count <= 0 || title_count >= 64 {
continue
}
habits[count] = LumiHabitRef.{.id = LumiOwned(TextFromBytes(id_bytes[:id_count])),
.title = LumiOwned(TextFromBytes(title_bytes[:title_count])), .paused = true}
count += 1
}
return count
}
LumiIdArguments :: (id: string) -> string {
out: Vec(u8)
BuilderPrint(*out, "{\"id\":")
LumiJsonText(*out, id)
BuilderPrint(*out, "}")
return BuilderFinish(out)
}
// The questions a read_habit result lists, as JSON, or "".
LumiQuestionsOf :: (result: string) -> string {
at := FieldAt(result, 0, "questions")
end := ValueEnd(result, at, 0)
if !LumiToolOk(result) || at < 0 || end < 0 {
return ""
}
return LumiOwned(result[at:end])
}
LumiReplaceNew :: (arguments: string, id: string) -> string {
marker := "\"$new\""
out: Vec(u8)
at: s64 = 0
while at < arguments.count {
if at + marker.count <= arguments.count && arguments[at:at + marker.count] == marker {
LumiJsonText(*out, id)
at += marker.count
continue
}
unused VecPush(out, arguments[at])
at += 1
}
return BuilderFinish(out)
}
// The person's answer to "Delete ...? Reply yes or no.": 1 yes, 2 no,
// 0 neither, in their language or English.
LumiYesNo :: (input: string, active: *LumiCompiled, english: *LumiCompiled) -> s32 {
matcher: LumiMatcher
matcher.input = LumiTrimText(input)
matcher.words = *active.words
matcher.english_words = *english.words
yes := LumiTaggedAt(*matcher, LUMI_WORD_YES, 0)
no := LumiTaggedAt(*matcher, LUMI_WORD_NO, 0)
if yes > 0 && LumiSkipTail(matcher.input, yes) == cast(s32)matcher.input.count && yes >= no {
return 1
}
if no > 0 && LumiSkipTail(matcher.input, no) == cast(s32)matcher.input.count {
return 2
}
return 0
}
+847
View File
@@ -0,0 +1,847 @@
// Lumi's offline understanding of habit requests: a message is read as one
// core template (create, rename, pause, remind, ask, ...) and the clauses
// around it (every day, at 8, 3 times a day, at most 8 hours, higher is
// better, ...), then turned into the same app tool calls the online model
// makes (assets/mcp/tools.json). Anything it cannot read whole is left to
// the model, or, offline, answered with what Lumi can do.
#import "vec"
#import "text"
#import "utf8"
#import "json_scan"
#import "byte_text_linux"
#import, file "habit_patterns.zi";
LUMI_HABIT_CREATE :: 1
LUMI_HABIT_UPDATE :: 2
LUMI_HABIT_RENAME :: 3
LUMI_HABIT_PAUSE :: 4
LUMI_HABIT_RESUME :: 5
LUMI_HABIT_DELETE :: 6
LUMI_HABIT_ASK :: 7
LUMI_HABIT_UNASK :: 8
// A new habit's name is already a habit's, and nothing else was asked.
LUMI_HABIT_EXISTS :: 9
LUMI_REPEAT_DAILY :: 1
LUMI_REPEAT_EVERY :: 2
LUMI_REPEAT_DAYS :: 3
LUMI_MODE_CHECK :: 1
LUMI_MODE_COUNT :: 2
LUMI_MODE_SPAN :: 3
LUMI_ANSWER_TEXT :: 1
LUMI_ANSWER_NUMBER :: 2
LUMI_ANSWER_TIME :: 3
LUMI_ANSWER_YES_NO :: 4
LUMI_GOAL_ABOVE :: 1
LUMI_GOAL_BELOW :: 2
LUMI_GOAL_AT_LEAST :: 3
LUMI_GOAL_AT_MOST :: 4
LUMI_GOAL_BETWEEN :: 5
LUMI_GOAL_YES :: 6
LUMI_GOAL_NO :: 7
// What a goal's bounds measure.
LUMI_UNIT_ANY :: 0
LUMI_UNIT_NUMBER :: 1
LUMI_UNIT_TIME :: 2
LUMI_UNIT_LENGTH :: 3
LUMI_HABIT_INPUT_MAX :: 240
LumiLanguage :: struct {
patterns: string
clauses: string
words: string
}
LumiHabitPlan :: struct {
kind: s32
// The habit in the list the parser was given; -1 none, -2 ambiguous.
habit: s32
name: string
question: string
answer: s32
repeat: s32
every: s32
weekdays: s32
// 1 at hour, 2 off.
reminder: s32
// The reminder's hour plus one, so that 0 means none was read.
hour: s32
mode: s32
target: s32
goal: s32
unit: s32
low: s32
high: s32
clauses: s32
}
LumiToolCall :: struct {
name: string
arguments: string
}
LUMI_CALLS_MAX :: 6
LumiCoreKind :: (tag: string) -> s32 {
if tag == "create" || tag == "remind_new" { return LUMI_HABIT_CREATE }
if tag == "rename" { return LUMI_HABIT_RENAME }
if tag == "pause" { return LUMI_HABIT_PAUSE }
if tag == "resume" { return LUMI_HABIT_RESUME }
if tag == "delete" { return LUMI_HABIT_DELETE }
if tag == "ask" { return LUMI_HABIT_ASK }
if tag == "unask" { return LUMI_HABIT_UNASK }
return LUMI_HABIT_UPDATE
}
LumiHabitFilter :: (tag: string) -> s32 {
if tag == "resume" { return LUMI_HABITS_PAUSED }
if tag == "rename" || tag == "delete" { return LUMI_HABITS_ANY }
return LUMI_HABITS_ACTIVE
}
LumiSetOnce :: (field: *s32, value: s32) -> bool {
if field.* != 0 && field.* != value {
return false
}
field.* = value
return true
}
LumiSetGoal :: (plan: *LumiHabitPlan, goal: s32, unit: s32, low: s32, high: s32) -> bool {
if plan.goal != 0 {
return false
}
plan.goal = goal
plan.unit = unit
plan.low = low
plan.high = high
return true
}
LumiOrdered :: (values: [2]s32, count: s32, low: *s32, high: *s32) -> bool {
if count != 2 {
return false
}
low.* = ifx values[0] <= values[1] then values[0] else values[1]
high.* = ifx values[0] <= values[1] then values[1] else values[0]
return true
}
// Applies one clause; false when it contradicts one already read.
LumiApplyClause :: (plan: *LumiHabitPlan, tag: string, capture: LumiCapture) -> bool {
plan.clauses += 1
low: s32 = 0
high: s32 = 0
if tag == "daily" {
return LumiSetOnce(*plan.repeat, LUMI_REPEAT_DAILY)
}
if tag == "every_other" {
return LumiSetOnce(*plan.repeat, LUMI_REPEAT_EVERY) && LumiSetOnce(*plan.every, 2)
}
if tag == "every" {
if capture.number_count != 1 || capture.numbers[0] < 1 || capture.numbers[0] > 999 {
return false
}
if capture.numbers[0] == 1 {
return LumiSetOnce(*plan.repeat, LUMI_REPEAT_DAILY)
}
return LumiSetOnce(*plan.repeat, LUMI_REPEAT_EVERY) && LumiSetOnce(*plan.every, capture.numbers[0])
}
if tag == "days" || tag == "workdays" || tag == "weekend" {
mask := capture.days
if tag == "workdays" { mask = 31 }
if tag == "weekend" { mask = 96 }
if mask == 0 || !LumiSetOnce(*plan.repeat, LUMI_REPEAT_DAYS) {
return false
}
plan.weekdays |= mask
return true
}
if tag == "remind" {
if capture.time_count != 1 || capture.times[0] % 60 != 0 {
return false
}
return LumiSetOnce(*plan.reminder, 1) && LumiSetOnce(*plan.hour, capture.times[0] / 60 + 1)
}
if tag == "no_remind" {
return LumiSetOnce(*plan.reminder, 2)
}
if tag == "count" {
if capture.number_count != 1 || capture.numbers[0] < 1 || capture.numbers[0] > 9999 {
return false
}
return LumiSetOnce(*plan.mode, LUMI_MODE_COUNT) && LumiSetOnce(*plan.target, capture.numbers[0])
}
if tag == "check" {
return LumiSetOnce(*plan.mode, LUMI_MODE_CHECK)
}
if tag == "span" {
return LumiSetOnce(*plan.mode, LUMI_MODE_SPAN)
}
if tag == "length_at_most" && capture.length_count == 1 {
return LumiSetGoal(plan, LUMI_GOAL_AT_MOST, LUMI_UNIT_LENGTH, 0, capture.lengths[0])
}
if tag == "length_at_least" && capture.length_count == 1 {
return LumiSetGoal(plan, LUMI_GOAL_AT_LEAST, LUMI_UNIT_LENGTH, capture.lengths[0], 0)
}
if tag == "length_between" && capture.length_count == 1 && capture.number_count == 1 {
// "between 6 and 8 hours": the first number takes the second's unit.
lengths: [2]s32 = .[capture.numbers[0] * capture.length_unit, capture.lengths[0]]
if LumiOrdered(lengths, 2, *low, *high) && low > 0 {
return LumiSetGoal(plan, LUMI_GOAL_BETWEEN, LUMI_UNIT_LENGTH, low, high)
}
return false
}
if tag == "length_between" && LumiOrdered(capture.lengths, capture.length_count, *low, *high) {
return LumiSetGoal(plan, LUMI_GOAL_BETWEEN, LUMI_UNIT_LENGTH, low, high)
}
if tag == "shorter" {
return LumiSetGoal(plan, LUMI_GOAL_BELOW, LUMI_UNIT_LENGTH, 0, 0)
}
if tag == "longer" {
return LumiSetGoal(plan, LUMI_GOAL_ABOVE, LUMI_UNIT_LENGTH, 0, 0)
}
if tag == "higher" {
return LumiSetGoal(plan, LUMI_GOAL_ABOVE, LUMI_UNIT_ANY, 0, 0)
}
if tag == "lower" {
return LumiSetGoal(plan, LUMI_GOAL_BELOW, LUMI_UNIT_ANY, 0, 0)
}
if tag == "at_least" && capture.number_count == 1 {
return LumiSetGoal(plan, LUMI_GOAL_AT_LEAST, LUMI_UNIT_NUMBER, capture.numbers[0], 0)
}
if tag == "at_most" && capture.number_count == 1 {
return LumiSetGoal(plan, LUMI_GOAL_AT_MOST, LUMI_UNIT_NUMBER, 0, capture.numbers[0])
}
if tag == "between" && LumiOrdered(capture.numbers, capture.number_count, *low, *high) {
return LumiSetGoal(plan, LUMI_GOAL_BETWEEN, LUMI_UNIT_NUMBER, low, high)
}
if tag == "before" && capture.time_count == 1 {
return LumiSetGoal(plan, LUMI_GOAL_AT_MOST, LUMI_UNIT_TIME, 0, capture.times[0])
}
if tag == "after" && capture.time_count == 1 {
return LumiSetGoal(plan, LUMI_GOAL_AT_LEAST, LUMI_UNIT_TIME, capture.times[0], 0)
}
if tag == "between_times" && capture.time_count == 2 {
// Between a later and an earlier time spans midnight; keep the order.
return LumiSetGoal(plan, LUMI_GOAL_BETWEEN, LUMI_UNIT_TIME, capture.times[0], capture.times[1])
}
if tag == "earlier" {
return LumiSetGoal(plan, LUMI_GOAL_BELOW, LUMI_UNIT_TIME, 0, 0)
}
if tag == "later" {
return LumiSetGoal(plan, LUMI_GOAL_ABOVE, LUMI_UNIT_TIME, 0, 0)
}
if tag == "yes_good" {
return LumiSetGoal(plan, LUMI_GOAL_YES, LUMI_UNIT_ANY, 0, 0)
}
if tag == "no_good" {
return LumiSetGoal(plan, LUMI_GOAL_NO, LUMI_UNIT_ANY, 0, 0)
}
if tag == "answer_number" { return LumiSetOnce(*plan.answer, LUMI_ANSWER_NUMBER) }
if tag == "answer_time" { return LumiSetOnce(*plan.answer, LUMI_ANSWER_TIME) }
if tag == "answer_yes_no" { return LumiSetOnce(*plan.answer, LUMI_ANSWER_YES_NO) }
if tag == "answer_text" { return LumiSetOnce(*plan.answer, LUMI_ANSWER_TEXT) }
return false
}
// A language read once: its templates and words.
LumiCompiled :: struct {
patterns: LumiTemplates
clauses: LumiTemplates
words: LumiWords
}
LumiCompileLanguage :: (language: LumiLanguage, compiled: *LumiCompiled) {
LumiCompileTemplates(language.patterns, *compiled.patterns)
LumiCompileTemplates(language.clauses, *compiled.clauses)
LumiCompileWords(language.words, *compiled.words)
}
LumiParser :: struct {
matcher: LumiMatcher
active: *LumiCompiled
english: *LumiCompiled
// English is not tried twice when it is the active language.
english_extra: bool
}
// The clause of either language that matches all of text, applied to plan.
// Returns 1 applied, 0 none matched, -1 a contradiction.
LumiClauseMatch :: (parser: *LumiParser, text: string, plan: *LumiHabitPlan) -> s32 {
last := ifx parser.english_extra then 1 else 0
for source: cast(s32)0..last {
clauses := ifx source == 0 then *parser.active.clauses else *parser.english.clauses
for index: cast(s32)0..clauses.count - 1 {
template := *clauses.items[index]
parser.matcher.input = text
parser.matcher.habit_filter = LUMI_HABITS_ANY
capture: LumiCapture
if LumiTemplateMatches(*parser.matcher, template, *capture) {
return ifx LumiApplyClause(plan, template.tag, capture) then 1 else -1
}
if parser.matcher.budget <= 0 {
return -1
}
}
}
return 0
}
// Whether a word of the tag ends text, as "and" before a stripped clause.
LumiEndsWithTagged :: (parser: *LumiParser, text: string, tag: s32) -> s32 {
at: s32 = 0
while at < cast(s32)text.count {
if LumiBoundary(text, at) && !LumiSpaceCode(LumiCodeAt(text, at)) {
parser.matcher.input = text
end := LumiTaggedAt(*parser.matcher, tag, at)
if end >= 0 && LumiSkipTail(text, end) == cast(s32)text.count {
return at
}
}
at = Decode(text, at).after
}
return -1
}
LumiTrimJoins :: (parser: *LumiParser, text: string) -> string {
rest := LumiTrimText(text)
for guard: cast(s32)0..cast(s32)3 {
unused guard
at := LumiEndsWithTagged(parser, rest, LUMI_WORD_JOIN)
if at <= 0 {
break
}
rest = LumiTrimText(rest[:at])
}
return rest
}
// Peels clauses off the end of text, then, when allowed, off its start.
// Returns what is left for a core template, or "" on a contradiction.
LumiStripClauses :: (parser: *LumiParser, text: string, from_start: bool, plan: *LumiHabitPlan) -> string {
rest := LumiTrimJoins(parser, text)
for guard: cast(s32)0..cast(s32)7 {
unused guard
found := false
at: s32 = 0
while at < cast(s32)rest.count {
at = Decode(rest, at).after
if at >= cast(s32)rest.count || !LumiBoundary(rest, at) ||
LumiSpaceCode(LumiCodeAt(rest, at)) || LumiPunctuationCode(LumiCodeAt(rest, at)) {
continue
}
matched := LumiClauseMatch(parser, rest[at:], plan)
if matched < 0 {
return ""
}
if matched > 0 {
rest = LumiTrimJoins(parser, rest[:at])
found = true
break
}
}
if !found {
break
}
}
if !from_start {
return rest
}
for guard: cast(s32)0..cast(s32)7 {
unused guard
found := false
end := cast(s32)rest.count
while end > 0 {
previous := end - 1
while previous > 0 && Continuation(rest[previous]) {
previous -= 1
}
end = previous
if end <= 0 || !LumiBoundary(rest, end) {
continue
}
matched := LumiClauseMatch(parser, rest[:end], plan)
if matched < 0 {
return ""
}
if matched > 0 {
rest = LumiTrimText(rest[end:])
found = true
break
}
}
if !found {
break
}
}
return rest
}
// A copy that outlives the message it was read from.
LumiOwned :: (text: string) -> string {
out: Vec(u8)
BuilderPrint(*out, "%", text)
return BuilderFinish(out)
}
// A new habit's or question's words as the person typed them, with a
// capital first letter.
LumiCapitalized :: (text: string) -> string {
if text.count == 0 || text[0] < cast(u8)97 || text[0] > cast(u8)122 {
return text
}
out: Vec(u8)
unused VecPush(out, text[0] - cast(u8)32)
BuilderPrint(*out, "%", text[1:])
return BuilderFinish(out)
}
LumiQuestionText :: (text: string) -> string {
words := LumiTrimText(text)
if words.count >= 2 && (words[0] == cast(u8)34 || words[0] == cast(u8)39) &&
words[words.count - 1] == words[0] {
return LumiTrimText(words[1:words.count - 1])
}
capitalized := LumiCapitalized(words)
last := LumiCodeBefore(capitalized, cast(s32)capitalized.count)
if last == 63 || last == 65311 {
return capitalized
}
out: Vec(u8)
BuilderPrint(*out, "%?", capitalized)
return BuilderFinish(out)
}
// The answer a question's own words suggest: "how many" a number, "what
// time" a time, "did I" yes or no.
LumiAnswerFromWords :: (parser: *LumiParser, text: string) -> s32 {
parser.matcher.input = text
if LumiTaggedAt(*parser.matcher, LUMI_WORD_ASK_NUMBER, 0) > 0 { return LUMI_ANSWER_NUMBER }
if LumiTaggedAt(*parser.matcher, LUMI_WORD_ASK_TIME, 0) > 0 { return LUMI_ANSWER_TIME }
if LumiTaggedAt(*parser.matcher, LUMI_WORD_ASK_YES_NO, 0) > 0 { return LUMI_ANSWER_YES_NO }
return LUMI_ANSWER_TEXT
}
// The habit named exactly like name, active or paused, or -1.
LumiHabitNamed :: (habits: []LumiHabitRef, name: string) -> s32 {
for index: cast(s32)0..cast(s32)habits.count - 1 {
if LumiSamePhrase(LumiLineTrim(habits[index].title), name) &&
LumiSamePhrase(name, LumiLineTrim(habits[index].title)) {
return index
}
}
return -1
}
// Checks that a plan's parts fit together; false sends it to the model.
LumiPlanComplete :: (parser: *LumiParser, plan: *LumiHabitPlan, habits: []LumiHabitRef) -> bool {
kind := plan.kind
if plan.habit == -2 {
return true
}
if kind == LUMI_HABIT_PAUSE || kind == LUMI_HABIT_RESUME || kind == LUMI_HABIT_DELETE ||
kind == LUMI_HABIT_RENAME || kind == LUMI_HABIT_UNASK {
return plan.clauses == 0
}
if kind == LUMI_HABIT_CREATE {
existing := LumiHabitNamed(habits, plan.name)
if existing >= 0 {
plan.habit = existing
plan.kind = ifx plan.clauses == 0 then LUMI_HABIT_EXISTS else LUMI_HABIT_UPDATE
if habits[existing].paused && plan.clauses > 0 {
return false
}
kind = plan.kind
}
}
if kind == LUMI_HABIT_UPDATE && plan.clauses == 0 {
return false
}
if kind == LUMI_HABIT_ASK {
// The question's own words decide first, so a goal that does not
// fit them sends the request to the model instead.
if plan.answer == 0 {
plan.answer = LumiAnswerFromWords(parser, plan.question)
}
if plan.answer == LUMI_ANSWER_TEXT && plan.goal != 0 {
if plan.unit == LUMI_UNIT_TIME {
plan.answer = LUMI_ANSWER_TIME
} else if plan.goal == LUMI_GOAL_YES || plan.goal == LUMI_GOAL_NO {
plan.answer = LUMI_ANSWER_YES_NO
} else {
plan.answer = LUMI_ANSWER_NUMBER
}
}
if plan.unit == LUMI_UNIT_LENGTH || plan.repeat != 0 || plan.reminder != 0 || plan.mode != 0 {
return false
}
if plan.goal != 0 {
answer := plan.answer
yes_no := plan.goal == LUMI_GOAL_YES || plan.goal == LUMI_GOAL_NO
if answer == LUMI_ANSWER_TEXT || (answer == LUMI_ANSWER_YES_NO) != yes_no ||
(plan.unit == LUMI_UNIT_NUMBER && answer != LUMI_ANSWER_NUMBER) ||
(plan.unit == LUMI_UNIT_TIME && answer != LUMI_ANSWER_TIME) {
return false
}
}
plan.question = LumiQuestionText(plan.question)
return plan.question.count > 0 && plan.question.count < 96
}
// A habit's own goal judges its spans.
if plan.goal != 0 {
if plan.unit != LUMI_UNIT_LENGTH {
return false
}
if plan.mode == 0 {
plan.mode = LUMI_MODE_SPAN
}
if plan.mode != LUMI_MODE_SPAN {
return false
}
}
if plan.answer != 0 {
return false
}
return kind != LUMI_HABIT_CREATE || (plan.name.count > 0 && plan.name.count < 40)
}
// The plan the first template of tag that matches makes, or kind 0.
LumiCoreMatch :: (parser: *LumiParser, text: string, tag: string, base: LumiHabitPlan,
habits: []LumiHabitRef) -> LumiHabitPlan {
last := ifx parser.english_extra then 1 else 0
for source: cast(s32)0..last {
patterns := ifx source == 0 then *parser.active.patterns else *parser.english.patterns
for index: cast(s32)0..patterns.count - 1 {
template := *patterns.items[index]
if template.tag != tag {
continue
}
parser.matcher.input = text
parser.matcher.habit_filter = LumiHabitFilter(tag)
capture: LumiCapture
if !LumiTemplateMatches(*parser.matcher, template, *capture) {
continue
}
candidate := base
candidate.kind = LumiCoreKind(tag)
candidate.habit = capture.habit
candidate.name = LumiOwned(LumiCapitalized(LumiTrimText(text[capture.name_at:capture.name_end])))
candidate.question = LumiOwned(LumiTrimText(text[capture.text_at:capture.text_end]))
// Templates may hold the time themselves, as "{time}に".
if capture.time_count == 1 && !LumiApplyClause(*candidate, "remind", capture) {
continue
}
if tag == "no_remind" && !LumiApplyClause(*candidate, "no_remind", capture) {
continue
}
if (tag == "remind" || tag == "remind_new") && candidate.reminder != 1 {
continue
}
if tag == "remind_new" && candidate.repeat == 0 {
candidate.repeat = LUMI_REPEAT_DAILY
}
if LumiPlanComplete(parser, *candidate, habits) {
return candidate
}
}
}
return LumiHabitPlan.{.habit = -1}
}
LumiParseWith :: (parser: *LumiParser, text: string, from_start: bool,
habits: []LumiHabitRef) -> LumiHabitPlan {
plan := LumiHabitPlan.{.habit = -1}
rest := LumiStripClauses(parser, text, from_start, *plan)
if rest.count == 0 {
return LumiHabitPlan.{.habit = -1}
}
// Templates naming an existing habit come before those creating one.
tags: [11]string = .["rename", "pause", "resume", "delete", "unask", "ask", "no_remind",
"remind", "update", "create", "remind_new"]
for tag: tags {
matched := LumiCoreMatch(parser, rest, tag, plan, habits)
if matched.kind != 0 {
return matched
}
if parser.matcher.budget <= 0 {
break
}
}
return LumiHabitPlan.{.habit = -1}
}
// Reads a habit request with languages already read. A plan of kind 0 is
// not one Lumi understands. english may be active itself.
LumiHabitParseCompiled :: (input: string, active: *LumiCompiled, english: *LumiCompiled,
habits: []LumiHabitRef) -> LumiHabitPlan {
text := LumiTrimText(input)
if text.count == 0 || text.count > LUMI_HABIT_INPUT_MAX {
return LumiHabitPlan.{.habit = -1}
}
parser: LumiParser
parser.active = active
parser.english = english
parser.english_extra = english != active
parser.matcher.words = *active.words
parser.matcher.english_words = *english.words
parser.matcher.habits = habits
parser.matcher.budget = LUMI_PARSE_BUDGET
// Clauses may also lead, as in Japanese "毎日8時に読書の習慣を追加".
// The reading that understands more of the message wins.
plan := LumiParseWith(*parser, text, false, habits)
if parser.matcher.budget > 0 {
leading := LumiParseWith(*parser, text, true, habits)
if leading.kind != 0 && (plan.kind == 0 || leading.clauses > plan.clauses) {
plan = leading
}
}
lumi_parse_steps = LUMI_PARSE_BUDGET - parser.matcher.budget
return plan
}
// The matcher steps a message may take, and those the last one took.
LUMI_PARSE_BUDGET :: 40000
lumi_parse_steps: s32;
lumi_parse_active: LumiCompiled;
lumi_parse_english: LumiCompiled;
// Reads a habit request in a language given as its locale text.
LumiHabitParse :: (input: string, active: LumiLanguage, english: LumiLanguage,
habits: []LumiHabitRef) -> LumiHabitPlan {
LumiCompileLanguage(active, *lumi_parse_active)
if english.patterns == active.patterns {
return LumiHabitParseCompiled(input, *lumi_parse_active, *lumi_parse_active, habits)
}
LumiCompileLanguage(english, *lumi_parse_english)
return LumiHabitParseCompiled(input, *lumi_parse_active, *lumi_parse_english, habits)
}
LumiJsonText :: (out: *Vec(u8), value: string) {
BuilderPrint(out, "\"")
for byte: value {
if byte == cast(u8)34 || byte == cast(u8)92 {
unused VecPush(out.*, cast(u8)92)
unused VecPush(out.*, byte)
} else if byte == cast(u8)10 {
BuilderPrint(out, "\\n")
} else if byte >= cast(u8)32 {
unused VecPush(out.*, byte)
}
}
BuilderPrint(out, "\"")
}
// A clock time as the tools write it: 7:00, 19:30.
LumiClockText :: (minutes: s32) -> string {
out: Vec(u8)
BuilderPrint(*out, "%:", minutes / 60)
BuilderPrint(*out, "%", ifx minutes % 60 < 10 then "0" else "")
BuilderPrint(*out, "%", minutes % 60)
return BuilderFinish(out)
}
LumiGoalName :: (goal: s32) -> string {
names: [8]string = .["none", "above_average", "below_average", "at_least", "at_most",
"between", "yes", "no"]
return names[goal]
}
LumiGoalBound :: (out: *Vec(u8), name: string, value: s32, unit: s32) {
BuilderPrint(out, ",\"%\":", name)
if unit == LUMI_UNIT_NUMBER {
BuilderPrint(out, "%", value)
} else {
LumiJsonText(out, LumiClockText(value))
}
}
LumiGoalFields :: (out: *Vec(u8), plan: LumiHabitPlan) {
if plan.goal == 0 {
return
}
BuilderPrint(out, ",\"good\":\"%\"", LumiGoalName(plan.goal))
if plan.goal == LUMI_GOAL_AT_LEAST || plan.goal == LUMI_GOAL_BETWEEN {
LumiGoalBound(out, "low", plan.low, plan.unit)
}
if plan.goal == LUMI_GOAL_AT_MOST || plan.goal == LUMI_GOAL_BETWEEN {
LumiGoalBound(out, "high", plan.high, plan.unit)
}
}
LumiCallStart :: (out: *Vec(u8), id: string) {
BuilderPrint(out, "{\"id\":")
LumiJsonText(out, id)
}
LumiAnswerName :: (answer: s32) -> string {
names: [5]string = .["text", "text", "number", "time", "yes_no"]
return names[answer]
}
// The same question, ignoring case and a final question mark.
LumiSameQuestion :: (left: string, right: string) -> bool {
a := LumiTrimText(left)
b := LumiTrimText(right)
return a.count > 0 && LumiSamePhrase(a, b) && LumiSamePhrase(b, a)
}
// The questions a habit keeps, changed by the plan: the existing JSON items
// verbatim, with the asked one replaced or added, or the named one removed.
// Returns "" when there is nothing to change or no room.
LumiQuestionList :: (plan: LumiHabitPlan, existing: string) -> string {
out: Vec(u8)
BuilderPrint(*out, "[")
count: s32 = 0
replaced := false
removed := false
list := ArrayCount(existing, 0)
for index: cast(s32)0..list - 1 {
at := ElementAt(existing, 0, index)
end := ValueEnd(existing, at, 0)
if at < 0 || end < 0 {
return ""
}
words: [96]u8
length := ReadStringText(existing, FieldAt(existing, at, "text"), words[:])
same := length > 0 && length < 96 &&
LumiSameQuestion(TextFromBytes(words[:length]), plan.question)
if same && plan.kind == LUMI_HABIT_UNASK {
removed = true
continue
}
if same && plan.kind == LUMI_HABIT_ASK {
replaced = true
BuilderPrint(*out, "%", ifx count == 0 then "" else ",")
LumiQuestionItem(*out, plan, TextFromBytes(words[:length]))
count += 1
continue
}
BuilderPrint(*out, "%", ifx count == 0 then "" else ",")
BuilderPrint(*out, "%", existing[at:end])
count += 1
}
if plan.kind == LUMI_HABIT_UNASK && !removed {
return ""
}
if plan.kind == LUMI_HABIT_ASK && !replaced {
if count >= 8 {
return ""
}
BuilderPrint(*out, "%", ifx count == 0 then "" else ",")
LumiQuestionItem(*out, plan, plan.question)
}
BuilderPrint(*out, "]")
return BuilderFinish(out)
}
LumiQuestionItem :: (out: *Vec(u8), plan: LumiHabitPlan, text: string) {
BuilderPrint(out, "{\"text\":")
LumiJsonText(out, text)
BuilderPrint(out, ",\"answer\":\"%\"", LumiAnswerName(plan.answer))
goal := plan
if goal.unit == LUMI_UNIT_ANY && goal.answer == LUMI_ANSWER_TIME {
goal.unit = LUMI_UNIT_TIME
}
LumiGoalFields(out, goal)
BuilderPrint(out, "}")
}
// The tool calls a plan makes, in order. "$new" stands for the id the
// first call, create_habit, returns. questions holds the habit's current
// questions (read_habit) for ask and unask. Returns how many, 0 for none.
LumiHabitCalls :: (plan: LumiHabitPlan, habits: []LumiHabitRef, questions: string,
calls: []LumiToolCall) -> s32 {
count: s32 = 0
id := "$new"
if plan.habit >= 0 && plan.habit < cast(s32)habits.count {
id = habits[plan.habit].id
}
kind := plan.kind
if kind == LUMI_HABIT_CREATE {
out: Vec(u8)
BuilderPrint(*out, "{\"name\":")
LumiJsonText(*out, plan.name)
BuilderPrint(*out, "}")
calls[count] = LumiToolCall.{.name = "create_habit", .arguments = BuilderFinish(out)}
count += 1
} else if plan.habit < 0 {
return 0
}
if kind == LUMI_HABIT_RENAME || kind == LUMI_HABIT_PAUSE || kind == LUMI_HABIT_RESUME ||
kind == LUMI_HABIT_DELETE {
out: Vec(u8)
LumiCallStart(*out, id)
name := "delete_habit"
if kind == LUMI_HABIT_RENAME {
name = "rename_habit"
BuilderPrint(*out, ",\"name\":")
LumiJsonText(*out, plan.name)
} else if kind != LUMI_HABIT_DELETE {
name = "set_habit_active"
BuilderPrint(*out, ",\"active\":%", kind == LUMI_HABIT_RESUME)
}
BuilderPrint(*out, "}")
calls[count] = LumiToolCall.{.name = name, .arguments = BuilderFinish(out)}
return count + 1
}
if kind == LUMI_HABIT_ASK || kind == LUMI_HABIT_UNASK {
list := LumiQuestionList(plan, questions)
if list.count == 0 {
return 0
}
out: Vec(u8)
LumiCallStart(*out, id)
BuilderPrint(*out, ",\"questions\":%}", list)
calls[count] = LumiToolCall.{.name = "set_habit_questions", .arguments = BuilderFinish(out)}
return count + 1
}
if plan.repeat != 0 || plan.reminder != 0 {
out: Vec(u8)
LumiCallStart(*out, id)
if plan.repeat == LUMI_REPEAT_DAILY {
BuilderPrint(*out, ",\"repeat\":\"daily\"")
} else if plan.repeat == LUMI_REPEAT_EVERY {
BuilderPrint(*out, ",\"repeat\":\"daily\",\"every\":%", plan.every)
} else if plan.repeat == LUMI_REPEAT_DAYS {
BuilderPrint(*out, ",\"repeat\":\"weekly\",\"weekdays\":[")
names: [7]string = .["mon", "tue", "wed", "thu", "fri", "sat", "sun"]
first := true
for day: cast(s32)0..cast(s32)6 {
if (plan.weekdays & (1 << day)) != 0 {
BuilderPrint(*out, "%\"%\"", ifx first then "" else ",", names[day])
first = false
}
}
BuilderPrint(*out, "]")
}
if plan.reminder == 1 {
BuilderPrint(*out, ",\"notification\":true,\"notification_hour\":%", plan.hour - 1)
} else if plan.reminder == 2 {
BuilderPrint(*out, ",\"notification\":false")
}
BuilderPrint(*out, "}")
calls[count] = LumiToolCall.{.name = "set_habit_schedule", .arguments = BuilderFinish(out)}
count += 1
}
if plan.mode != 0 {
modes: [4]string = .["", "check", "count", "span"]
out: Vec(u8)
LumiCallStart(*out, id)
BuilderPrint(*out, ",\"mode\":\"%\"", modes[plan.mode])
if plan.mode == LUMI_MODE_COUNT {
BuilderPrint(*out, ",\"target\":%", plan.target)
}
LumiGoalFields(*out, plan)
BuilderPrint(*out, "}")
calls[count] = LumiToolCall.{.name = "set_habit_tracking", .arguments = BuilderFinish(out)}
count += 1
}
return count
}
+965
View File
@@ -0,0 +1,965 @@
// Matches the translated templates Lumi understands habits with, on the
// device and without a model. A template is a line of words and slots:
//
// create: add a/the habit {name}
// remind: [and] remind me at {time}
//
// Words fold case and, when they are ASCII words of four or more letters,
// accept one typo. "a/the" accepts either word, [ ] makes words optional.
// Slots: {habit} an existing habit, {name} and {text} free words, {n} a
// whole number, {time} a clock time, {length} a duration with its unit,
// {days} weekday names. Words need boundaries only between letters of
// alphabets written with spaces, so Japanese, Chinese and Korean templates
// need no spaces. Matching is bounded; it never runs code from a template.
#import "utf8"
#import "vec"
#import "text"
#import, file "command_text.zi";
LUMI_TOKEN_WORDS :: 0
LUMI_TOKEN_SLOT :: 1
LUMI_TOKEN_OPEN :: 2
LUMI_TOKEN_CLOSE :: 3
LUMI_TOKEN_MAX :: 24
LUMI_SLOT_HABIT :: 1
LUMI_SLOT_NAME :: 2
LUMI_SLOT_TEXT :: 3
LUMI_SLOT_NUMBER :: 4
LUMI_SLOT_TIME :: 5
LUMI_SLOT_LENGTH :: 6
LUMI_SLOT_DAYS :: 7
// Which habits {habit} may name.
LUMI_HABITS_ACTIVE :: 0
LUMI_HABITS_PAUSED :: 1
LUMI_HABITS_ANY :: 2
// Habit candidates one {habit} slot considers at a position.
LUMI_HABIT_CANDIDATES :: 8
LumiToken :: struct {
kind: s32
slot: s32
text: string
}
LumiHabitRef :: struct {
id: string
title: string
paused: bool
}
// What a template's slots read. A habit of -2 means several habits match.
// Free words are kept as byte ranges of the matched input.
LumiCapture :: struct {
habit: s32
name_at: s32
name_end: s32
text_at: s32
text_end: s32
numbers: [2]s32
number_count: s32
// Minutes since midnight.
times: [2]s32
time_count: s32
// Minutes, and the unit the last one was written in: 60 for hours, 1
// for minutes, so "between 6 and 8 hours" reads 6 as hours too.
lengths: [2]s32
length_count: s32
length_unit: s32
days: s32
}
// The words a language uses beside its templates, read from its
// "tag: a | b" lines once per language: weekdays, numbers, units and the
// words of answers.
LUMI_WORD_MON :: 0
LUMI_WORD_AND :: 7
LUMI_WORD_JOIN :: 8
// One to ten follow in order.
LUMI_WORD_ONE :: 9
LUMI_WORD_AM :: 19
LUMI_WORD_PM :: 20
LUMI_WORD_OCLOCK :: 21
LUMI_WORD_HOURS :: 22
LUMI_WORD_MINUTES :: 23
LUMI_WORD_ASK_NUMBER :: 24
LUMI_WORD_ASK_TIME :: 25
LUMI_WORD_ASK_YES_NO :: 26
LUMI_WORD_YES :: 27
LUMI_WORD_NO :: 28
LUMI_WORD_TAGS :: 29
LUMI_WORD_ALTERNATIVES :: 12
LumiWords :: struct {
phrases: [LUMI_WORD_TAGS * LUMI_WORD_ALTERNATIVES]string
counts: [LUMI_WORD_TAGS]s32
}
LumiWordTag :: (tag: string) -> s32 {
names: [LUMI_WORD_TAGS]string = .["mon", "tue", "wed", "thu", "fri", "sat", "sun", "and", "join",
"1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "am", "pm", "oclock", "hours", "minutes",
"ask_number", "ask_time", "ask_yes_no", "yes", "no"]
for index: cast(s32)0..LUMI_WORD_TAGS - 1 {
if names[index] == tag {
return index
}
}
return -1
}
// A template, read once into words and slots.
LumiTemplate :: struct {
tag: string
tokens: [LUMI_TOKEN_MAX]LumiToken
count: s32
}
LUMI_TEMPLATES_MAX :: 128
LumiTemplates :: struct {
items: [LUMI_TEMPLATES_MAX]LumiTemplate
count: s32
}
LumiMatcher :: struct {
input: string
words: *LumiWords
english_words: *LumiWords
habits: []LumiHabitRef
habit_filter: s32
budget: s32
}
LumiNewCapture :: () -> LumiCapture {
return LumiCapture.{.habit = -1}
}
LumiFoldCode :: (codepoint: u32) -> u32 {
// A typed apostrophe matches the typographic one translations use.
if codepoint == cast(u32)8217 || codepoint == cast(u32)700 {
return cast(u32)39
}
return CommandFold(codepoint)
}
// Letters and digits of alphabets written with spaces between words.
LumiWordCode :: (codepoint: u32) -> bool {
return (codepoint >= 48 && codepoint <= 57) || (codepoint >= 65 && codepoint <= 90) ||
(codepoint >= 97 && codepoint <= 122) || codepoint == 39 || codepoint == 8217 ||
(codepoint >= 192 && codepoint <= 591 && codepoint != 215 && codepoint != 247) ||
(codepoint >= 880 && codepoint <= 1327)
}
LumiSpaceCode :: (codepoint: u32) -> bool {
return codepoint == 32 || codepoint == 9 || codepoint == 10 || codepoint == 13 ||
codepoint == 160 || codepoint == 12288
}
// Punctuation that may end a request or separate its parts.
LumiPunctuationCode :: (codepoint: u32) -> bool {
return codepoint == 44 || codepoint == 46 || codepoint == 33 || codepoint == 63 ||
codepoint == 59 || codepoint == 12290 || codepoint == 12289 || codepoint == 65281 ||
codepoint == 65311 || codepoint == 65292 || codepoint == 65307
}
LumiCodeAt :: (text: string, at: s32) -> u32 {
if at < 0 || at >= cast(s32)text.count {
return cast(u32)0
}
return Decode(text, at).value
}
// The codepoint before at, or 0 at the start.
LumiCodeBefore :: (text: string, at: s32) -> u32 {
if at <= 0 || at > cast(s32)text.count {
return cast(u32)0
}
start := at - 1
while start > 0 && Continuation(text[start]) {
start -= 1
}
return Decode(text, start).value
}
// No word continues across this position.
LumiBoundary :: (text: string, at: s32) -> bool {
return !LumiWordCode(LumiCodeBefore(text, at)) || !LumiWordCode(LumiCodeAt(text, at))
}
// Spaces and commas between a template's words: "the shorter, the better".
LumiSkipGap :: (text: string, at: s32) -> s32 {
while at < cast(s32)text.count {
decoded := Decode(text, at)
if !LumiSpaceCode(decoded.value) && decoded.value != 44 && decoded.value != 12289 &&
decoded.value != 65292 {
return at
}
at = decoded.after
}
return at
}
LumiSkipSpace :: (text: string, at: s32) -> s32 {
while at < cast(s32)text.count {
decoded := Decode(text, at)
if !LumiSpaceCode(decoded.value) {
return at
}
at = decoded.after
}
return at
}
// Spaces and punctuation that may end a request.
LumiSkipTail :: (text: string, at: s32) -> s32 {
while at < cast(s32)text.count {
decoded := Decode(text, at)
if !LumiSpaceCode(decoded.value) && !LumiPunctuationCode(decoded.value) {
return at
}
at = decoded.after
}
return at
}
LumiTrimText :: (text: string) -> string {
start: s32 = 0
while start < cast(s32)text.count {
decoded := Decode(text, start)
if !LumiSpaceCode(decoded.value) && !LumiPunctuationCode(decoded.value) {
break
}
start = decoded.after
}
end := cast(s32)text.count
while end > start {
previous := end - 1
while previous > start && Continuation(text[previous]) {
previous -= 1
}
code := Decode(text, previous).value
if !LumiSpaceCode(code) && !LumiPunctuationCode(code) {
break
}
end = previous
}
return text[start:end]
}
// The end of one word or phrase at at, case folded, or -1. Spaces in the
// phrase match one or more spaces.
LumiPhraseAt :: (text: string, at: s32, phrase: string) -> s32 {
return LumiPhraseFrom(text, at, phrase, true)
}
// A unit may follow its number without a space, as in 16h.
LumiPhraseFrom :: (text: string, at: s32, phrase: string, word_start: bool) -> s32 {
if phrase.count == 0 || at < 0 {
return -1
}
a := at
b: s32 = 0
while b < cast(s32)phrase.count {
y := Decode(phrase, b)
if LumiSpaceCode(y.value) {
if a >= cast(s32)text.count || !LumiSpaceCode(LumiCodeAt(text, a)) {
return -1
}
a = LumiSkipSpace(text, a)
b = LumiSkipSpace(phrase, b)
continue
}
if a >= cast(s32)text.count {
return -1
}
x := Decode(text, a)
if LumiFoldCode(x.value) != LumiFoldCode(y.value) {
return -1
}
a = x.after
b = y.after
}
if !LumiBoundary(text, a) || (word_start && !LumiBoundary(text, at)) {
return -1
}
return a
}
LumiAsciiWord :: (word: string) -> bool {
if word.count < 4 {
return false
}
for byte: word {
if !((byte >= 97 && byte <= 122) || (byte >= 65 && byte <= 90)) {
return false
}
}
return true
}
// The end of the word at at.
LumiWordEnd :: (text: string, at: s32) -> s32 {
end := at
while end < cast(s32)text.count {
decoded := Decode(text, end)
if !LumiWordCode(decoded.value) {
break
}
end = decoded.after
}
return end
}
// One alternative of a template word, allowing a typo in longer words.
LumiWordAt :: (text: string, at: s32, word: string) -> s32 {
end := LumiPhraseAt(text, at, word)
if end >= 0 {
return end
}
if !LumiAsciiWord(word) || !LumiBoundary(text, at) {
return -1
}
word_end := LumiWordEnd(text, at)
if word_end > at && CommandTypo(text[at:word_end], word) {
return word_end
}
return -1
}
// A template word with "/" alternatives: the longest that matches.
LumiWordsAt :: (text: string, at: s32, words: string) -> s32 {
best: s32 = -1
start: s32 = 0
while start <= cast(s32)words.count {
end := start
while end < cast(s32)words.count && words[end] != cast(u8)47 {
end += 1
}
if end > start {
matched := LumiWordAt(text, at, words[start:end])
if matched > best {
best = matched
}
}
start = end + 1
}
return best
}
// The tag of a "tag: body" line, and its body.
LumiLine :: struct {
tag: string
body: string
}
LumiLineAt :: (text: string, start: s32) -> LumiLine {
end := start
while end < cast(s32)text.count && text[end] != cast(u8)10 {
end += 1
}
line := text[start:end]
colon: s32 = 0
while colon < cast(s32)line.count && line[colon] != cast(u8)58 {
colon += 1
}
if colon >= cast(s32)line.count {
return LumiLine.{.body = LumiLineTrim(line)}
}
return LumiLine.{.tag = LumiLineTrim(line[:colon]), .body = LumiLineTrim(line[colon + 1:])}
}
LumiNextLine :: (text: string, start: s32) -> s32 {
end := start
while end < cast(s32)text.count && text[end] != cast(u8)10 {
end += 1
}
return end + 1
}
LumiLineTrim :: (value: string) -> string {
start: s64 = 0
end := value.count
while start < end && CommandSpace(value[start]) {
start += 1
}
while end > start && CommandSpace(value[end - 1]) {
end -= 1
}
return value[start:end]
}
// Reads a language's "tag: a | b" word lines.
LumiCompileWords :: (text: string, words: *LumiWords) {
words.* = LumiWords.{}
start: s32 = 0
while start < cast(s32)text.count {
line := LumiLineAt(text, start)
start = LumiNextLine(text, start)
tag := LumiWordTag(line.tag)
if tag < 0 {
continue
}
from: s32 = 0
while from <= cast(s32)line.body.count {
to := from
while to < cast(s32)line.body.count && line.body[to] != cast(u8)124 {
to += 1
}
alternative := LumiLineTrim(line.body[from:to])
if alternative.count > 0 && words.counts[tag] < LUMI_WORD_ALTERNATIVES {
words.phrases[tag * LUMI_WORD_ALTERNATIVES + words.counts[tag]] = alternative
words.counts[tag] += 1
}
from = to + 1
}
}
}
// Reads a language's "tag: template" lines.
LumiCompileTemplates :: (text: string, templates: *LumiTemplates) {
templates.count = 0
start: s32 = 0
while start < cast(s32)text.count && templates.count < LUMI_TEMPLATES_MAX {
line := LumiLineAt(text, start)
start = LumiNextLine(text, start)
if line.tag.count == 0 || line.body.count == 0 {
continue
}
template := *templates.items[templates.count]
template.tag = line.tag
template.count = LumiTokens(line.body, template.tokens[:])
if template.count > 0 {
templates.count += 1
}
}
}
// The longest alternative of a tag in one words list at at.
LumiTaggedFrom :: (words: *LumiWords, tag: s32, text: string, at: s32, word_start: bool) -> s32 {
best: s32 = -1
if words == null || tag < 0 || tag >= LUMI_WORD_TAGS {
return best
}
for index: cast(s32)0..words.counts[tag] - 1 {
matched := LumiPhraseFrom(text, at, words.phrases[tag * LUMI_WORD_ALTERNATIVES + index], word_start)
if matched > best {
best = matched
}
}
return best
}
LumiTaggedEither :: (matcher: *LumiMatcher, tag: s32, at: s32, word_start: bool) -> s32 {
active := LumiTaggedFrom(matcher.words, tag, matcher.input, at, word_start)
if matcher.english_words == matcher.words {
return active
}
english := LumiTaggedFrom(matcher.english_words, tag, matcher.input, at, word_start)
return ifx english > active then english else active
}
// A unit of the language or of English, which may follow its number
// without a space, as in 9pm or 16h.
LumiUnitAt :: (matcher: *LumiMatcher, tag: s32, at: s32) -> s32 {
return LumiTaggedEither(matcher, tag, at, false)
}
// A tagged word of the language or of English.
LumiTaggedAt :: (matcher: *LumiMatcher, tag: s32, at: s32) -> s32 {
return LumiTaggedEither(matcher, tag, at, true)
}
LumiDigitsAt :: (text: string, at: s32, most: s32) -> s32 {
end := at
while end < cast(s32)text.count && end - at < most && text[end] >= cast(u8)48 &&
text[end] <= cast(u8)57 {
end += 1
}
return end
}
LumiDigitsValue :: (text: string) -> s32 {
value: s32 = 0
for byte: text {
value = value * 10 + cast(s32)(byte - cast(u8)48)
}
return value
}
LumiNumberAt :: (matcher: *LumiMatcher, at: s32, value: *s32) -> s32 {
end := LumiDigitsAt(matcher.input, at, 4)
if end > at {
if !LumiBoundary(matcher.input, end) && LumiCodeAt(matcher.input, end) >= 65 {
// Letters straight after digits belong to a unit, not a count.
return -1
}
value.* = LumiDigitsValue(matcher.input[at:end])
return end
}
best: s32 = -1
for index: cast(s32)0..cast(s32)9 {
matched := LumiTaggedAt(matcher, LUMI_WORD_ONE + index, at)
if matched > best {
best = matched
value.* = index + 1
}
}
return best
}
// A clock time: 7, 7:30, 19.30, 7 am or 7pm. Returns its end and the
// minutes since midnight, or -1.
LumiTimeAt :: (matcher: *LumiMatcher, at: s32, minutes: *s32) -> s32 {
text := matcher.input
end := LumiDigitsAt(text, at, 2)
if end == at {
return -1
}
hour := LumiDigitsValue(text[at:end])
minute: s32 = 0
if end + 2 < cast(s32)text.count && (text[end] == cast(u8)58 || text[end] == cast(u8)46) {
minute_end := LumiDigitsAt(text, end + 1, 2)
if minute_end == end + 3 {
minute = LumiDigitsValue(text[end + 1:minute_end])
end = minute_end
}
}
if minute > 59 {
return -1
}
after := LumiSkipSpace(text, end)
// "8 o'clock", "8 Uhr abends", "8時": a clock word, then morning or
// evening.
oclock := LumiUnitAt(matcher, LUMI_WORD_OCLOCK, after)
if oclock > 0 {
end = oclock
after = LumiSkipSpace(text, end)
}
am := LumiUnitAt(matcher, LUMI_WORD_AM, after)
pm := LumiUnitAt(matcher, LUMI_WORD_PM, after)
if am > 0 || pm > 0 {
if hour < 1 || hour > 12 {
return -1
}
if hour == 12 {
hour = 0
}
if pm > am {
hour += 12
end = pm
} else {
end = am
}
}
if hour > 23 || (!LumiBoundary(text, end) && LumiCodeAt(text, end) >= 65) {
return -1
}
minutes.* = hour * 60 + minute
return end
}
// A duration with its unit: 8 hours, 16h, 1.5 hours, 90 minutes, or 8:00.
LumiLengthAt :: (matcher: *LumiMatcher, at: s32, minutes: *s32, unit: *s32) -> s32 {
text := matcher.input
end := LumiDigitsAt(text, at, 3)
if end == at {
return -1
}
whole := LumiDigitsValue(text[at:end])
if end + 2 < cast(s32)text.count && text[end] == cast(u8)58 {
minute_end := LumiDigitsAt(text, end + 1, 2)
if minute_end != end + 3 {
return -1
}
part := LumiDigitsValue(text[end + 1:minute_end])
if part > 59 {
return -1
}
hours_word := LumiUnitAt(matcher, LUMI_WORD_HOURS, LumiSkipSpace(text, minute_end))
minutes.* = whole * 60 + part
unit.* = 60
return ifx hours_word > 0 then hours_word else minute_end
}
tenths: s32 = 0
if end + 1 < cast(s32)text.count && (text[end] == cast(u8)46 || text[end] == cast(u8)44) &&
text[end + 1] >= cast(u8)48 && text[end + 1] <= cast(u8)57 {
tenths = cast(s32)(text[end + 1] - cast(u8)48)
end = LumiDigitsAt(text, end + 1, 3)
}
after := LumiSkipSpace(text, end)
hours := LumiUnitAt(matcher, LUMI_WORD_HOURS, after)
minute_unit := LumiUnitAt(matcher, LUMI_WORD_MINUTES, after)
if hours > minute_unit {
minutes.* = whole * 60 + tenths * 6
unit.* = 60
return hours
}
if minute_unit > 0 && tenths == 0 {
minutes.* = whole
unit.* = 1
return minute_unit
}
return -1
}
LumiDayAt :: (matcher: *LumiMatcher, at: s32, day: *s32) -> s32 {
best: s32 = -1
for index: cast(s32)0..cast(s32)6 {
matched := LumiTaggedAt(matcher, LUMI_WORD_MON + index, at)
if matched > best {
best = matched
day.* = index
}
}
return best
}
// The ends of weekday lists at at, shortest first: "mon", "mon and wed".
LumiDays :: struct {
ends: [7]s32
masks: [7]s32
count: s32
}
LumiDaysAt :: (matcher: *LumiMatcher, at: s32) -> LumiDays {
found: LumiDays
mask: s32 = 0
position := at
while found.count < 7 {
day: s32 = 0
end := LumiDayAt(matcher, position, *day)
if end < 0 {
break
}
mask |= 1 << day
found.ends[found.count] = end
found.masks[found.count] = mask
found.count += 1
next := LumiSkipSpace(matcher.input, end)
if next < cast(s32)matcher.input.count && matcher.input[next] == cast(u8)44 {
next = LumiSkipSpace(matcher.input, next + 1)
}
joined := LumiTaggedAt(matcher, LUMI_WORD_AND, next)
if joined > 0 {
next = LumiSkipSpace(matcher.input, joined)
}
position = next
}
return found
}
// Folded equality of two phrases, ignoring how many spaces separate words.
LumiSamePhrase :: (left: string, right: string) -> bool {
return left.count > 0 && LumiPhraseAt(left, 0, right) == cast(s32)left.count
}
// A word close to a habit's word: the same, one typo, or the same stem, as
// "meditate" and "Meditation" or "медитации" and "Медитация".
LumiNearWord :: (left: string, right: string) -> bool {
if CommandEqual(left, right) || CommandTypo(left, right) {
return true
}
a: s32 = 0
b: s32 = 0
shared: s32 = 0
while a < cast(s32)left.count && b < cast(s32)right.count {
x := Decode(left, a)
y := Decode(right, b)
if LumiFoldCode(x.value) != LumiFoldCode(y.value) {
break
}
shared += 1
a = x.after
b = y.after
}
left_count := Count(left)
right_count := Count(right)
longer := ifx left_count > right_count then left_count else right_count
return shared >= 5 && shared >= longer - 3
}
// The end of a near match of the title's words at at, or -1.
LumiNearTitleAt :: (text: string, at: s32, title: string) -> s32 {
position := at
from: s32 = 0
words: s32 = 0
while from < cast(s32)title.count {
from = LumiSkipSpace(title, from)
if from >= cast(s32)title.count {
break
}
to := LumiWordEnd(title, from)
if to == from {
return -1
}
position = LumiSkipSpace(text, position)
end := LumiWordEnd(text, position)
if end == position || !LumiNearWord(text[position:end], title[from:to]) {
return -1
}
position = end
from = to
words += 1
}
return ifx words > 0 then position else -1
}
LumiHabitAllowed :: (matcher: *LumiMatcher, habit: LumiHabitRef) -> bool {
if matcher.habit_filter == LUMI_HABITS_ACTIVE {
return !habit.paused
}
if matcher.habit_filter == LUMI_HABITS_PAUSED {
return habit.paused
}
return true
}
LumiTokens :: (template: string, tokens: []LumiToken) -> s32 {
count: s32 = 0
at: s32 = 0
while at < cast(s32)template.count {
byte := template[at]
if byte == cast(u8)32 || byte == cast(u8)9 {
at += 1
continue
}
if count >= cast(s32)tokens.count {
return -1
}
if byte == cast(u8)91 || byte == cast(u8)93 {
tokens[count] = LumiToken.{.kind = ifx byte == cast(u8)91 then LUMI_TOKEN_OPEN else LUMI_TOKEN_CLOSE}
count += 1
at += 1
continue
}
if byte == cast(u8)123 {
end := at + 1
while end < cast(s32)template.count && template[end] != cast(u8)125 {
end += 1
}
if end >= cast(s32)template.count {
return -1
}
name := template[at + 1:end]
slot: s32 = 0
if name == "habit" { slot = LUMI_SLOT_HABIT }
if name == "name" { slot = LUMI_SLOT_NAME }
if name == "text" { slot = LUMI_SLOT_TEXT }
if name == "n" { slot = LUMI_SLOT_NUMBER }
if name == "time" { slot = LUMI_SLOT_TIME }
if name == "length" { slot = LUMI_SLOT_LENGTH }
if name == "days" { slot = LUMI_SLOT_DAYS }
if slot == 0 {
return -1
}
tokens[count] = LumiToken.{.kind = LUMI_TOKEN_SLOT, .slot = slot}
count += 1
at = end + 1
continue
}
end := at
while end < cast(s32)template.count && template[end] != cast(u8)32 &&
template[end] != cast(u8)91 && template[end] != cast(u8)93 && template[end] != cast(u8)123 {
end += 1
}
tokens[count] = LumiToken.{.kind = LUMI_TOKEN_WORDS, .text = template[at:end]}
count += 1
at = end
}
return count
}
LumiCloseOf :: (tokens: []LumiToken, open: s32) -> s32 {
index := open + 1
while index < cast(s32)tokens.count {
if tokens[index].kind == LUMI_TOKEN_CLOSE {
return index
}
index += 1
}
return cast(s32)tokens.count
}
// Free words from at to end: something other than spaces and punctuation.
LumiWordsBetween :: (text: string, at: s32, end: s32) -> string {
return LumiTrimText(text[at:end])
}
LumiMatchFrom :: (matcher: *LumiMatcher, tokens: []LumiToken, index: s32, at: s32,
capture: LumiCapture, out: *LumiCapture) -> bool {
matcher.budget -= 1
if matcher.budget <= 0 {
return false
}
text := matcher.input
at = LumiSkipGap(text, at)
if index >= cast(s32)tokens.count {
if LumiSkipTail(text, at) != cast(s32)text.count {
return false
}
out.* = capture
return true
}
token := tokens[index]
if token.kind == LUMI_TOKEN_OPEN {
if LumiMatchFrom(matcher, tokens, index + 1, at, capture, out) {
return true
}
return LumiMatchFrom(matcher, tokens, LumiCloseOf(tokens, index) + 1, at, capture, out)
}
if token.kind == LUMI_TOKEN_CLOSE {
return LumiMatchFrom(matcher, tokens, index + 1, at, capture, out)
}
if token.kind == LUMI_TOKEN_WORDS {
end := LumiWordsAt(text, at, token.text)
return end >= 0 && LumiMatchFrom(matcher, tokens, index + 1, end, capture, out)
}
if token.slot == LUMI_SLOT_NAME || token.slot == LUMI_SLOT_TEXT {
// The fewest words that let the rest of the template match.
end := at
while end < cast(s32)text.count {
end = Decode(text, end).after
if !LumiBoundary(text, end) {
continue
}
words := LumiWordsBetween(text, at, end)
if words.count == 0 {
continue
}
next := capture
if token.slot == LUMI_SLOT_NAME {
next.name_at = at
next.name_end = end
} else {
next.text_at = at
next.text_end = end
}
if LumiMatchFrom(matcher, tokens, index + 1, end, next, out) {
return true
}
if matcher.budget <= 0 {
return false
}
}
return false
}
if token.slot == LUMI_SLOT_NUMBER {
value: s32 = 0
end := LumiNumberAt(matcher, at, *value)
if end < 0 || capture.number_count >= 2 {
return false
}
next := capture
next.numbers[next.number_count] = value
next.number_count += 1
return LumiMatchFrom(matcher, tokens, index + 1, end, next, out)
}
if token.slot == LUMI_SLOT_TIME {
minutes: s32 = 0
end := LumiTimeAt(matcher, at, *minutes)
if end < 0 || capture.time_count >= 2 {
return false
}
next := capture
next.times[next.time_count] = minutes
next.time_count += 1
return LumiMatchFrom(matcher, tokens, index + 1, end, next, out)
}
if token.slot == LUMI_SLOT_LENGTH {
minutes: s32 = 0
unit: s32 = 0
end := LumiLengthAt(matcher, at, *minutes, *unit)
if end < 0 || minutes <= 0 || capture.length_count >= 2 {
return false
}
next := capture
next.lengths[next.length_count] = minutes
next.length_count += 1
next.length_unit = unit
return LumiMatchFrom(matcher, tokens, index + 1, end, next, out)
}
if token.slot == LUMI_SLOT_DAYS {
days := LumiDaysAt(matcher, at)
choice := days.count - 1
while choice >= 0 {
next := capture
next.days |= days.masks[choice]
if LumiMatchFrom(matcher, tokens, index + 1, days.ends[choice], next, out) {
return true
}
choice -= 1
}
return false
}
return LumiMatchHabit(matcher, tokens, index, at, capture, out)
}
// {habit}: the habits whose names match here, exact ones first and longer
// names before shorter. Several near matches of the same words are
// ambiguous; the template still matches, and the caller asks.
LumiMatchHabit :: (matcher: *LumiMatcher, tokens: []LumiToken, index: s32, at: s32,
capture: LumiCapture, out: *LumiCapture) -> bool {
text := matcher.input
ends: [LUMI_HABIT_CANDIDATES]s32
habits: [LUMI_HABIT_CANDIDATES]s32
exact: [LUMI_HABIT_CANDIDATES]bool
count: s32 = 0
for candidate: cast(s32)0..cast(s32)matcher.habits.count - 1 {
habit := matcher.habits[candidate]
if !LumiHabitAllowed(matcher, habit) || habit.title.count == 0 || count >= LUMI_HABIT_CANDIDATES {
continue
}
end := LumiPhraseAt(text, at, LumiLineTrim(habit.title))
is_exact := end >= 0
if !is_exact {
end = LumiNearTitleAt(text, at, habit.title)
}
if end >= 0 {
ends[count] = end
habits[count] = candidate
exact[count] = is_exact
count += 1
}
}
for pass: cast(s32)0..cast(s32)1 {
tried: s32 = 0
while tried < count {
// The longest remaining candidate of this pass.
best: s32 = -1
for candidate: cast(s32)0..count - 1 {
if ends[candidate] >= 0 && exact[candidate] == (pass == 0) &&
(best < 0 || ends[candidate] > ends[best]) {
best = candidate
}
}
if best < 0 {
break
}
next := capture
next.habit = habits[best]
for other: cast(s32)0..count - 1 {
if other != best && ends[other] == ends[best] && exact[other] == exact[best] {
next.habit = -2
ends[other] = -1
}
}
end := ends[best]
ends[best] = -1
if LumiMatchFrom(matcher, tokens, index + 1, end, next, out) {
return true
}
tried += 1
}
}
return false
}
// Whether a template matches the whole input, filling out.
LumiTemplateMatches :: (matcher: *LumiMatcher, template: *LumiTemplate, out: *LumiCapture) -> bool {
if template.count <= 0 {
return false
}
return LumiMatchFrom(matcher, template.tokens[:template.count], 0, 0, LumiNewCapture(), out)
}
+159 -2
View File
@@ -7,6 +7,9 @@
#import, file "../../src/core/types.zi";
#import, file "engine.zi";
#import, file "lumi_view.zi";
#import, file "habit_patterns.zi";
#import, file "habit_intent.zi";
#import, file "habit_harness.zi";
host_api :: #system_library "host_api";
ReadLumiHost :: () -> LumiMessage #foreign host_api;
@@ -24,6 +27,14 @@ ReadLumiToolsHost :: () -> LumiTools #foreign host_api;
SetLumiHabitChoiceHost :: (choosing: bool) #foreign host_api;
SetLumiDiaryChoiceHost :: (choosing: bool) #foreign host_api;
StartLumiOnlineHost :: (input: string) -> bool #foreign host_api;
LumiToolHost :: (name: string, arguments: string) -> string #foreign host_api;
ConfirmLumiDeleteHost :: (confirmed: bool) -> bool #foreign host_api;
LumiEnglishLocaleHost :: (key: string) -> string #foreign host_api;
habit_revision: s64 = -1;
habit_active: LumiCompiled;
habit_english: LumiCompiled;
habit_english_extra: bool;
habit_words: LumiReplyWords;
LumiAskHabit :: (tools: LumiTools) {
if tools.habit_count == 0 {
@@ -65,6 +76,130 @@ LumiCommandSet :: () -> LumiCommands {
return command_cache
}
// The habit templates of the app's language and of English, and the words
// of Lumi's habit answers, read again when the language changes.
LumiHabitLanguage :: () {
revision := LumiLocaleRevisionHost()
if revision == habit_revision {
return
}
habit_revision = revision
active := LumiLanguage.{.patterns = LumiLocaleHost("lumi_habit_patterns"),
.clauses = LumiLocaleHost("lumi_habit_clauses"), .words = LumiLocaleHost("lumi_habit_words")}
english := LumiLanguage.{.patterns = LumiEnglishLocaleHost("lumi_habit_patterns"),
.clauses = LumiEnglishLocaleHost("lumi_habit_clauses"),
.words = LumiEnglishLocaleHost("lumi_habit_words")}
LumiCompileLanguage(active, *habit_active)
habit_english_extra = english.patterns != active.patterns
if habit_english_extra {
LumiCompileLanguage(english, *habit_english)
}
days: [7]string = .[LumiLocaleHost("habit_day_mon"), LumiLocaleHost("habit_day_tue"),
LumiLocaleHost("habit_day_wed"), LumiLocaleHost("habit_day_thu"), LumiLocaleHost("habit_day_fri"),
LumiLocaleHost("habit_day_sat"), LumiLocaleHost("habit_day_sun")]
habit_words = LumiReplyWords.{.created = LumiLocaleHost("habit_change_created"),
.renamed = LumiLocaleHost("habit_change_name"), .paused = LumiLocaleHost("habit_change_paused"),
.resumed = LumiLocaleHost("habit_change_resumed"),
.question_added = LumiLocaleHost("habit_change_question_added"),
.question_removed = LumiLocaleHost("habit_change_question_removed"),
.every_day = LumiLocaleHost("habit_every_day"), .every_n_days = LumiLocaleHost("habit_every_n_days"),
.days = days, .reminder = LumiLocaleHost("lumi_habit_reminder"),
.no_reminder = LumiLocaleHost("lumi_habit_no_reminder"),
.check = LumiLocaleHost("habit_tracking_check"), .count = LumiLocaleHost("habit_tracking_count"),
.span = LumiLocaleHost("habit_tracking_span"), .yes = LumiLocaleHost("habit_answer_yes"),
.no = LumiLocaleHost("habit_answer_no"), .longer = LumiLocaleHost("habit_span_goal_longer"),
.shorter = LumiLocaleHost("habit_span_goal_shorter"),
.later_than_average = LumiLocaleHost("habit_goal_later_than_average"),
.above_average = LumiLocaleHost("habit_goal_above_average"),
.earlier_than_average = LumiLocaleHost("habit_goal_earlier_than_average"),
.below_average = LumiLocaleHost("habit_goal_below_average"),
.after = LumiLocaleHost("habit_goal_after"), .at_least = LumiLocaleHost("habit_goal_at_least"),
.before = LumiLocaleHost("habit_goal_before"), .at_most = LumiLocaleHost("habit_goal_at_most"),
.between = LumiLocaleHost("habit_goal_between"), .and_word = LumiLocaleHost("habit_goal_and")}
}
// English, or the active language itself when it is English.
LumiEnglishCompiled :: () -> *LumiCompiled {
return ifx habit_english_extra then *habit_english else *habit_active
}
// Answers a habit request on the device with the same app tools the online
// model uses. False leaves the message to the rest of Lumi: other
// commands, the model online, or the offline answer.
LumiHabitRespond :: (input: string, tools: LumiTools) -> bool {
if (tools.available_apps & LUMI_HABITS) == 0 {
return false
}
LumiHabitLanguage()
habits: [LUMI_HABITS_MAX]LumiHabitRef
count: s32 = 0
for index: cast(s32)0..tools.habit_count - 1 {
if count >= LUMI_HABITS_MAX {
break
}
habit := ReadLumiHabitHost(index)
if habit.id.count > 0 && habit.title.count > 0 {
habits[count] = LumiHabitRef.{.id = habit.id, .title = habit.title}
count += 1
}
}
count = LumiPausedHabits(LumiToolHost("read_context", "{}"), habits[:], count)
known := habits[:count]
plan := LumiHabitParseCompiled(input, *habit_active, LumiEnglishCompiled(), known)
if plan.kind == 0 {
return false
}
if plan.habit == -2 {
AppendLumiChatHost(LumiLocaleHost("lumi_ambiguous"), false)
return true
}
title := plan.name
if plan.habit >= 0 {
title = known[plan.habit].title
}
if plan.kind == LUMI_HABIT_EXISTS {
values: [1]string = .[title]
AppendLumiChatHost(LumiFill(LumiLocaleHost("lumi_habit_exists"), values[:]), false)
return true
}
questions := "[]"
if (plan.kind == LUMI_HABIT_ASK || plan.kind == LUMI_HABIT_UNASK) && plan.habit >= 0 {
questions = LumiQuestionsOf(LumiToolHost("read_habit", LumiIdArguments(known[plan.habit].id)))
if questions.count == 0 {
return false
}
}
calls: [LUMI_CALLS_MAX]LumiToolCall
total := LumiHabitCalls(plan, known, questions, calls[:])
if total <= 0 {
return false
}
created := ""
for index: cast(s32)0..total - 1 {
arguments := calls[index].arguments
if created.count > 0 {
arguments = LumiReplaceNew(arguments, created)
}
result := LumiToolHost(calls[index].name, arguments)
if !LumiToolOk(result) {
values: [1]string = .[title]
AppendLumiChatHost(LumiFill(LumiLocaleHost("lumi_habit_failed"), values[:]), false)
return true
}
if calls[index].name == "create_habit" {
created = LumiToolText(result, "id")
title = LumiToolText(result, "title")
}
if calls[index].name == "delete_habit" {
// The host asked in the chat whether to delete; the next
// message answers.
return true
}
}
AppendLumiChatHost(LumiHabitReply(habit_words, plan, title), false)
return true
}
LumiRespond :: (input: string) {
input = LumiTrim(input)
if input.count == 0 || input.count >= LUMI_INPUT_MAX {
@@ -72,6 +207,20 @@ LumiRespond :: (input: string) {
}
AppendLumiChatHost(input, true)
tools := ReadLumiToolsHost()
if tools.confirming_delete {
// Lumi asked whether to delete a habit: yes deletes, no keeps it,
// and anything else keeps it and is read as a new request.
LumiHabitLanguage()
answer := LumiYesNo(input, *habit_active, LumiEnglishCompiled())
unused ConfirmLumiDeleteHost(answer == 1)
if answer == 1 {
return
}
if answer == 2 {
AppendLumiChatHost(LumiLocaleHost("lumi_cancelled"), false)
return
}
}
help_requested := LumiEqual(input, "help") || LumiEqual(input, "/help") || LumiEqual(input, "how can you help?")
if (tools.choosing_diary || tools.choosing_habit) &&
(LumiEqual(input, "/cancel") || LumiEqual(input, "cancel") || LumiEqual(input, LumiLocaleHost("cancel_button"))) {
@@ -80,12 +229,18 @@ LumiRespond :: (input: string) {
AppendLumiChatHost(LumiLocaleHost("lumi_cancelled"), false)
return
}
action := LumiIntent(input, LumiCommandSet())
action := LumiIntentWith(input, LumiCommandSet(), false)
if tools.choosing_diary && !help_requested {
action = LumiAction.{.kind = LUMI_WRITE_DIARY, .title = input}
} else if action.kind == 0 && tools.choosing_habit && !help_requested {
action = LumiAction.{.kind = LUMI_COMPLETE_HABIT, .title = input}
}
if action.kind == 0 && !help_requested && !tools.choosing_diary && !tools.choosing_habit {
if LumiHabitRespond(input, tools) {
return
}
action = LumiIntent(input, LumiCommandSet())
}
reply := ifx help_requested then "lumi_help" else "lumi_unknown"
if action.kind != 0 && !LumiActionAvailable(action, tools.available_apps) {
action.kind = 0
@@ -163,7 +318,9 @@ LumiRespond :: (input: string) {
reply = "lumi_unavailable"
}
}
if action.kind == 0 && !help_requested && StartLumiOnlineHost(input) {
// Only what Lumi couldn't understand goes online; a request it read
// but couldn't carry out gets its own answer here.
if action.kind == 0 && reply == "lumi_unknown" && StartLumiOnlineHost(input) {
return
}
if reply == "lumi_help" {
+143 -7
View File
@@ -19,17 +19,24 @@
#import "press_widget"
#import "scroll_props"
#import "scroll_widget"
#import "title_bar_props"
#import "title_bar_widget"
#import "dropdown_props"
#import "tree"
#import "text"
#import "byte_text_linux"
#import "c_string"
#import "vec"
#import "math"
#import, file "../../src/cells/lumi_types.zi";
#import, file "../../src/cells/lumi_ui_types.zi";
#import, file "../../src/cells/lumi_chart.zi";
#import, file "command_text.zi";
#import, file "engine.zi";
#import, file "message_text.zi";
ConnectedIcon :: #import "mingcute/mingcute_regular_wifi";
DisconnectedIcon :: #import "mingcute/mingcute_regular_wifi_off";
ConfigureIcon :: #import "mingcute/mingcute_regular_tool";
using ImageFit;
using TextWrap;
@@ -50,7 +57,15 @@ LumiFirstVisibleRowHost :: (scroll: s32) -> s32 #foreign host_api;
LumiRowOffsetHost :: (index: s32) -> s32 #foreign host_api;
ReadLumiDonationHost :: (coin: s32) -> LumiDonation #foreign host_api;
LumiDonationActionHost :: (coin: s32, action: s32) -> bool #foreign host_api;
SetLumiOnlineHost :: (online: bool) -> s32 #foreign host_api;
LumiAgreementHost :: (choice: s32) -> bool #foreign host_api;
SmoothFramesHost :: (frames: s32) -> bool #foreign host_api;
OpenLumiSettingsHost :: () -> bool #foreign host_api;
frame: LumiUiFrame;
// The terms panel's scroll and its formatted text.
agreement_scroll: s32;
agreement_bytes: [8192]u8;
agreement_strong: [32]TextRange;
chart_selected_key: u64;
chart_selected_point: s32;
donation_notice: string;
@@ -230,7 +245,7 @@ SelectedText :: () -> string {
SelectionBar :: (x: s32, top: s32, width: s32) {
control := Scale(44)
Box(frame.session, BoxProps.{.key = cast(u64)300369,
.bounds = Bounds(x - Scale(16), 0, width + Scale(32), top + control + Scale(8)),
.bounds = Bounds(0, 0, frame.width, top + control + Scale(8)),
.fill = frame.background})
if confirm_delete {
Text(frame.session, TextProps.{.key = cast(u64)300370,
@@ -559,6 +574,39 @@ TypingDots :: (x: s32, top: s32) {
}
}
// Tapped, Lumi swirls twice around her place beside her message, for fun:
// the loops widen and settle back where she sits.
LUMI_SWIRL_SECONDS :: 1.2
swirl_row: s32 = -1;
swirl_started: float64;
LumiAvatar :: (index: s32, x: s32, y: s32) {
bounds := Bounds(x, y, Scale(40), Scale(40))
if swirl_row == index {
t := (frame.now - swirl_started) / LUMI_SWIRL_SECONDS
if t < 0.0 || t >= 1.0 {
swirl_row = -1
} else {
eased := t * t * (3.0 - 2.0 * t)
angle := cast(float32)(eased * 720.0)
radius := cast(float32)Scale(14) * SineDegrees(cast(float32)(t * 180.0))
bounds.x += radius * SineDegrees(angle)
bounds.y -= radius - radius * CosineDegrees(angle)
}
}
Image(frame.session, ImageProps.{.key = cast(u64)(300400 + index * 4),
.asset_path = "assets/lumi/mascot.png", .alt_text = "Lumi",
.bounds = bounds, .source = Rectangle.{0.0, 0.0, -1254.0, 1254.0},
.fit = cast(ImageFit)ImageFitContain})
press := Press(frame.session, PressProps.{.key = cast(u64)(430000 + RowSlot(index) + 1),
.bounds = Bounds(x, y, Scale(40), Scale(40)), .label = "Lumi", .now = frame.now})
if press.clicked {
swirl_row = index
swirl_started = frame.now
unused SmoothFramesHost(80)
}
}
// A row's press: a hold starts selecting, and while selecting a press starts
// a sweep that follows the pointer, even off the row and past the chat.
RowPress :: (index: s32, bounds: Rectangle, content_y: float32) {
@@ -582,8 +630,98 @@ RowPress :: (index: s32, bounds: Rectangle, content_y: float32) {
}
}
// Lumi's title bar: its name, a connection button that switches between
// offline and online, and a wrench that opens Lumi's settings. Returns the
// bar's height.
LumiTitleBar :: () -> s32 {
height := Scale(52)
button := Scale(40)
gap := Scale(4)
trailing := ifx frame.connection then 2 * button + gap else 0
options: [1]DropdownOption
bar := TitleBar(frame.session, TitleBarProps.{.key = cast(u64)300400, .title = "Lumi",
.bounds = Bounds(0, 0, frame.width, height), .height = height, .scale = frame.scale,
.trailing_width = trailing}, options[0:0])
if !frame.connection || bar.trailing_bounds.width <= 0.0 {
return height
}
area := bar.trailing_bounds
top := area.y + (area.height - cast(float32)button) / 2.0
size := cast(float32)button
// Its label says whether Lumi is online now.
state := ifx frame.online then "lumi_toggle_online" else "lumi_toggle_offline"
if Button(frame.session, ButtonProps.{.key = cast(u64)300401, .id = 30040,
.bounds = Rectangle.{area.x + area.width - 2.0 * size - cast(float32)gap, top, size, size},
.label = LumiViewLocaleHost(state), .selected = frame.online,
.icon_shape = ifx frame.online then ConnectedIcon.Shape else DisconnectedIcon.Shape,
.icon_only = true, .tone = cast(ButtonTone)ButtonToneNeutral,
.emphasis = cast(ButtonEmphasis)ButtonEmphasisGhost}) != 0 {
// Going online without the agreement opens the terms instead.
unused SetLumiOnlineHost(!frame.online)
}
if Button(frame.session, ButtonProps.{.key = cast(u64)300390, .id = 30043,
.bounds = Rectangle.{area.x + area.width - size, top, size, size},
.label = LumiViewLocaleHost("settings_title"), .icon_shape = ConfigureIcon.Shape,
.icon_only = true, .tone = cast(ButtonTone)ButtonToneNeutral,
.emphasis = cast(ButtonEmphasis)ButtonEmphasisGhost}) != 0 {
unused OpenLumiSettingsHost()
}
return height
}
// The terms Lumi asks to agree to before going online, or shows again from
// Settings with a way to withdraw.
LumiAgreementView :: (top: s32) {
column := CenteredColumnFor(frame.width, Scale(720), Scale(16))
buttons_top := frame.height - frame.bottom - Scale(16) - Scale(48)
area_height := buttons_top - Scale(12) - top
if area_height < Scale(60) {
area_height = Scale(60)
}
counts := LumiFormatInto(frame.agreement_text, true, agreement_bytes[:], agreement_strong[:])
panel := Scroll(frame.session, ScrollProps.{.key = cast(u64)300410,
.bounds = Bounds(column.x, top, column.width, area_height),
.content_height = frame.agreement_height, .scroll_offset = agreement_scroll,
.scale = frame.scale})
agreement_scroll = panel.scroll_offset
if panel.opened {
// The host measured the terms at this width, clear of the scroll bar.
Text(frame.session, TextProps.{.key = cast(u64)300411,
.bounds = Rectangle.{panel.content.x, panel.content.y,
cast(float32)(column.width - Scale(24)), cast(float32)frame.agreement_height},
.text = TextFromBytes(agreement_bytes[:counts.count]), .font = frame.font,
.strong = agreement_strong[:counts.strong_count], .wrap = cast(TextWrap)TextWrapAuto})
unused End(frame.session)
}
reading := frame.agreement == 2
half := (column.width - Scale(12)) / 2
first := ifx reading then "lumi_agreement_withdraw" else "lumi_agreement_agree"
second := ifx reading then "close_button" else "lumi_agreement_later"
if Button(frame.session, ButtonProps.{.id = 30041,
.bounds = Bounds(column.x, buttons_top, half, Scale(48)),
.label = LumiViewLocaleHost(first),
.tone = cast(ButtonTone)(ifx reading then ButtonToneDanger else ButtonToneAccent),
.emphasis = cast(ButtonEmphasis)(ifx reading then ButtonEmphasisSoft else ButtonEmphasisFilled)}) != 0 {
agreement_scroll = 0
unused LumiAgreementHost(ifx reading then 3 else 1)
}
if Button(frame.session, ButtonProps.{.id = 30042,
.bounds = Bounds(column.x + half + Scale(12), buttons_top, half, Scale(48)),
.label = LumiViewLocaleHost(second), .tone = cast(ButtonTone)ButtonToneNeutral,
.emphasis = cast(ButtonEmphasis)ButtonEmphasisSoft}) != 0 {
agreement_scroll = 0
unused LumiAgreementHost(ifx reading then 4 else 2)
}
}
LumiView :: (message: LumiMessage, commands: LumiCommands, revision: s64) -> LumiMessage {
frame = ReadLumiUiHost()
title_height := LumiTitleBar()
if frame.agreement != 0 {
LumiAgreementView(title_height + Scale(8))
WriteLumiUiHost(frame)
return message
}
column := CenteredColumnFor(frame.width, Scale(720), Scale(16))
x := column.x
width := column.width
@@ -597,7 +735,7 @@ LumiView :: (message: LumiMessage, commands: LumiCommands, revision: s64) -> Lum
}
footer := frame.height - frame.bottom - Scale(16) - input_height
suggestions_top := footer - Scale(ifx LumiTrim(frame.value).count > 0 then 46 else 0)
history_top := Scale(12)
history_top := title_height + Scale(8)
menu := MenuCommands(revision)
menu_matches: [LUMI_MENU_COMMANDS]s32
menu_count: s32 = 0
@@ -682,11 +820,7 @@ LumiView :: (message: LumiMessage, commands: LumiCommands, revision: s64) -> Lum
SelectionSet(index, toggled.checked)
}
} else if !row.user {
Image(frame.session, ImageProps.{.key = cast(u64)(300400 + index * 4),
.asset_path = "assets/lumi/mascot.png", .alt_text = "Lumi",
.bounds = Bounds(x, top + row_height - Scale(54), Scale(40), Scale(40)),
.source = Rectangle.{0.0, 0.0, -1254.0, 1254.0},
.fit = cast(ImageFit)ImageFitContain})
LumiAvatar(index, x, top + row_height - Scale(54))
}
Box(frame.session, BoxProps.{.key = cast(u64)(300401 + index * 4),
.bounds = Bounds(left, top, bubble_width, row_height - Scale(10)),
@@ -777,6 +911,8 @@ LumiView :: (message: LumiMessage, commands: LumiCommands, revision: s64) -> Lum
}
if selecting {
SelectionBar(x, Scale(12), width)
// Like Telegram, the selection bar covers the title bar while
// messages are selected.
}
typed := LumiTrim(frame.value)
candidates: [20]string = .[commands.start_whm, commands.complete_habit,
+24 -8
View File
@@ -51,27 +51,35 @@ LumiTextClosing :: (value: string, at: s32) -> s32 {
return -1
}
LumiFormatMessage :: (value: string, formatted: bool) -> LumiMessageText {
result: LumiMessageText
LumiFormatCounts :: struct {
count: s32
strong_count: s32
}
// Formats into caller buffers, for text longer than a chat message such
// as Lumi's online terms. Bytes that do not fit are left out.
LumiFormatInto :: (value: string, formatted: bool, bytes: []u8, strong: []TextRange) -> LumiFormatCounts {
result: LumiFormatCounts
limit := cast(s32)bytes.count - 1
at: s32 = 0
code: bool
while at < value.count && result.count < LUMI_INPUT_MAX - 1 {
while at < value.count && result.count < limit {
byte := value[at]
if formatted && byte == cast(u8)96 && !LumiTextEscaped(value, at) {
code = !code
}
if formatted && !code && LumiTextMarker(value, at) && result.strong_count < 256 {
if formatted && !code && LumiTextMarker(value, at) && result.strong_count < cast(s32)strong.count {
end := LumiTextClosing(value, at)
if end >= 0 {
range := TextRange.{.start = result.count}
at += 2
while at < end && result.count < LUMI_INPUT_MAX - 1 {
result.bytes[result.count] = value[at]
while at < end && result.count < limit {
bytes[result.count] = value[at]
result.count += 1
at += 1
}
range.end = result.count
result.strong[result.strong_count] = range
strong[result.strong_count] = range
result.strong_count += 1
at = end + 2
continue
@@ -82,9 +90,17 @@ LumiFormatMessage :: (value: string, formatted: bool) -> LumiMessageText {
at += 1
byte = value[at]
}
result.bytes[result.count] = byte
bytes[result.count] = byte
result.count += 1
at += 1
}
return result
}
LumiFormatMessage :: (value: string, formatted: bool) -> LumiMessageText {
result: LumiMessageText
counts := LumiFormatInto(value, formatted, result.bytes[:], result.strong[:])
result.count = counts.count
result.strong_count = counts.strong_count
return result
}
+5
View File
@@ -1,5 +1,10 @@
# Changelog
## [1.1.5] - 2026-10-13
- Maintenance release for Inner Breeze 2.1.33.
- Requires Inner Breeze 2.1.28 or later.
## [1.1.4] - 2026-10-10
- Requires Inner Breeze 2.1.28 or later.
+25 -25
View File
@@ -1,54 +1,54 @@
{
"host_api": 7,
"host_api": 8,
"oldest_host_api": 5,
"module_api": 2,
"apps": {
"inbe": {
"id": "inbe",
"version": "2.1.29",
"sequence": 26,
"version": "2.1.30",
"sequence": 27,
"bundled": true,
"host_api": 7
"host_api": 8
},
"habits": {
"id": "inbe.habits",
"version": "1.0.4",
"sequence": 5,
"bundled": true,
"host_api": 5
},
"practices": {
"id": "inbe.practices",
"version": "1.1.4",
"sequence": 6,
"bundled": true,
"host_api": 5
},
"lists": {
"id": "inbe.lists",
"version": "1.0.5",
"sequence": 6,
"bundled": true,
"host_api": 5
},
"practices": {
"id": "inbe.practices",
"version": "1.1.5",
"sequence": 7,
"bundled": true,
"host_api": 5
},
"lists": {
"id": "inbe.lists",
"version": "1.0.6",
"sequence": 7,
"bundled": true,
"host_api": 5
},
"diary": {
"id": "inbe.diary",
"version": "1.1.9",
"sequence": 11,
"version": "1.1.10",
"sequence": 12,
"bundled": true,
"host_api": 7
},
"lumi": {
"id": "inbe.lumi",
"version": "1.3.9",
"sequence": 16,
"version": "1.4.0",
"sequence": 17,
"bundled": true,
"host_api": 7
"host_api": 8
},
"leaderboard": {
"id": "inbe.leaderboard",
"version": "1.0.1",
"sequence": 2,
"version": "1.0.2",
"sequence": 3,
"bundled": true,
"host_api": 5
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 168 KiB

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loaded 100 of 813 files, more files were not shown because too many files have changed in this diff. Show more