Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9d38ed4111 | ||
|
|
9ccdf55f1e | ||
|
|
f428bd1d60 | ||
|
|
70ea8d02ab | ||
|
|
ad401376ef | ||
|
|
6f24fc5099 | ||
|
|
c3f312d63d | ||
|
|
886152ddf6 | ||
|
|
1881d3fdcd | ||
|
|
39fc01dbe6 | ||
|
|
9039dabef1 | ||
|
|
2b072674e5 | ||
|
|
2128cd310d | ||
|
|
e03f548923 | ||
|
|
bc97010372 | ||
|
|
b151dfc2cc | ||
|
|
94c7f0da20 | ||
|
|
13ea94d18d | ||
|
|
aa427a6772 | ||
|
|
2e4924726f | ||
|
|
70fd19bd06 | ||
|
|
9c57c99591 | ||
|
|
01e0a4b341 | ||
|
|
6fc41dd50f | ||
|
|
0e74f0b5e0 | ||
|
|
b66c054b3f | ||
|
|
4e1b7dc586 | ||
|
|
1fabf1e49c | ||
|
|
6ed02bca7d | ||
|
|
bfbaa1bb73 | ||
|
|
1603c58b1b | ||
|
|
216d56bf29 | ||
|
|
caad34ba05 | ||
|
|
58db559a7d | ||
|
|
fafc8bedb2 | ||
|
|
63d556914c | ||
|
|
77c920e0c7 | ||
|
|
efd5fc2dcd | ||
|
|
bfae215a20 | ||
|
|
d08f3efc44 | ||
|
|
57c6bc1b9a | ||
|
|
66e45bf882 | ||
|
|
e5da57ef3f | ||
|
|
4e55fd44f1 | ||
|
|
bfea2cca93 | ||
|
|
1bb872d4c6 | ||
|
|
53c9c090a8 | ||
|
|
73373344b8 | ||
|
|
27287d967d | ||
|
|
3b13f3d407 | ||
|
|
9f42816441 | ||
|
|
6fd1dbbb27 | ||
|
|
466b5614d3 | ||
|
|
54c3fce061 | ||
|
|
4615f6d558 | ||
|
|
42965e39cd | ||
|
|
88a81baf27 | ||
|
|
f45362ef1b | ||
|
|
d9b20cc05c | ||
|
|
d468bbd351 | ||
|
|
02a3ed19eb | ||
|
|
ae88371737 | ||
|
|
9d985b69d1 | ||
|
|
2f7802661a | ||
|
|
bd08f39532 | ||
|
|
ab99d83b7a | ||
|
|
ad02c7d1cf | ||
|
|
af64e57a1d | ||
|
|
3efed6e1f4 | ||
|
|
02c8c3793b | ||
|
|
baab6abf7a | ||
|
|
c79a92725e | ||
|
|
7c490d8fdf | ||
|
|
556bdd3552 | ||
|
|
c7ed67e2dc | ||
|
|
f4fac28598 | ||
|
|
125484d157 | ||
|
|
e2b0b260d4 | ||
|
|
08eb898ee3 | ||
|
|
aa36952508 | ||
|
|
028b2db469 | ||
|
|
3c43b92209 | ||
|
|
0a92b02cdf | ||
|
|
ef652f8179 | ||
|
|
09702e144d | ||
|
|
f6e340b2b7 | ||
|
|
b6a7743aca | ||
|
|
1d1eb49946 | ||
|
|
7a81e00d5e | ||
|
|
e83dae0e70 | ||
|
|
c473e276cd | ||
|
|
a18e6bf419 | ||
|
|
7d65025806 | ||
|
|
1eb5fd3de2 | ||
|
|
ccbad38a60 | ||
|
|
4097ce5d79 | ||
|
|
4b77d513a1 | ||
|
|
a733f87cba | ||
|
|
d0993d71ad | ||
|
|
b5f4ebfa16 | ||
|
|
f1dc2a1dff | ||
|
|
7d18f5089d | ||
|
|
900850f1a9 | ||
|
|
d30e918704 | ||
|
|
736882b1bd | ||
|
|
7a6b8207e1 | ||
|
|
1dab289a8f | ||
|
|
11324d6ece | ||
|
|
3818deacec | ||
|
|
2325a89629 | ||
|
|
d23b515003 | ||
|
|
5b43aa3c3d | ||
|
|
0b8aadc911 | ||
|
|
63bd330b81 | ||
|
|
af81a9a23a | ||
|
|
b6f405010e | ||
|
|
7ad56a3d3e | ||
|
|
f11c8b1174 | ||
|
|
860cc9af13 | ||
|
|
11b013134c | ||
|
|
269a277103 | ||
|
|
01522177f3 | ||
|
|
76fdecaccd | ||
|
|
5595bd70df | ||
|
|
7260d62662 | ||
|
|
a6473d2adf | ||
|
|
d631050d0d | ||
|
|
5d4ab56ed8 | ||
|
|
7b9f01b870 | ||
|
|
690c0db1bb | ||
|
|
019de0a0d6 | ||
|
|
3c11971227 | ||
|
|
af43d15d63 | ||
|
|
75e5d449b3 | ||
|
|
e58d9194a5 | ||
|
|
a84907925a | ||
|
|
12380d75ab | ||
|
|
43cd7f3908 | ||
|
|
7389a549cd | ||
|
|
17c9564fbd | ||
|
|
398c87020b | ||
|
|
35577f8fa6 | ||
|
|
4ef4081b52 | ||
|
|
3c08c08edc | ||
|
|
419899fd3b | ||
|
|
d3154ea5a0 | ||
|
|
782ad3d24a | ||
|
|
fdf38893ea | ||
|
|
bfd50cdf62 | ||
|
|
e277757410 | ||
|
|
268888ff95 | ||
|
|
17fbd99469 | ||
|
|
e09048a3b3 | ||
|
|
2d1759f560 | ||
|
|
ed470b98fe | ||
|
|
43ae482eb3 | ||
|
|
1ef26f4d79 | ||
|
|
7b5e324779 | ||
|
|
55db65df1d | ||
|
|
7216521a43 | ||
|
|
841b7e9bfc | ||
|
|
a78d30c778 | ||
|
|
31456658f2 | ||
|
|
81ff4593ae | ||
|
|
4fe2486539 | ||
|
|
278b115944 | ||
|
|
b86a904a0a | ||
|
|
1f8fd4b8d0 | ||
|
|
fbbe884b27 | ||
|
|
7fa42e6785 | ||
|
|
a128a47328 | ||
|
|
09d066216a | ||
|
|
4b6a2def2d | ||
|
|
47952f78e5 | ||
|
|
31b0f8a4bf | ||
|
|
4ebbf0d691 | ||
|
|
163a0e5e88 | ||
|
|
0be7d77a49 | ||
|
|
e6ad9d0991 | ||
|
|
c908342167 | ||
|
|
1f094bf922 | ||
|
|
bed1b70504 | ||
|
|
7bc8c17c0a | ||
|
|
99833a0b8c | ||
|
|
18e79b36fd |
No files matched your search
@@ -134,10 +134,12 @@ 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/
|
||||
build/leaderboard-ui-test/
|
||||
build/practice-images-ui-test/
|
||||
retention-days: 7
|
||||
|
||||
- name: Check out sync test server
|
||||
|
||||
@@ -40,7 +40,9 @@ jobs:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: ./.github/actions/ziran-packages
|
||||
- name: Install signing and test dependencies
|
||||
run: sudo apt-get update && sudo apt-get install -y python3-cryptography python3-fonttools
|
||||
run: |
|
||||
sudo apt-get update && sudo apt-get install -y python3-cryptography python3-fonttools
|
||||
.github/scripts/install-apt-packages.sh .github/apt/test-packages.txt
|
||||
- name: Build independent packages and check signatures
|
||||
run: |
|
||||
make package-version-test
|
||||
@@ -49,6 +51,8 @@ jobs:
|
||||
make package-upload-test
|
||||
make cells build-laws
|
||||
python3 tests/package_release_test.py
|
||||
- name: Run new packages in the last released app
|
||||
run: python3 tests/package_compat_test.py --skip-forward
|
||||
- name: Configure publisher
|
||||
id: publisher
|
||||
env:
|
||||
|
||||
@@ -100,6 +100,9 @@ jobs:
|
||||
- name: Require Visual Tests
|
||||
run: make visual-test
|
||||
|
||||
- name: Run Packages Across App Versions
|
||||
run: make package-compat-test
|
||||
|
||||
- name: Save Visual Test Evidence
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v4
|
||||
@@ -119,10 +122,12 @@ 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/
|
||||
build/leaderboard-ui-test/
|
||||
build/practice-images-ui-test/
|
||||
retention-days: 7
|
||||
|
||||
build-web:
|
||||
@@ -351,7 +356,7 @@ jobs:
|
||||
- name: Build Linux AppImage
|
||||
env:
|
||||
APPIMAGE_EXTRACT_AND_RUN: "1"
|
||||
RAY_RAYLIB_CONFIG: -DSUPPORT_SCREEN_CAPTURE=0 -DSUPPORT_COMPRESSION_API=0 -DSUPPORT_AUTOMATION_EVENTS=0 -DSUPPORT_CLIPBOARD_IMAGE=0 -DSUPPORT_FILEFORMAT_BMP=0 -DSUPPORT_FILEFORMAT_GIF=0 -DSUPPORT_FILEFORMAT_QOI=0 -DSUPPORT_FILEFORMAT_DDS=0 -DSUPPORT_FILEFORMAT_TTF=0
|
||||
RAY_RAYLIB_CONFIG: -DSUPPORT_SCREEN_CAPTURE=0 -DSUPPORT_COMPRESSION_API=0 -DSUPPORT_AUTOMATION_EVENTS=0 -DSUPPORT_CLIPBOARD_IMAGE=0 -DSUPPORT_FILEFORMAT_BMP=0 -DSUPPORT_FILEFORMAT_GIF=0 -DSUPPORT_FILEFORMAT_QOI=0 -DSUPPORT_FILEFORMAT_DDS=0 -DSUPPORT_FILEFORMAT_TTF=1
|
||||
run: |
|
||||
set -euo pipefail
|
||||
RAY_SDL_INCLUDE_DIR="$(pkg-config --variable=includedir sdl2 | sed 's,/SDL2$,,')"
|
||||
@@ -381,6 +386,13 @@ jobs:
|
||||
app_pid=$!
|
||||
for _ in $(seq 1 30); do
|
||||
if xwininfo -tree -root | grep -q 'Inner Breeze'; then
|
||||
sleep 3
|
||||
# A build without TrueType support draws a pixel font.
|
||||
if grep -q 'Font is not supported' /tmp/inbe-appimage.log; then
|
||||
echo "AppImage could not load its fonts"
|
||||
cat /tmp/inbe-appimage.log || true
|
||||
exit 1
|
||||
fi
|
||||
exit 0
|
||||
fi
|
||||
if ! kill -0 "$app_pid" >/dev/null 2>&1; then
|
||||
@@ -796,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
|
||||
@@ -814,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
|
||||
@@ -887,6 +908,16 @@ jobs:
|
||||
done < <(scripts/list-expected-release-assets.sh "$VERSION")
|
||||
exit "$missing"
|
||||
|
||||
- name: Require a Passing Phone Check for a New Version
|
||||
run: |
|
||||
set -euo pipefail
|
||||
VERSION=$(python3 scripts/check-version.py --print-version)
|
||||
if git rev-parse "v$VERSION" >/dev/null 2>&1; then
|
||||
echo "v$VERSION is already tagged; no new version to check"
|
||||
exit 0
|
||||
fi
|
||||
python3 scripts/check-phone-check.py "$VERSION"
|
||||
|
||||
- name: Create and Push Tag If Version Is New
|
||||
id: tag_version
|
||||
env:
|
||||
@@ -960,6 +991,17 @@ jobs:
|
||||
arch="${arch%.rpm}"
|
||||
channels+=("--channel" "rpm-$arch=$rpm")
|
||||
done
|
||||
# Directly installed APKs update themselves from these channels;
|
||||
# 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|-fdroid) continue ;;
|
||||
"") channels+=("--channel" "android=$apk") ;;
|
||||
*) channels+=("--channel" "android$abi=$apk") ;;
|
||||
esac
|
||||
done < <(find build/release -maxdepth 2 -name "inbe-$VERSION*.apk" | sort)
|
||||
if [ ${#channels[@]} -eq 0 ]; then
|
||||
echo "no release artifacts found for the appcast"
|
||||
exit 1
|
||||
|
||||
@@ -13,6 +13,25 @@
|
||||
The canonical macros are `APP_VERSION_STRING`, `APP_VERSION_MAJOR`,
|
||||
`APP_VERSION_MINOR`, and `APP_VERSION_PATCH`; do not create aliases.
|
||||
Only the GitHub Actions release workflow creates or pushes release tags.
|
||||
- A new version publishes only with a passing phone check of its exact
|
||||
sources: build the APK from the committed release, run
|
||||
`make phone-check APK=...` with the development Moto connected through the
|
||||
ThinkPad, and commit `releases/phone-checks/VERSION.json`. Changes to app
|
||||
sources after the check require a new one.
|
||||
- Packages declare the oldest host interface they run on (`host_api` per app
|
||||
in `apps/versions.json`); the host runs `oldest_host_api` to `host_api`.
|
||||
Raise `host_api` when the host interface changes and `oldest_host_api` only
|
||||
when it can no longer run older packages. `make package-compat-test` runs
|
||||
the node's packages in this build and new packages in the last release.
|
||||
- Goal (owner, 2026-10-11): every app updates through its own package
|
||||
without a new APK. Work toward it in small steps alongside requested work;
|
||||
discuss larger moves with the owner first. Put app screens, rules and text
|
||||
in `apps/<app>/`, not in the host under `src/`. Habits and Practices still
|
||||
draw compiled host screens (see [docs/cells.md](docs/cells.md)); when work
|
||||
touches one, prefer moving it into its package. Keep the host interface
|
||||
small and generic (storage, network, locale, platform effects), because
|
||||
each new host call needs an APK before a package can use it. Apps share
|
||||
data only through the host interface, never another app's internals.
|
||||
- Translate changed strings in every affected locale; no English placeholders.
|
||||
- `make locale-translated-test` fails on any locale string that still equals
|
||||
its English text. Translate it; add it to `tests/locale_same_as_english.txt`
|
||||
|
||||
@@ -1,4 +1,82 @@
|
||||
# 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.
|
||||
- With a menu open, tapping the navigation closes it and switches screens in one tap.
|
||||
- Menus stay above the navigation instead of hiding their last options behind it.
|
||||
- Web: the app is sharp on high-density screens instead of magnified and blurry.
|
||||
### Changed
|
||||
- Icons are sharper on the web.
|
||||
|
||||
## [2.1.29] - 2026-10-11
|
||||
### Fixed
|
||||
- Scrolling Lumi's commands keeps the keyboard open.
|
||||
- New habits show each colour choice in its own colour.
|
||||
- Leaving Wim Hof no longer freezes the app for a few seconds.
|
||||
- The app no longer freezes just after launch while it checks for app updates.
|
||||
### Changed
|
||||
- Scrollbars use your theme's colours and show how much is in view.
|
||||
- Apps rearranges to fill the window's width.
|
||||
|
||||
## [2.1.28] - 2026-10-10
|
||||
### Added
|
||||
- Connect a phone and a computer by QR code in Profile.
|
||||
- Leaderboard is its own app.
|
||||
- Profile > Data shows each sync node's storage.
|
||||
### Changed
|
||||
- Profile holds your account, data and Telegram; Settings holds device preferences.
|
||||
- Diary shows bold text as bold.
|
||||
- On desktop, a minimized practice opens in its own window.
|
||||
### Fixed
|
||||
- Linux: text uses Inner Breeze's fonts again.
|
||||
- Smoother minimized breathing count.
|
||||
- The desktop close prompt shows above Apps.
|
||||
|
||||
## [2.1.27] - 2026-10-10
|
||||
### Added
|
||||
- End a held breath from the minimized practice window with Breath or a double tap.
|
||||
- Lumi feedback includes the app version, device and system.
|
||||
### Fixed
|
||||
- Picture-in-picture opens when you leave Inbe during a practice and returns to it.
|
||||
- Lumi keeps answers that arrive during picture-in-picture.
|
||||
- Lumi says whether feedback reached the developer and keeps it to retry.
|
||||
- Feedback saved by older versions is now sent.
|
||||
- Fix a startup crash on 32-bit Android phones.
|
||||
|
||||
## [2.1.26] - 2026-10-09
|
||||
### Added
|
||||
- Detach a running practice into its own resizable desktop window.
|
||||
|
||||
@@ -393,14 +393,22 @@ IMAGE_FILES += assets/app/icon-sky-cradle.png assets/app/icon-ink-and-air.png
|
||||
IMAGE_FILES += $(wildcard assets/social/*.png)
|
||||
IMAGE_FILES += $(wildcard assets/profile-pictures/*.png)
|
||||
IMAGE_FILES += $(KRYON_DIR)/icons/ui.png $(KRYON_DIR)/icons/pfp.png
|
||||
CELL_BUNDLES := $(addprefix $(BUILD_DIR)/cells/,lists.zib habits.zib practices.zib diary.zib lumi.zib)
|
||||
CELL_BUNDLES := $(addprefix $(BUILD_DIR)/cells/,lists.zib habits.zib practices.zib diary.zib lumi.zib leaderboard.zib)
|
||||
INBE_BUNDLE := $(BUILD_DIR)/inbe.zib
|
||||
INBE_FULL_BUNDLE := $(BUILD_DIR)/inbe-full.zib
|
||||
CELL_SOURCES := $(shell find apps src/cells -name '*.zi' | LC_ALL=C sort) src/core/types.zi src/core/breath_timing.zi $(wildcard src/practices/patterns/*rules.zi) src/practices/patterns/patterns_clock.zi src/practices/patterns/patterns_types.zi src/practices/sun_salutation/sun_salutation_rules.zi src/practices/meditation/meditation_timing.zi
|
||||
CELL_RESOURCES := $(shell rg --files assets/habits assets/lists assets/diary assets/lumi assets/mcp 2>/dev/null)
|
||||
WIDGET_SCHEMAS := $(addprefix $(KRYON_DIR)/src/ui/,session.zi geometry.zi drawing_props.zi text_props.zi image_props.zi button_props.zi control_props.zi text_input.zi text_input_props.zi scroll.zi scroll_props.zi semantic.zi text_align.zi checkbox_props.zi toggle_props.zi tab_bar_props.zi box_props.zi) $(addprefix src/cells/,diary_ui_types.zi inbe_ui_types.zi lists_ui_types.zi lumi_ui_types.zi lumi_types.zi)
|
||||
src/cells/widget_codec.zi: scripts/generate-widget-codecs.py $(WIDGET_SCHEMAS)
|
||||
python3 scripts/generate-widget-codecs.py
|
||||
# App records cross the bundle boundary with codecs generated by Kryon's
|
||||
# generator on top of Kryon's own widget codec.
|
||||
APP_CODEC_SCHEMAS := $(KRYON_DIR)/scripts/generate-widget-codecs.py $(KRYON_DIR)/src/backend/widget_codec.zi $(addprefix src/cells/,diary_ui_types.zi inbe_ui_types.zi lists_ui_types.zi lumi_ui_types.zi lumi_types.zi leaderboard_ui_types.zi)
|
||||
src/cells/app_codec.zi: scripts/generate-app-codec.py $(APP_CODEC_SCHEMAS)
|
||||
python3 scripts/generate-app-codec.py
|
||||
|
||||
.PHONY: app-codec-check
|
||||
app-codec-check:
|
||||
python3 scripts/generate-app-codec.py --check
|
||||
|
||||
test: app-codec-check
|
||||
|
||||
.PHONY: cells
|
||||
cells: $(CELL_BUNDLES) $(INBE_BUNDLE) $(INBE_FULL_BUNDLE)
|
||||
@@ -408,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)
|
||||
@@ -506,7 +515,9 @@ KRYON_RAYLIB_AUDIO_PERIODS ?= 2
|
||||
endif
|
||||
KRYON_RAYLIB_AUDIO_PERIOD_CONFIG := $(if $(strip $(KRYON_RAYLIB_AUDIO_PERIOD_FRAMES)),-DAUDIO_DEVICE_PERIOD_SIZE_IN_FRAMES=$(KRYON_RAYLIB_AUDIO_PERIOD_FRAMES),)
|
||||
KRYON_RAYLIB_AUDIO_PERIODS_CONFIG := $(if $(strip $(KRYON_RAYLIB_AUDIO_PERIODS)),-DAUDIO_DEVICE_PERIODS=$(KRYON_RAYLIB_AUDIO_PERIODS),)
|
||||
APP_RAYLIB_CONFIG := $(filter-out -DSUPPORT_MODULE_RAUDIO=0 -DSUPPORT_FILEFORMAT_PNG=0 -DSUPPORT_FILEFORMAT_JPG=0 -DSUPPORT_FILEFORMAT_OGG=0 -DSUPPORT_FILEFORMAT_MP3=%,$(RAY_RAYLIB_CONFIG)) -DSUPPORT_MODULE_RAUDIO=1 -DSUPPORT_FILEFORMAT_JPG=1 -DSUPPORT_FILEFORMAT_OGG=1 -DSUPPORT_FILEFORMAT_MP3=0 $(KRYON_RAYLIB_AUDIO_PERIOD_CONFIG) $(KRYON_RAYLIB_AUDIO_PERIODS_CONFIG)
|
||||
# Inbe's fonts are TrueType and OpenType files, so every host keeps TTF
|
||||
# support; without it raylib draws its fallback pixel font.
|
||||
APP_RAYLIB_CONFIG := $(filter-out -DSUPPORT_MODULE_RAUDIO=0 -DSUPPORT_FILEFORMAT_PNG=0 -DSUPPORT_FILEFORMAT_JPG=0 -DSUPPORT_FILEFORMAT_OGG=0 -DSUPPORT_FILEFORMAT_MP3=% -DSUPPORT_FILEFORMAT_TTF=%,$(RAY_RAYLIB_CONFIG)) -DSUPPORT_MODULE_RAUDIO=1 -DSUPPORT_FILEFORMAT_JPG=1 -DSUPPORT_FILEFORMAT_OGG=1 -DSUPPORT_FILEFORMAT_MP3=0 -DSUPPORT_FILEFORMAT_TTF=1 $(KRYON_RAYLIB_AUDIO_PERIOD_CONFIG) $(KRYON_RAYLIB_AUDIO_PERIODS_CONFIG)
|
||||
COMMON_CFLAGS := -Wall -Wextra -Os -D_DEFAULT_SOURCE -D_GNU_SOURCE -ffunction-sections -fdata-sections -DSUPPORT_FILEFORMAT_JPG=1 -DUI_EMBEDDED_ONLY=1 -DNATIVE_WINDOW_HAVE_SDL -DKRYON_WITH_SYNC=1
|
||||
CFLAGS := $(COMMON_CFLAGS) -std=c99 $(RUNTIME_ASSET_CFLAGS) $(SYSTEM_THEME_CFLAGS) $(KRYON_NOTIFICATION_CPPFLAGS) $(KRYON_NOTIFICATION_CFLAGS)
|
||||
NATIVE_SYSTEM_LDLIBS := $(KRYON_NOTIFICATION_LDLIBS) -lz -lm -lpthread -latomic $(if $(filter linux,$(NATIVE_PLATFORM)),-ldl -lrt,) $(SYSTEM_THEME_LDLIBS)
|
||||
@@ -615,7 +626,7 @@ WEB_TARGET := $(WEB_DIST_DIR)/index.html
|
||||
WEB_APP_SCRIPT := <script>window.__inbeRenderer="canvas";window.__inbeLoadApp("index.js?v=$(WEB_CACHE_BUSTER)")</script>
|
||||
WEB_JS_TARGET := $(WEB_DIST_DIR)/index.js
|
||||
WEB_BOOT_JS := src/web_boot.js
|
||||
WEB_HOST_JS := src/web_host.js scripts/browser_network.js scripts/telegram_host.js
|
||||
WEB_HOST_JS := src/web_host.js scripts/telegram_host.js
|
||||
# Kryon's canvas hosts are Ziran modules on Ziran's web bridge; its runtime is the only JS they need.
|
||||
WEB_CANVAS_HOST_JS := $(ZIRAN_DIR)/web/ziran_web.js
|
||||
WEB_HOST_JS += $(WEB_CANVAS_HOST_JS)
|
||||
@@ -665,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
|
||||
@@ -698,11 +709,6 @@ $(KRYON_LIBRARY_BUILD_DIR)/libkryon.a: $(KRYON_UI_ZI) $(KRYON_DIR)/src/ui/module
|
||||
ZIRAN_DIR=$(abspath $(ZIRAN_DIR)) ZIRAN_BUILD_DIR=$(ZIRAN_BUILD_DIR) \
|
||||
$(KRYON_LIBRARY_BUILD_DIR)/libkryon.a
|
||||
|
||||
.PHONY: uri-link-test
|
||||
uri-link-test: $(ZI2C_BIN)
|
||||
@env -u DISPLAY -u WAYLAND_DISPLAY -u XAUTHORITY -u GDK_DISPLAY \
|
||||
python3 tests/uri_host_zi_test.py $(ZIRAN_BUILD_DIR)/bin
|
||||
|
||||
.PHONY: frame-activity-test
|
||||
frame-activity-test: $(ZI2C_BIN)
|
||||
@sh tests/frame_activity_zi_test.sh $(ZIRAN_BUILD_DIR)/bin
|
||||
@@ -726,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
|
||||
@@ -795,20 +807,6 @@ sync-retry-zi-test: build-laws $(ZI2C_BIN)
|
||||
|
||||
test: sync-retry-zi-test
|
||||
|
||||
.PHONY: sync-crypto-zi-test
|
||||
sync-crypto-zi-test: $(ZI2C_BIN)
|
||||
@env -u DISPLAY -u WAYLAND_DISPLAY \
|
||||
sh tests/sync_crypto_zi_test.sh $(ZIRAN_BUILD_DIR)/bin
|
||||
|
||||
test: sync-crypto-zi-test
|
||||
|
||||
.PHONY: sync-account-crypto-zi-test
|
||||
sync-account-crypto-zi-test: $(ZI2C_BIN) $(LIBOQS_A)
|
||||
@env -u DISPLAY -u WAYLAND_DISPLAY \
|
||||
sh tests/sync_account_crypto_zi_test.sh $(ZIRAN_BUILD_DIR)/bin $(LIBOQS_A)
|
||||
|
||||
test: sync-account-crypto-zi-test
|
||||
|
||||
# Exercise the packaged Ziran crypto API against the exact archive used by
|
||||
# Inbe, including ML-KEM round trips, tampering and short-buffer rejection.
|
||||
.PHONY: liboqs-crypto-test
|
||||
@@ -950,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 := 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 \
|
||||
@@ -998,6 +996,8 @@ $(KRY_GEN_STAMP): Makefile ziran.lock $(ZI2C_BIN) $(ZI_SRCS) $(KRYON_ZI_MODULES)
|
||||
--module-path $(KSS_DIR)/src --module-path oqs=$(OQS_DIR)/src --module-path kryon=$(KRYON_DIR)/src/ui --module-path kryon=$(KRYON_DIR)/src/backend \
|
||||
--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)
|
||||
@@ -1012,6 +1012,8 @@ $(WEB_GEN_STAMP): Makefile ziran.lock $(ZI2C_BIN) $(ZI_SRCS) $(KRYON_ZI_MODULES)
|
||||
--module-path $(KSS_DIR)/src --module-path oqs=$(OQS_DIR)/src --module-path kryon=$(KRYON_DIR)/src/ui --module-path kryon=$(KRYON_DIR)/src/backend \
|
||||
--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
|
||||
@@ -1031,6 +1033,8 @@ $(WINDOWS_GEN_STAMP): Makefile ziran.lock $(ZI2C_BIN) $(ZI_SRCS) $(KRYON_ZI_MODU
|
||||
--module-path $(KSS_DIR)/src --module-path oqs=$(OQS_DIR)/src --module-path kryon=$(KRYON_DIR)/src/ui --module-path kryon=$(KRYON_DIR)/src/backend \
|
||||
--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)
|
||||
@@ -1058,6 +1062,8 @@ zi-c-plan9: $(KRY_GEN_STAMP)
|
||||
--module-path $(KSS_DIR)/src --module-path oqs=$(OQS_DIR)/src --module-path kryon=$(KRYON_DIR)/src/ui --module-path kryon=$(KRYON_DIR)/src/backend \
|
||||
--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 +1294,14 @@ hooks-install:
|
||||
embedded-image-assets-check: $(EMBEDDED_ASSETS_C)
|
||||
bash ./tests/embedded_image_assets_test.sh
|
||||
|
||||
.PHONY: habits-cards-ui-test
|
||||
habits-cards-ui-test: $(TARGET)
|
||||
bash tests/habits_cards_ui_test.sh "$(abspath $(TARGET))"
|
||||
# An icon from a Kryon sheet Inbe does not ship shows "Missing image".
|
||||
.PHONY: icon-sheets-check
|
||||
icon-sheets-check: $(PACKAGES_MK)
|
||||
python3 tests/icon_sheets_test.py $(KRYON_DIR)/src/ui/icon.zi
|
||||
|
||||
.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)
|
||||
@@ -1301,7 +1312,7 @@ storage-literals-check:
|
||||
python3 tests/storage_literals_test.py
|
||||
bash ./scripts/check-storage-literals.sh
|
||||
|
||||
test: clean-text-api-check package-check secret-check storage-literals-check font-bundle-check audio-test-fixture-check embedded-image-assets-check
|
||||
test: clean-text-api-check package-check secret-check storage-literals-check font-bundle-check audio-test-fixture-check embedded-image-assets-check icon-sheets-check
|
||||
test: screenshot-scene-test
|
||||
|
||||
.PHONY: screenshot-scene-test
|
||||
@@ -1619,59 +1630,6 @@ android-text-input-zi-test: $(ZI2C_BIN)
|
||||
|
||||
test: android-text-input-zi-test
|
||||
|
||||
.PHONY: window-close-host-test
|
||||
window-close-host-test: $(ZI2C_BIN)
|
||||
@mkdir -p $(BUILD_DIR)/window-close-host-test/c
|
||||
@$(ZI2C_BIN) --define PLATFORM_DESKTOP \
|
||||
--define NATIVE_WINDOW_HAVE_SDL \
|
||||
--entry window_close_behavior:main --root tests \
|
||||
--module-path src -o $(BUILD_DIR)/window-close-host-test/c \
|
||||
tests/window_close_behavior.zi
|
||||
@$(CC) -std=c11 -O2 -I$(ZIRAN_DIR)/include \
|
||||
-iquote $(BUILD_DIR)/window-close-host-test/c \
|
||||
$(BUILD_DIR)/window-close-host-test/c/*.c \
|
||||
$(RAY_SDL_LDLIBS) -o $(BUILD_DIR)/window-close-host-test/test
|
||||
@env -u DISPLAY -u WAYLAND_DISPLAY -u XAUTHORITY -u GDK_DISPLAY \
|
||||
$(BUILD_DIR)/window-close-host-test/test
|
||||
|
||||
test: window-close-host-test
|
||||
|
||||
.PHONY: activity-host-test
|
||||
activity-host-test: $(ZI2C_BIN)
|
||||
@env -u DISPLAY -u WAYLAND_DISPLAY -u XAUTHORITY -u GDK_DISPLAY \
|
||||
DBUS_SESSION_BUS_ADDRESS=invalid: \
|
||||
sh tests/activity_host_zi_test.sh $(ZIRAN_BUILD_DIR)/bin
|
||||
|
||||
test: activity-host-test
|
||||
|
||||
.PHONY: audio-picker-host-test
|
||||
audio-picker-host-test: $(ZI2C_BIN)
|
||||
@mkdir -p $(BUILD_DIR)/audio-picker-host-test/c
|
||||
@cp tests/support/audio_picker_zenity.sh \
|
||||
$(BUILD_DIR)/audio-picker-host-test/zenity
|
||||
@chmod +x $(BUILD_DIR)/audio-picker-host-test/zenity
|
||||
@$(ZI2C_BIN) --no-main --define PLATFORM_DESKTOP --root src \
|
||||
--module-path $(ZIRAN_DIR)/std \
|
||||
-o $(BUILD_DIR)/audio-picker-host-test/c \
|
||||
src/platform/audio_picker_host.zi
|
||||
@$(CC) -std=c11 -D_DEFAULT_SOURCE -Wall -Wextra -Werror \
|
||||
-Wno-unused-function -I$(ZIRAN_DIR)/include \
|
||||
-iquote $(BUILD_DIR)/audio-picker-host-test/c \
|
||||
tests/audio_picker_host_test.c \
|
||||
$(BUILD_DIR)/audio-picker-host-test/c/*.c \
|
||||
$(BUILD_DIR)/audio-picker-host-test/c/platform/audio_picker_host.c \
|
||||
$(BUILD_DIR)/audio-picker-host-test/c/platform/file_picker.c \
|
||||
-o $(BUILD_DIR)/audio-picker-host-test/test
|
||||
@env -u DISPLAY -u WAYLAND_DISPLAY -u XAUTHORITY -u GDK_DISPLAY \
|
||||
PATH="$(abspath $(BUILD_DIR)/audio-picker-host-test)" \
|
||||
$(abspath $(BUILD_DIR)/audio-picker-host-test/test)
|
||||
|
||||
.PHONY: file-picker-zi-test
|
||||
file-picker-zi-test: $(ZI2C_BIN)
|
||||
@sh tests/file_picker_zi_test.sh $(abspath $(dir $(ZI2C_BIN)))
|
||||
|
||||
test: audio-picker-host-test file-picker-zi-test
|
||||
|
||||
.PHONY: main-platform-zi-test
|
||||
main-platform-zi-test: $(ZI2C_BIN) $(RAYLIB_A)
|
||||
@RAY_LDLIBS='$(RAY_LDLIBS)' sh tests/main_platform_zi_test.sh \
|
||||
@@ -1700,17 +1658,12 @@ update-transport-zi-test: $(ZI2C_BIN)
|
||||
|
||||
test: plan9-host-zi-test android-jni-zi-test update-transport-zi-test
|
||||
|
||||
.PHONY: secondary-window-host-test
|
||||
secondary-window-host-test: $(ZI2C_BIN) $(RAYLIB_A)
|
||||
@sh tests/secondary_window_host_zi_test.sh \
|
||||
$(abspath $(dir $(ZI2C_BIN))) $(abspath $(RAYLIB_A))
|
||||
|
||||
.PHONY: raylib-log-host-test
|
||||
raylib-log-host-test: $(ZI2C_BIN) $(RAYLIB_A)
|
||||
@mkdir -p $(BUILD_DIR)/raylib-log-host-test/c
|
||||
@$(ZI2C_BIN) --define PLATFORM_DESKTOP \
|
||||
--entry raylib_log_behavior:main --root tests \
|
||||
--module-path src --module-path $(ZIRAN_DIR)/std \
|
||||
--module-path src --module-path $(KRYON_DIR)/src/backend --module-path $(ZIRAN_DIR)/std \
|
||||
-o $(BUILD_DIR)/raylib-log-host-test/c tests/raylib_log_behavior.zi
|
||||
@$(CC) -std=c11 -O2 -I$(ZIRAN_DIR)/include \
|
||||
-iquote $(BUILD_DIR)/raylib-log-host-test/c \
|
||||
@@ -1784,13 +1737,6 @@ android-import-zi-test: $(ZI2C_BIN)
|
||||
|
||||
test: android-import-zi-test
|
||||
|
||||
.PHONY: android-runtime-assets-zi-test
|
||||
android-runtime-assets-zi-test: $(ZI2C_BIN)
|
||||
@env -u DISPLAY -u WAYLAND_DISPLAY \
|
||||
sh tests/android_runtime_assets_zi_test.sh $(ZIRAN_BUILD_DIR)/bin
|
||||
|
||||
test: android-runtime-assets-zi-test
|
||||
|
||||
.PHONY: android-lifecycle-zi-test
|
||||
android-lifecycle-zi-test: $(ZI2C_BIN)
|
||||
@env -u DISPLAY -u WAYLAND_DISPLAY \
|
||||
@@ -1904,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 \
|
||||
@@ -2693,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; \
|
||||
@@ -3004,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
|
||||
@@ -3067,12 +3037,40 @@ app-click-block-zi-test: $(ZI2C_BIN)
|
||||
data-back-ui-test: $(TARGET)
|
||||
@sh tests/data_back_ui_test.sh $(abspath $(TARGET))
|
||||
|
||||
.PHONY: leaderboard-ui-test
|
||||
leaderboard-ui-test: $(TARGET)
|
||||
@sh tests/leaderboard_ui_test.sh $(abspath $(TARGET))
|
||||
|
||||
# Missing practice pictures fail the visual gate in CI and releases.
|
||||
.PHONY: practice-images-ui-test
|
||||
practice-images-ui-test: $(TARGET)
|
||||
@sh tests/practice_images_ui_test.sh $(abspath $(TARGET))
|
||||
|
||||
test: app-click-block-zi-test
|
||||
|
||||
.PHONY: package-release-test
|
||||
package-release-test: cells $(ZIRAN_BUILD_DIR)/libziran.a
|
||||
python3 tests/package_release_test.py
|
||||
|
||||
# This build runs the packages the node serves, and the last released app runs
|
||||
# each new package that declares a host interface it has.
|
||||
.PHONY: package-compat-test
|
||||
package-compat-test: $(TARGET) $(CELL_BUNDLES) $(INBE_BUNDLE)
|
||||
python3 tests/package_compat_test.py $(abspath $(TARGET))
|
||||
|
||||
.PHONY: phone-check-gate-test
|
||||
phone-check-gate-test:
|
||||
python3 tests/phone_check_gate_test.py
|
||||
|
||||
test: phone-check-gate-test
|
||||
|
||||
# Check an exact APK on the development Moto and record the release receipt:
|
||||
# make phone-check APK=path/to/inbe.apk
|
||||
.PHONY: phone-check
|
||||
phone-check:
|
||||
@test -n "$(APK)" || { echo "Set APK=path/to/inbe.apk"; exit 1; }
|
||||
python3 scripts/phone-check.py "$(APK)" --record
|
||||
|
||||
test: package-release-test
|
||||
|
||||
.PHONY: app-preferences-sync-test
|
||||
@@ -3126,7 +3124,7 @@ device-key-wasm-test: $(ZI2C_BIN)
|
||||
test: device-key-test
|
||||
web-smoke-test web-canvas-smoke-test: device-key-wasm-test
|
||||
|
||||
.PHONY: telegram-authorization-test telegram-bridge-test telegram-host-test telegram-entry-protocol-test telegram-account-flow-test telegram-account-ui-test settings-telegram-ui-test lumi-authorization-test delegate-account-test delegate-secret-cleanup-test storage-delegate-test lumi-delegate-scope-test
|
||||
.PHONY: telegram-authorization-test telegram-bridge-test telegram-host-test telegram-entry-protocol-test telegram-account-flow-test telegram-account-ui-test settings-telegram-ui-test lumi-authorization-test delegate-account-test storage-delegate-test lumi-delegate-scope-test
|
||||
|
||||
telegram-bridge-test:
|
||||
@sh tests/telegram_bridge_test.sh
|
||||
@@ -3158,16 +3156,13 @@ lumi-authorization-test: $(ZIRAN_BIN) $(LIBOQS_A)
|
||||
delegate-account-test: $(ZIRAN_BIN) $(LIBOQS_A)
|
||||
@sh tests/delegate_account_zi_test.sh $(ZIRAN_BIN) $(LIBOQS_A)
|
||||
|
||||
delegate-secret-cleanup-test: $(ZIRAN_BIN) $(LIBOQS_A)
|
||||
@sh tests/delegate_secret_cleanup_zi_test.sh $(ZIRAN_BIN) $(LIBOQS_A)
|
||||
|
||||
storage-delegate-test: $(ZIRAN_BIN) $(LIBOQS_A)
|
||||
@sh tests/storage_delegate_zi_test.sh $(ZIRAN_BIN) $(LIBOQS_A)
|
||||
|
||||
lumi-delegate-scope-test: $(ZIRAN_BIN) $(LIBOQS_A)
|
||||
@sh tests/lumi_delegate_scope_zi_test.sh $(ZIRAN_BIN) $(LIBOQS_A)
|
||||
|
||||
telegram-authorization-test: telegram-bridge-test telegram-host-test telegram-entry-protocol-test telegram-account-flow-test telegram-account-ui-test settings-telegram-ui-test lumi-authorization-test delegate-account-test delegate-secret-cleanup-test storage-delegate-test lumi-delegate-scope-test
|
||||
telegram-authorization-test: telegram-bridge-test telegram-host-test telegram-entry-protocol-test telegram-account-flow-test telegram-account-ui-test settings-telegram-ui-test lumi-authorization-test delegate-account-test storage-delegate-test lumi-delegate-scope-test
|
||||
|
||||
test: telegram-authorization-test
|
||||
|
||||
@@ -3176,3 +3171,36 @@ android-geometry-probe-test:
|
||||
@env -u DISPLAY -u WAYLAND_DISPLAY -u XAUTHORITY -u DBUS_SESSION_BUS_ADDRESS sh tests/android_geometry_probe_test.sh
|
||||
|
||||
test: android-geometry-probe-test
|
||||
|
||||
.PHONY: lumi-feedback-delivery-test
|
||||
lumi-feedback-delivery-test: $(ZIRAN_BIN) $(LIBOQS_A) | build-laws
|
||||
@sh tests/lumi_feedback_delivery_test.sh $(ZIRAN_BIN) $(LIBOQS_A)
|
||||
|
||||
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)
|
||||
|
||||
diary-history-test: $(ZI2C_BIN)
|
||||
@sh tests/diary_history_zi_test.sh $(ZIRAN_BUILD_DIR)/bin
|
||||
|
||||
test: diary-spelling-test diary-history-test
|
||||
|
||||
# Lumi reports name the device, system and version (no identifiers).
|
||||
.PHONY: device-info-test
|
||||
device-info-test: $(ZIRAN_BIN)
|
||||
@env -u DISPLAY -u WAYLAND_DISPLAY -u XAUTHORITY $(ZIRAN_BIN) build --target=c --define PLATFORM_DESKTOP --root tests \
|
||||
--module-path src --module-path build/packages/ziran/std --entry device_info_behavior:Main --exe \
|
||||
-o build/device-info-test tests/device_info_behavior.zi
|
||||
@build/device-info-test/device_info_behavior
|
||||
|
||||
test: device-info-test
|
||||
@@ -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.
|
||||
|
||||
|
||||
@@ -1,5 +1,34 @@
|
||||
# Changelog
|
||||
|
||||
## [1.1.10] - 2026-10-13
|
||||
|
||||
- Maintenance release for Inner Breeze 2.1.33.
|
||||
|
||||
## [1.1.9] - 2026-10-11
|
||||
|
||||
### Changed
|
||||
- Scrollbars use your theme's colours and show how much of the page is in view.
|
||||
|
||||
## [1.1.8] - 2026-10-10
|
||||
|
||||
### Added
|
||||
- Correct the spelling of an entry with one button. Inner Breeze sends the entry to the Waozi node, which returns it with only misspelled words corrected. It uses the same daily online allowance as Lumi.
|
||||
- Undo and redo buttons, so a correction or any other change can be taken back.
|
||||
|
||||
### Changed
|
||||
- A title bar shows the date in the middle, between the previous and next day. Today and the calendar sit together on the left, and the entry's tools are compact buttons on the right, leaving more room for writing.
|
||||
- The entry reaches the bottom of the screen; a notice takes room below it only while it is shown.
|
||||
|
||||
## [1.1.7] - 2026-10-10
|
||||
|
||||
### Changed
|
||||
- When a photo is not on this device, for example because your sync node does not store photos, the entry shows where the photo is instead of an empty space.
|
||||
|
||||
## [1.1.6] - 2026-10-10
|
||||
|
||||
### Changed
|
||||
- Show **bold** text as bold. The ** marks appear only on the line you are editing, so you can still change them.
|
||||
|
||||
## [1.1.5] - 2026-10-10
|
||||
### Changed
|
||||
- Save your writing quietly, without a "Waiting to save…" note below the entry.
|
||||
|
||||
+196
-40
@@ -10,6 +10,10 @@
|
||||
#import "button_props"
|
||||
#import "button_widget"
|
||||
#import "control_props"
|
||||
#import "drawing_props"
|
||||
#import "box_props"
|
||||
#import "box_widget"
|
||||
#import "text_align"
|
||||
#import "text"
|
||||
#import "vec"
|
||||
#import "byte_text_linux"
|
||||
@@ -20,6 +24,8 @@
|
||||
#import, file "../../src/cells/diary_ui_types.zi";
|
||||
|
||||
using ImageFit;
|
||||
using TextAlign;
|
||||
using TextWrap;
|
||||
using ButtonTone;
|
||||
using ButtonEmphasis;
|
||||
host_api :: #system_library "host_api";
|
||||
@@ -30,6 +36,15 @@ state: DiaryMessage;
|
||||
frame: DiaryUiFrame;
|
||||
pending: bool;
|
||||
|
||||
DIARY_PREVIOUS_ICON :: "S1.8rr:M15 5L8 12L15 19"
|
||||
DIARY_NEXT_ICON :: "S1.8rr:M9 5L16 12L9 19"
|
||||
DIARY_CALENDAR_ICON :: "S1.6rr:M4 5H20V20H4ZM4 10H20M8 3V7M16 3V7"
|
||||
DIARY_TIME_ICON :: "S1.6rr:M21 12C21 16.97 16.97 21 12 21C7.03 21 3 16.97 3 12C3 7.03 7.03 3 12 3C16.97 3 21 7.03 21 12ZM12 7V12L15.5 14"
|
||||
DIARY_PHOTO_ICON :: "S1.6rr:M3 5H21V19H3ZM3 16L8 11L13 16L16 13L21 18M17.5 8.5C17.5 9.33 16.83 10 16 10C15.17 10 14.5 9.33 14.5 8.5C14.5 7.67 15.17 7 16 7C16.83 7 17.5 7.67 17.5 8.5Z"
|
||||
DIARY_UNDO_ICON :: "S1.8rr:M9 14L4 9L9 4M4 9H14C17.31 9 20 11.69 20 15C20 18.31 17.31 21 14 21H11"
|
||||
DIARY_REDO_ICON :: "S1.8rr:M15 14L20 9L15 4M20 9H10C6.69 9 4 11.69 4 15C4 18.31 6.69 21 10 21H13"
|
||||
DIARY_SPELLING_ICON :: "S2rr:M3 14L7.5 3L12 14M4.8 10H10.2M12 17L15.5 20.5L21.5 13"
|
||||
|
||||
DiaryObserve :: () -> DiaryUiFrame {
|
||||
return ReadDiaryUiHost()
|
||||
}
|
||||
@@ -38,6 +53,53 @@ DiarySaveDue :: () -> bool {
|
||||
return frame.now >= frame.save_at
|
||||
}
|
||||
|
||||
// Markdown bold reads as bold text. Its ** markers stay in the entry but are
|
||||
// hidden, except on the lines holding the caret or a selection, where they
|
||||
// can be edited directly.
|
||||
DIARY_EMPHASIS_MAX :: 256
|
||||
emphasis_hidden: [DIARY_EMPHASIS_MAX * 2]TextRange;
|
||||
emphasis_strong: [DIARY_EMPHASIS_MAX]TextRange;
|
||||
emphasis_hidden_count: s32;
|
||||
emphasis_strong_count: s32;
|
||||
|
||||
DiaryEmphasis :: (value: string, cursor: s32, anchor: s32, editing: bool) {
|
||||
emphasis_hidden_count = 0
|
||||
emphasis_strong_count = 0
|
||||
first := ifx cursor < anchor then cursor else anchor
|
||||
last := ifx cursor < anchor then anchor else cursor
|
||||
line: s32 = 0
|
||||
while line <= cast(s32)value.count && emphasis_strong_count < DIARY_EMPHASIS_MAX {
|
||||
end := line
|
||||
while end < cast(s32)value.count && value[end] != cast(u8)10 { end += 1 }
|
||||
active := editing && last >= line && first <= end
|
||||
at := line
|
||||
while at + 1 < end && emphasis_strong_count < DIARY_EMPHASIS_MAX {
|
||||
if value[at] != cast(u8)42 || value[at + 1] != cast(u8)42 {
|
||||
at += 1
|
||||
continue
|
||||
}
|
||||
close := at + 2
|
||||
while close + 1 < end && (value[close] != cast(u8)42 || value[close + 1] != cast(u8)42) {
|
||||
close += 1
|
||||
}
|
||||
if close + 1 >= end {
|
||||
break
|
||||
}
|
||||
if close > at + 2 {
|
||||
emphasis_strong[emphasis_strong_count] = TextRange.{.start = at + 2, .end = close}
|
||||
emphasis_strong_count += 1
|
||||
if !active {
|
||||
emphasis_hidden[emphasis_hidden_count] = TextRange.{.start = at, .end = at + 2}
|
||||
emphasis_hidden[emphasis_hidden_count + 1] = TextRange.{.start = close, .end = close + 2}
|
||||
emphasis_hidden_count += 2
|
||||
}
|
||||
}
|
||||
at = close + 2
|
||||
}
|
||||
line = end + 1
|
||||
}
|
||||
}
|
||||
|
||||
DateTitle :: (year: s32, month: s32, day: s32) -> string {
|
||||
if month < 1 || month > 12 { return "" }
|
||||
keys: [12]string = .["habit_month_1", "habit_month_2", "habit_month_3",
|
||||
@@ -65,6 +127,15 @@ DateTitle :: (year: s32, month: s32, day: s32) -> string {
|
||||
return BuilderFinish(title)
|
||||
}
|
||||
|
||||
HasWords :: (text: string) -> bool {
|
||||
for byte: text {
|
||||
if byte != cast(u8)32 && byte != cast(u8)10 && byte != cast(u8)13 && byte != cast(u8)9 {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
Scale :: (value: s32) -> s32 {
|
||||
return cast(s32)(cast(float32)value * frame.scale)
|
||||
}
|
||||
@@ -74,20 +145,37 @@ FinishView :: () -> DiaryMessage {
|
||||
return state
|
||||
}
|
||||
|
||||
DiaryAction :: ( id: s32, label: string, bounds: Rectangle, enabled: bool = true) {
|
||||
// A button with an icon shows only the icon; its label names it for
|
||||
// accessibility.
|
||||
DiaryAction :: ( id: s32, label: string, bounds: Rectangle, enabled: bool = true,
|
||||
icon: string = "", selected: bool = false, loading: bool = false) {
|
||||
if Button(frame.session, ButtonProps.{.id = id, .bounds = bounds,
|
||||
.label = label, .disabled = !enabled, .tone = cast(ButtonTone)ButtonToneNeutral,
|
||||
.emphasis = cast(ButtonEmphasis)ButtonEmphasisSoft}) != 0 {
|
||||
.label = label, .disabled = !enabled, .selected = selected, .loading = loading,
|
||||
.icon_shape = icon, .icon_only = icon != "", .fit_content = true,
|
||||
.tone = cast(ButtonTone)ButtonToneNeutral,
|
||||
.emphasis = cast(ButtonEmphasis)(ifx icon != "" then ButtonEmphasisGhost else ButtonEmphasisSoft)}) != 0 {
|
||||
// Photos, undo, redo and spelling are host effects.
|
||||
frame.focused = false
|
||||
if id == 29005 {
|
||||
frame.photo_requested = true
|
||||
frame.focused = false
|
||||
return
|
||||
}
|
||||
if id == 29014 {
|
||||
frame.undo_requested = true
|
||||
return
|
||||
}
|
||||
if id == 29015 {
|
||||
frame.redo_requested = true
|
||||
return
|
||||
}
|
||||
if id == 29016 {
|
||||
frame.spelling_requested = true
|
||||
return
|
||||
}
|
||||
state.action = DIARY_CONTROL
|
||||
state.control = id
|
||||
pending = true
|
||||
frame.scroll = 0
|
||||
frame.focused = false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,24 +185,70 @@ DiaryView :: (message: DiaryMessage, observed: DiaryUiFrame, today: Date) -> Dia
|
||||
column := CenteredColumnFor(frame.width, Scale(640), Scale(16))
|
||||
left := cast(float32)column.x
|
||||
width := cast(float32)column.width
|
||||
Text(frame.session, TextProps.{.bounds = Rectangle.{left, cast(float32)Scale(24),
|
||||
width, cast(float32)Scale(40)}, .text = DateTitle(state.year, state.month, state.day), .font = frame.font})
|
||||
part := (width - cast(float32)Scale(12)) / 3.0
|
||||
compact := frame.height < Scale(480)
|
||||
top := cast(float32)(ifx compact then Scale(44) else Scale(76))
|
||||
DiaryAction(29001, "‹", Rectangle.{left, top, part, cast(float32)Scale(44)})
|
||||
DiaryAction(29004, DiaryLocaleHost("diary_today"), Rectangle.{left + part + cast(float32)Scale(6),
|
||||
top, part, cast(float32)Scale(44)})
|
||||
DiaryAction(29002, "›", Rectangle.{left + 2.0 * (part + cast(float32)Scale(6)),
|
||||
top, part, cast(float32)Scale(44)},
|
||||
top := cast(float32)(ifx compact then Scale(4) else Scale(12))
|
||||
control := cast(float32)Scale(44)
|
||||
gap := cast(float32)Scale(8)
|
||||
|
||||
// Title bar: the selected date, centered between the previous and next day.
|
||||
DiaryAction(29001, "‹", Rectangle.{left, top, control, control}, true, DIARY_PREVIOUS_ICON)
|
||||
DiaryAction(29002, "›", Rectangle.{left + width - control, top, control, control},
|
||||
OnOrBefore(Next(Date.{state.year, state.month, state.day}, 1), today) &&
|
||||
!OnOrBefore(today, Date.{state.year, state.month, state.day}))
|
||||
!OnOrBefore(today, Date.{state.year, state.month, state.day}),
|
||||
DIARY_NEXT_ICON)
|
||||
title := DateTitle(state.year, state.month, state.day)
|
||||
title_strong: [1]TextRange = .[TextRange.{.start = 0, .end = cast(s32)title.count}]
|
||||
Text(frame.session, TextProps.{.bounds = Rectangle.{left + control + gap, top,
|
||||
width - 2.0 * (control + gap), control}, .text = title,
|
||||
.font = frame.font + Scale(4), .strong = title_strong[:],
|
||||
.align = cast(TextAlign)TextAlignCenter, .vertical_align = cast(TextAlign)TextAlignCenter,
|
||||
.wrap = cast(TextWrap)TextWrapNone})
|
||||
|
||||
// Tools: Today and the calendar move between days; undo, redo, spelling,
|
||||
// the time and photos change the entry. Today narrows on phones so every
|
||||
// icon keeps its target.
|
||||
tools := top + control + gap
|
||||
tool_gap := cast(float32)Scale(4)
|
||||
tool := control
|
||||
today_width := width - 6.0 * tool - 5.0 * tool_gap - gap
|
||||
if today_width < cast(float32)Scale(64) {
|
||||
// The narrowest phones keep Today readable with smaller icon targets.
|
||||
today_width = cast(float32)Scale(64)
|
||||
tool = (width - today_width - gap - 5.0 * tool_gap) / 6.0
|
||||
}
|
||||
if today_width > cast(float32)Scale(128) {
|
||||
today_width = cast(float32)Scale(128)
|
||||
}
|
||||
DiaryAction(29004, DiaryLocaleHost("diary_today"), Rectangle.{left, tools, today_width, control})
|
||||
DiaryAction(29003, DiaryLocaleHost("tab_diary_calendar"),
|
||||
Rectangle.{left, top + cast(float32)Scale(52), width, cast(float32)Scale(44)})
|
||||
Rectangle.{left + today_width + gap, tools, tool, control},
|
||||
true, DIARY_CALENDAR_ICON, state.calendar)
|
||||
editable := !state.load_error && state.year > 0
|
||||
if !state.calendar {
|
||||
idle := editable && !frame.spelling_busy
|
||||
DiaryAction(29014, DiaryLocaleHost("diary_undo"),
|
||||
Rectangle.{left + width - 5.0 * tool - 4.0 * tool_gap, tools, tool, control},
|
||||
idle && frame.can_undo, DIARY_UNDO_ICON)
|
||||
DiaryAction(29015, DiaryLocaleHost("diary_redo"),
|
||||
Rectangle.{left + width - 4.0 * tool - 3.0 * tool_gap, tools, tool, control},
|
||||
idle && frame.can_redo, DIARY_REDO_ICON)
|
||||
DiaryAction(29016, DiaryLocaleHost("diary_check_spelling"),
|
||||
Rectangle.{left + width - 3.0 * tool - 2.0 * tool_gap, tools, tool, control},
|
||||
idle && HasWords(state.text), DIARY_SPELLING_ICON, false, frame.spelling_busy)
|
||||
DiaryAction(29013, DiaryLocaleHost("diary_insert_time"),
|
||||
Rectangle.{left + width - 2.0 * tool - tool_gap, tools, tool, control},
|
||||
!frame.spelling_busy, DIARY_TIME_ICON)
|
||||
DiaryAction(29005, DiaryLocaleHost("diary_attach_photo"),
|
||||
Rectangle.{left + width - tool, tools, tool, control},
|
||||
true, DIARY_PHOTO_ICON)
|
||||
}
|
||||
content := tools + control + cast(float32)Scale(12)
|
||||
content_height := cast(float32)(frame.height - frame.bottom) - content - cast(float32)Scale(16)
|
||||
|
||||
if state.calendar {
|
||||
scroll := Scroll(frame.session, ScrollProps.{.key = cast(u64)290300,
|
||||
.bounds = Rectangle.{left, top + cast(float32)Scale(104), width,
|
||||
cast(float32)(frame.height - frame.bottom - Scale(200))},
|
||||
.bounds = Rectangle.{left, content, width, content_height},
|
||||
.content_height = Scale(344), .scroll_offset = frame.calendar_scroll})
|
||||
frame.calendar_scroll = scroll.scroll_offset
|
||||
if !scroll.opened {
|
||||
@@ -152,29 +286,26 @@ DiaryView :: (message: DiaryMessage, observed: DiaryUiFrame, today: Date) -> Dia
|
||||
End(frame.session)
|
||||
return FinishView()
|
||||
}
|
||||
editor_height := frame.height - frame.bottom - cast(s32)top - Scale(236)
|
||||
// The editor reaches the bottom; a notice takes room below it only while
|
||||
// it is shown.
|
||||
notice := frame.photo_error || state.load_error || frame.spelling_notice != ""
|
||||
notice_room := ifx notice then Scale(60) else 0
|
||||
editor_height := cast(s32)content_height - notice_room
|
||||
if editor_height < Scale(120) {
|
||||
editor_height = Scale(120)
|
||||
}
|
||||
page := Scroll(frame.session, ScrollProps.{.key = cast(u64)290301,
|
||||
.bounds = Rectangle.{left, top + cast(float32)Scale(104), width,
|
||||
cast(float32)(frame.height - frame.bottom - cast(s32)top - Scale(120))},
|
||||
.content_height = editor_height + Scale(104) +
|
||||
(ifx state.photo_count > 0 then Scale(380) else 0), .scroll_offset = frame.page_scroll})
|
||||
.bounds = Rectangle.{left, content, width, content_height},
|
||||
.content_height = editor_height + notice_room +
|
||||
(ifx state.photo_count > 0 then Scale(392) else 0), .scroll_offset = frame.page_scroll})
|
||||
frame.page_scroll = page.scroll_offset
|
||||
if !page.opened {
|
||||
return FinishView()
|
||||
}
|
||||
DiaryAction(29013, DiaryLocaleHost("diary_insert_time"),
|
||||
Rectangle.{left, page.content.y, (width - cast(float32)Scale(8)) / 2.0, cast(float32)Scale(44)})
|
||||
DiaryAction(29005, DiaryLocaleHost("diary_attach_photo"),
|
||||
Rectangle.{left + (width + cast(float32)Scale(8)) / 2.0, page.content.y,
|
||||
(width - cast(float32)Scale(8)) / 2.0, cast(float32)Scale(44)})
|
||||
area: TextAreaProps
|
||||
area.key = cast(u64)290200
|
||||
area.focus_id = 29020
|
||||
area.bounds = Rectangle.{left, page.content.y + cast(float32)Scale(56), width,
|
||||
cast(float32)editor_height}
|
||||
area.bounds = Rectangle.{left, page.content.y, width, cast(float32)editor_height}
|
||||
area.value = state.text
|
||||
area.label = DiaryLocaleHost("tab_diary")
|
||||
area.wrap = true
|
||||
@@ -183,10 +314,15 @@ DiaryView :: (message: DiaryMessage, observed: DiaryUiFrame, today: Date) -> Dia
|
||||
area.scroll_y = frame.scroll
|
||||
area.focused = frame.focused
|
||||
area.selecting = frame.selecting
|
||||
area.read_only = state.load_error || state.year < 1
|
||||
// The entry waits while its spelling is checked, so the correction
|
||||
// always applies to the text that was sent.
|
||||
area.read_only = !editable || frame.spelling_busy
|
||||
area.max_bytes = 2147483646
|
||||
area.max_codepoints = 2147483646
|
||||
area.input = frame.input
|
||||
DiaryEmphasis(state.text, state.cursor, state.anchor, frame.focused && !area.read_only)
|
||||
area.hidden = emphasis_hidden[:emphasis_hidden_count]
|
||||
area.strong = emphasis_strong[:emphasis_strong_count]
|
||||
edited := TextArea(frame.session, area)
|
||||
state.cursor = edited.cursor
|
||||
state.anchor = edited.anchor
|
||||
@@ -206,21 +342,41 @@ DiaryView :: (message: DiaryMessage, observed: DiaryUiFrame, today: Date) -> Dia
|
||||
frame.clipboard_text = edited.clipboard_text
|
||||
}
|
||||
|
||||
if frame.photo_error || state.load_error {
|
||||
status := ifx frame.photo_error then "diary_photo_error" else "diary_read_error"
|
||||
if notice {
|
||||
status := frame.spelling_notice
|
||||
if state.load_error {
|
||||
status = "diary_read_error"
|
||||
}
|
||||
if frame.photo_error {
|
||||
status = "diary_photo_error"
|
||||
}
|
||||
Text(frame.session, TextProps.{.bounds = Rectangle.{left,
|
||||
area.bounds.y + area.bounds.height + cast(float32)Scale(12), width, cast(float32)Scale(40)},
|
||||
.text = DiaryLocaleHost(status), .font = frame.font})
|
||||
}
|
||||
if state.photo_count > 0 {
|
||||
photo_top := area.bounds.y + area.bounds.height + cast(float32)Scale(60)
|
||||
path: Vec(u8)
|
||||
BuilderPrint(*path, "diary/photos/%.%", state.photo_file, frame.photo_format)
|
||||
image := BuilderFinish(path)
|
||||
Image(frame.session, ImageProps.{.asset_path = image,
|
||||
.alt_text = state.photo_name,
|
||||
.bounds = Rectangle.{left, photo_top, width, cast(float32)Scale(240)},
|
||||
.fit = cast(ImageFit)ImageFitContain})
|
||||
photo_top := area.bounds.y + area.bounds.height + cast(float32)(notice_room + Scale(12))
|
||||
photo_bounds := Rectangle.{left, photo_top, width, cast(float32)Scale(240)}
|
||||
if frame.photo_format.count > 0 {
|
||||
path: Vec(u8)
|
||||
BuilderPrint(*path, "diary/photos/%.%", state.photo_file, frame.photo_format)
|
||||
image := BuilderFinish(path)
|
||||
Image(frame.session, ImageProps.{.asset_path = image,
|
||||
.alt_text = state.photo_name,
|
||||
.bounds = photo_bounds,
|
||||
.fit = cast(ImageFit)ImageFitContain})
|
||||
} else {
|
||||
// The entry names a photo whose bytes are not on this device, for
|
||||
// example when a sync node keeps photos off. The entry still works.
|
||||
Box(frame.session, BoxProps.{.key = cast(u64)29011, .bounds = photo_bounds,
|
||||
.fill = Color.{156, 156, 156, 36}, .radius = cast(float32)Scale(12)})
|
||||
Text(frame.session, TextProps.{.key = cast(u64)29012,
|
||||
.text = DiaryLocaleHost("diary_photo_unavailable"),
|
||||
.bounds = Rectangle.{left + cast(float32)Scale(16), photo_top,
|
||||
width - cast(float32)Scale(32), cast(float32)Scale(240)},
|
||||
.font = frame.font, .align = cast(TextAlign)TextAlignCenter,
|
||||
.vertical_align = cast(TextAlign)TextAlignCenter})
|
||||
}
|
||||
Text(frame.session, TextProps.{.text = state.photo_name,
|
||||
.bounds = Rectangle.{left, photo_top + cast(float32)Scale(248), width,
|
||||
cast(float32)Scale(32)}, .font = frame.font})
|
||||
|
||||
@@ -1,5 +1,14 @@
|
||||
# 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.
|
||||
|
||||
## [1.0.3] - 2026-10-07
|
||||
|
||||
- Keep app labels and content visible after updating Inner Breeze.
|
||||
|
||||
+10
-2
@@ -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
|
||||
}
|
||||
|
||||
@@ -1,5 +1,51 @@
|
||||
# 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.
|
||||
- Requires Inner Breeze 2.1.29 or later.
|
||||
|
||||
## [2.1.28] - 2026-10-11
|
||||
|
||||
- Bring Lumi's message selection with copy and delete.
|
||||
- Requires Inner Breeze 2.1.29 or later.
|
||||
|
||||
## [2.1.27] - 2026-10-11
|
||||
|
||||
- Bring Lumi's chat that loads older messages as you scroll up.
|
||||
- Requires Inner Breeze 2.1.29 or later.
|
||||
|
||||
## [2.1.26] - 2026-10-10
|
||||
|
||||
- Bring Diary's title bar, undo and redo, and spelling correction, and Lumi's typing dots.
|
||||
- Requires Inner Breeze 2.1.29 or later.
|
||||
|
||||
## [2.1.25] - 2026-10-10
|
||||
|
||||
- Open Leaderboard as its own app.
|
||||
- Requires Inner Breeze 2.1.28 or later.
|
||||
|
||||
## [2.1.24] - 2026-10-10
|
||||
|
||||
- Remove the text of practice window buttons that are no longer shown.
|
||||
|
||||
## [2.1.23] - 2026-10-10
|
||||
|
||||
- Translate the descriptions in Lumi's command list.
|
||||
|
||||
## [2.1.22] - 2026-10-10
|
||||
|
||||
- Say which app, device and system details Lumi feedback includes before you send it.
|
||||
|
||||
## [2.1.21] - 2026-10-10
|
||||
|
||||
- Explain when approved Lumi feedback is still waiting to send and when the developer inbox has received it.
|
||||
|
||||
## [2.1.20] - 2026-10-09
|
||||
|
||||
- Customize each app in Appearance using live KSS editing, inspection, undo, and reset to defaults.
|
||||
|
||||
+7
-2
@@ -1,5 +1,6 @@
|
||||
// The portable root owns app selection and unified navigation policy.
|
||||
// Its assets contain Lumi, Habits and Practices as recommended cells.
|
||||
// Its assets contain Lumi, Habits and Practices as recommended cells, and
|
||||
// Lists, Diary and Leaderboard as optional ones.
|
||||
#import, file "../../src/cells/inbe_types.zi";
|
||||
#import, file "inbe_view.zi";
|
||||
#import, file "../../src/cells/module_types.zi";
|
||||
@@ -16,6 +17,9 @@ InbeAppForScreen :: (screen: s32) -> s32 {
|
||||
if screen == ScreenDiary {
|
||||
return APP_DIARY
|
||||
}
|
||||
if screen == ScreenLeaderboard {
|
||||
return APP_LEADERBOARD
|
||||
}
|
||||
if screen == ScreenEList {
|
||||
return APP_LISTS
|
||||
}
|
||||
@@ -62,7 +66,8 @@ InbeApply :: (message: InbeMessage) -> InbeMessage {
|
||||
}
|
||||
if message.action == INBE_TOGGLE_APP {
|
||||
if message.app != APP_LISTS && message.app != APP_HABITS &&
|
||||
message.app != APP_PRACTICE && message.app != APP_DIARY && message.app != APP_LUMI {
|
||||
message.app != APP_PRACTICE && message.app != APP_DIARY && message.app != APP_LUMI &&
|
||||
message.app != APP_LEADERBOARD {
|
||||
message.succeeded = false
|
||||
return message
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
# 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.
|
||||
|
||||
## [1.0.0] - 2026-10-10
|
||||
|
||||
- Rank yourself with your friends for Wim Hof, breathing patterns, meditation and Sun Salutation.
|
||||
- Sort by current streak, or by average hold in Wim Hof and average time in meditation.
|
||||
- Requires Inner Breeze 2.1.28 or later.
|
||||
@@ -0,0 +1,34 @@
|
||||
// Leaderboard ranks you with your friends for each practice. The unified
|
||||
// host fetches friend results, keeps them for offline use and ranks rows.
|
||||
#import, file "../../src/cells/leaderboard_types.zi";
|
||||
#import, file "../../src/cells/module_types.zi";
|
||||
#import, file "../../src/core/types.zi";
|
||||
#import, file "leaderboard_view.zi";
|
||||
host_api :: #system_library "host_api";
|
||||
ReadLeaderboardHost :: () -> LeaderboardMessage #foreign host_api;
|
||||
WriteLeaderboardHost :: (message: LeaderboardMessage) #foreign host_api;
|
||||
|
||||
LeaderboardApply :: (message: LeaderboardMessage) -> LeaderboardMessage {
|
||||
message.succeeded = true
|
||||
if message.action == LEADERBOARD_ROUTE {
|
||||
message.succeeded = message.screen == ScreenLeaderboard
|
||||
} else if message.action == LEADERBOARD_FRAME {
|
||||
message = LeaderboardView(message)
|
||||
} else {
|
||||
message.succeeded = false
|
||||
}
|
||||
return message
|
||||
}
|
||||
|
||||
#program_export "LeaderboardMain"
|
||||
Main :: () -> s32 {
|
||||
message := ReadLeaderboardHost()
|
||||
if message.abi != MODULE_ABI {
|
||||
return -1
|
||||
}
|
||||
if message.action == MODULE_IDENTIFY {
|
||||
return MODULE_LEADERBOARD
|
||||
}
|
||||
WriteLeaderboardHost(LeaderboardApply(message))
|
||||
return 0
|
||||
}
|
||||
@@ -0,0 +1,168 @@
|
||||
// Leaderboard owns its screen composition; the host supplies ranked rows,
|
||||
// prepared once when results arrive, and ordinary Kryon widget effects.
|
||||
#import "session"
|
||||
#import "geometry"
|
||||
#import "text"
|
||||
#import "vec"
|
||||
#import "drawing_props"
|
||||
#import "text_props"
|
||||
#import "text_align"
|
||||
#import "text_widget"
|
||||
#import "button_props"
|
||||
#import "button_widget"
|
||||
#import "control_props"
|
||||
#import "scroll_props"
|
||||
#import "scroll_widget"
|
||||
#import "box_props"
|
||||
#import "box_widget"
|
||||
#import "tree"
|
||||
#import, file "../../src/cells/leaderboard_ui_types.zi";
|
||||
#import, file "../../src/cells/leaderboard_types.zi";
|
||||
|
||||
using ButtonTone;
|
||||
using ButtonEmphasis;
|
||||
using TextAlign;
|
||||
using TextWrap;
|
||||
host_api :: #system_library "host_api";
|
||||
ReadLeaderboardUiHost :: () -> LeaderboardUiFrame #foreign host_api;
|
||||
WriteLeaderboardUiHost :: (frame: LeaderboardUiFrame) #foreign host_api;
|
||||
ReadLeaderboardRowHost :: (index: s32) -> LeaderboardUiRow #foreign host_api;
|
||||
LeaderboardLocaleHost :: (key: string) -> string #foreign host_api;
|
||||
frame: LeaderboardUiFrame;
|
||||
state: LeaderboardMessage;
|
||||
|
||||
// Wim Hof, breathing patterns, meditation and Sun Salutation, as in Practice.
|
||||
PRACTICE_COUNT :: 4
|
||||
PracticeAt :: (index: s32) -> s32 {
|
||||
ids: [PRACTICE_COUNT]s32 = .[0, 3, 1, 2]
|
||||
return ids[index]
|
||||
}
|
||||
|
||||
PracticeLabel :: (practice: s32) -> string {
|
||||
if practice == 1 { return LeaderboardLocaleHost("exercise_meditation") }
|
||||
if practice == 2 { return LeaderboardLocaleHost("exercise_sun_salutation") }
|
||||
if practice == 3 { return LeaderboardLocaleHost("exercise_patterns") }
|
||||
return LeaderboardLocaleHost("exercise_wim_hof")
|
||||
}
|
||||
|
||||
Scale :: (pixels: s32) -> s32 {
|
||||
return cast(s32)(cast(float32)pixels * frame.scale)
|
||||
}
|
||||
|
||||
Bounds :: (x: s32, y: s32, width: s32, height: s32) -> Rectangle {
|
||||
return Rectangle.{cast(float32)x, cast(float32)y,
|
||||
cast(float32)width, cast(float32)height}
|
||||
}
|
||||
|
||||
Finish :: () -> LeaderboardMessage {
|
||||
WriteLeaderboardUiHost(frame)
|
||||
state.succeeded = true
|
||||
return state
|
||||
}
|
||||
|
||||
Cell :: (key: u64, x: s32, y: s32, width: s32, height: s32, text: string) {
|
||||
Text(frame.session, TextProps.{.key = key, .bounds = Bounds(x, y, width, height),
|
||||
.text = text, .font = frame.font, .wrap = cast(TextWrap)TextWrapNone,
|
||||
.vertical_align = cast(TextAlign)TextAlignCenter})
|
||||
}
|
||||
|
||||
LeaderboardView :: (message: LeaderboardMessage) -> LeaderboardMessage {
|
||||
frame = ReadLeaderboardUiHost()
|
||||
state = message
|
||||
x := Scale(16)
|
||||
width := frame.width - x * 2
|
||||
y := Scale(12)
|
||||
|
||||
// Every practice stays visible: two per row on phones, four when wide.
|
||||
per_row: s32 = ifx width >= Scale(600) then PRACTICE_COUNT else 2
|
||||
gap := Scale(8)
|
||||
choice_width := (width - gap * (per_row - 1)) / per_row
|
||||
for index: cast(s32)0..PRACTICE_COUNT - 1 {
|
||||
practice := PracticeAt(index)
|
||||
chosen := practice == state.practice
|
||||
choice_x := x + (index % per_row) * (choice_width + gap)
|
||||
choice_y := y + (index / per_row) * (Scale(40) + gap)
|
||||
if Button(frame.session, ButtonProps.{.id = 7100 + index,
|
||||
.bounds = Bounds(choice_x, choice_y, choice_width, Scale(40)),
|
||||
.label = PracticeLabel(practice), .selected = chosen, .fit_content = true,
|
||||
.tone = cast(ButtonTone)(ifx chosen then ButtonToneAccent else ButtonToneNeutral),
|
||||
.emphasis = cast(ButtonEmphasis)ButtonEmphasisSoft}) != 0 && !chosen {
|
||||
state.practice = practice
|
||||
state.metric = LEADERBOARD_STREAK
|
||||
state.refresh = true
|
||||
frame.scroll = 0
|
||||
return Finish()
|
||||
}
|
||||
}
|
||||
y += (PRACTICE_COUNT / per_row) * (Scale(40) + gap) + Scale(8)
|
||||
|
||||
// The name column is wider when only the streak is ranked.
|
||||
columns: s32 = ifx state.has_average then 3 else 2
|
||||
name_width := ifx state.has_average then width / 2 else (width * 2) / 3
|
||||
value_width := ifx state.has_average then (width - name_width) / 2 else width - name_width
|
||||
average_label := ifx state.practice == 1 then "profile_metric_avg_time" else "profile_metric_avg_hold"
|
||||
labels: [3]string = .[LeaderboardLocaleHost("profile_friends_title"),
|
||||
LeaderboardLocaleHost("profile_metric_streak"), LeaderboardLocaleHost(average_label)]
|
||||
header_x := x
|
||||
for column: cast(s32)0..columns - 1 {
|
||||
column_width := ifx column == 0 then name_width else ifx column == columns - 1 then x + width - header_x else value_width
|
||||
metric := column - 1
|
||||
active := column > 0 && state.metric == metric
|
||||
if Button(frame.session, ButtonProps.{.id = 7110 + column,
|
||||
.bounds = Bounds(header_x, y, column_width, Scale(36)),
|
||||
.label = labels[column], .disabled = column == 0, .selected = active,
|
||||
.fit_content = true,
|
||||
.tone = cast(ButtonTone)(ifx active then ButtonToneAccent else ButtonToneNeutral),
|
||||
.emphasis = cast(ButtonEmphasis)ButtonEmphasisSoft}) != 0 &&
|
||||
column > 0 && !active {
|
||||
state.metric = metric
|
||||
return Finish()
|
||||
}
|
||||
header_x += column_width
|
||||
}
|
||||
y += Scale(44)
|
||||
|
||||
if state.row_count == 0 {
|
||||
key := ifx state.loading then "profile_updating_status" else "profile_no_leaderboard_data"
|
||||
Text(frame.session, TextProps.{.key = cast(u64)7120,
|
||||
.bounds = Bounds(x, y, width, Scale(32)), .text = LeaderboardLocaleHost(key),
|
||||
.font = frame.font, .wrap = cast(TextWrap)TextWrapAuto})
|
||||
return Finish()
|
||||
}
|
||||
|
||||
row_height := Scale(40)
|
||||
scroll := Scroll(frame.session, ScrollProps.{.key = cast(u64)7130,
|
||||
.bounds = Bounds(x, y, width, frame.height - frame.bottom - y - Scale(8)),
|
||||
.content_height = state.row_count * row_height, .scroll_offset = frame.scroll})
|
||||
frame.scroll = scroll.scroll_offset
|
||||
if !scroll.opened {
|
||||
return Finish()
|
||||
}
|
||||
row_y := cast(s32)scroll.content.y
|
||||
left := cast(s32)scroll.content.x
|
||||
for index: cast(s32)0..state.row_count - 1 {
|
||||
// Rows outside the viewport are not read from the host.
|
||||
if row_y + row_height > cast(s32)scroll.viewport.y &&
|
||||
row_y < cast(s32)(scroll.viewport.y + scroll.viewport.height) {
|
||||
row := ReadLeaderboardRowHost(index)
|
||||
key := cast(u64)(7200 + index * 4)
|
||||
if row.own || index % 2 == 1 {
|
||||
Box(frame.session, BoxProps.{.key = key, .bounds = Bounds(left, row_y, width, row_height),
|
||||
.fill = ifx row.own then Color.{156, 188, 143, 64} else Color.{156, 156, 156, 24},
|
||||
.radius = cast(float32)Scale(8)})
|
||||
}
|
||||
name: Vec(u8)
|
||||
BuilderPrint(*name, "%. %", row.rank, row.name)
|
||||
pad := Scale(8)
|
||||
Cell(key + 1, left + pad, row_y, name_width - pad * 2, row_height, BuilderFinish(name))
|
||||
Cell(key + 2, left + name_width + pad, row_y, value_width - pad, row_height, row.streak)
|
||||
if state.has_average {
|
||||
Cell(key + 3, left + name_width + value_width + pad, row_y,
|
||||
width - name_width - value_width - pad, row_height, row.average)
|
||||
}
|
||||
}
|
||||
row_y += row_height
|
||||
}
|
||||
End(frame.session)
|
||||
return Finish()
|
||||
}
|
||||
@@ -1,5 +1,18 @@
|
||||
# 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.
|
||||
- Scrolling while you type a new item keeps the keyboard open.
|
||||
|
||||
## [1.0.4] - 2026-10-10
|
||||
|
||||
- Requires Inner Breeze 2.1.28 or later.
|
||||
|
||||
## [1.0.3] - 2026-10-07
|
||||
|
||||
- Keep app labels and content visible after updating Inner Breeze.
|
||||
|
||||
@@ -1,5 +1,48 @@
|
||||
# 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.
|
||||
### Changed
|
||||
- Scrollbars use your theme's colours and show how much of the chat is in view.
|
||||
|
||||
## [1.3.8] - 2026-10-11
|
||||
### Added
|
||||
- Select messages like in Telegram: hold a message to select it, then tap or drag across others; dragging to the top or bottom of the chat scrolls it, through older messages too. Checkmarks show what is selected, and a bar over the top of the chat shows how many, with copy and delete.
|
||||
### Changed
|
||||
- Lumi's typing dots appear after a short pause, as a person reads before typing.
|
||||
- Feedback shows only its card with Yes and No, without a second copy of the question.
|
||||
|
||||
## [1.3.7] - 2026-10-11
|
||||
### Changed
|
||||
- Like Telegram, the chat shows your newest messages and loads older ones as you scroll up, right away while the newest do not fill the screen.
|
||||
|
||||
## [1.3.6] - 2026-10-10
|
||||
### Added
|
||||
- While Lumi is answering, three dots show in its bubble where the answer will appear.
|
||||
|
||||
## [1.3.5] - 2026-10-10
|
||||
|
||||
- Requires Inner Breeze 2.1.28 or later.
|
||||
|
||||
## [1.3.4] - 2026-10-10
|
||||
### Added
|
||||
- Tap the / button or type / to see Lumi's commands, as in Telegram. The list narrows as you type; tap a command or press Enter to use it, and commands that need text wait for it in the message box.
|
||||
### Changed
|
||||
- Send with an arrow button.
|
||||
|
||||
## [1.3.3] - 2026-10-10
|
||||
### Fixed
|
||||
- Open the chat without a pause by preparing command suggestions only while you type.
|
||||
|
||||
@@ -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}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
@@ -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)
|
||||
}
|
||||
+163
-6
@@ -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
|
||||
@@ -137,8 +292,10 @@ LumiRespond :: (input: string) {
|
||||
if PerformLumiActionHost(action) {
|
||||
SetLumiHabitChoiceHost(false)
|
||||
SetLumiDiaryChoiceHost(false)
|
||||
if action.kind == LUMI_SHOW_PROGRESS || action.kind == LUMI_SHOW_DONATIONS {
|
||||
// These tools already appended their typed card to the chat.
|
||||
if action.kind == LUMI_SHOW_PROGRESS || action.kind == LUMI_SHOW_DONATIONS ||
|
||||
action.kind == LUMI_REPORT_FEEDBACK {
|
||||
// These tools already appended their typed card to the chat;
|
||||
// the feedback card with Yes and No is the whole answer.
|
||||
return
|
||||
}
|
||||
reply = "lumi_opened"
|
||||
@@ -156,14 +313,14 @@ LumiRespond :: (input: string) {
|
||||
reply = "lumi_practice_started"
|
||||
} else if action.kind == LUMI_WRITE_DIARY {
|
||||
reply = "lumi_diary_saved"
|
||||
} else if action.kind == LUMI_REPORT_FEEDBACK {
|
||||
reply = "lumi_feedback_confirm"
|
||||
}
|
||||
} else {
|
||||
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" {
|
||||
|
||||
+700
-28
@@ -13,21 +13,34 @@
|
||||
#import "control_props"
|
||||
#import "box_props"
|
||||
#import "box_widget"
|
||||
#import "checkbox_props"
|
||||
#import "checkbox_widget"
|
||||
#import "press_props"
|
||||
#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;
|
||||
using TextAlign;
|
||||
using ButtonTone;
|
||||
using ButtonEmphasis;
|
||||
host_api :: #system_library "host_api";
|
||||
@@ -39,11 +52,20 @@ ReadLumiSuggestionHabitHost :: (index: s32) -> LumiTask #foreign host_api;
|
||||
LumiViewLocaleHost :: (key: string) -> string #foreign host_api;
|
||||
LumiFeedbackChoiceHost :: (id: string, action: s32) -> bool #foreign host_api;
|
||||
LumiLoadOlderHost :: () -> bool #foreign host_api;
|
||||
LumiDeleteRowHost :: (index: s32) -> bool #foreign host_api;
|
||||
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;
|
||||
@@ -70,6 +92,295 @@ candidate_ready: s32;
|
||||
// Reading a command takes many text matches, so typing reads one per frame.
|
||||
LUMI_CANDIDATES_PER_FRAME :: 1
|
||||
|
||||
// Typing "/" lists Lumi's commands as in Telegram. The list matches the
|
||||
// command menu of Lumi's Telegram bot, without its Telegram-only commands.
|
||||
LumiMenuCommand :: struct {
|
||||
name: string
|
||||
description: string
|
||||
// These commands insert "/name " for the text instead of sending.
|
||||
needs_text: bool
|
||||
requirement: s32
|
||||
// Shown only while Lumi waits for a Diary text or a habit name.
|
||||
choice_only: bool
|
||||
}
|
||||
|
||||
LUMI_MENU_COMMANDS :: 16
|
||||
menu_revision: s64 = -1;
|
||||
menu_commands: [LUMI_MENU_COMMANDS]LumiMenuCommand;
|
||||
menu_scroll: s32;
|
||||
focus_request: s32;
|
||||
// Telegram-style selection: hold a message to select it, then tap messages
|
||||
// or drag across them; dragging near the chat's top or bottom scrolls it.
|
||||
// Rows are counted from the newest message, which older messages loading
|
||||
// above do not change, so a sweep can keep going up through the history.
|
||||
// The greeting above every message is kept apart.
|
||||
LUMI_SELECT_MAX :: 4096
|
||||
selecting: bool;
|
||||
selected: [LUMI_SELECT_MAX]bool;
|
||||
greeting_selected: bool;
|
||||
selected_count: s32;
|
||||
sweeping: bool;
|
||||
// The row the sweep began on, counted from the newest message; -1 is the
|
||||
// greeting.
|
||||
sweep_anchor: s32;
|
||||
sweep_value: bool;
|
||||
// Where the pointer is during a sweep, for scrolling at the chat's edges.
|
||||
sweep_pointer_y: float32;
|
||||
sweep_seen: bool;
|
||||
confirm_delete: bool;
|
||||
// Copied text waits until the composer has written its own clipboard state.
|
||||
pending_copy: string;
|
||||
copy_pending: bool;
|
||||
LUMI_CLOSE_ICON :: "S1.8rr:M6 6L18 18M18 6L6 18"
|
||||
LUMI_COPY_ICON :: "S1.6rr:M9 9H20V20H9ZM15 5V4H4V15H5"
|
||||
LUMI_DELETE_ICON :: "S1.6rr:M3 6H21M9 6V3H15V6M5 6L6 21H18L19 6M10 10V17M14 10V17"
|
||||
|
||||
// A row's place counted from the newest message; the greeting is -1.
|
||||
RowSlot :: (index: s32) -> s32 {
|
||||
if index <= 0 {
|
||||
return -1
|
||||
}
|
||||
return frame.chat_count - 1 - index
|
||||
}
|
||||
|
||||
SlotRow :: (slot: s32) -> s32 {
|
||||
if slot < 0 {
|
||||
return 0
|
||||
}
|
||||
return frame.chat_count - 1 - slot
|
||||
}
|
||||
|
||||
IsSelected :: (index: s32) -> bool {
|
||||
slot := RowSlot(index)
|
||||
if slot < 0 {
|
||||
return greeting_selected
|
||||
}
|
||||
return slot < LUMI_SELECT_MAX && selected[slot]
|
||||
}
|
||||
|
||||
SelectionClear :: () {
|
||||
for index: cast(s32)0..LUMI_SELECT_MAX - 1 {
|
||||
selected[index] = false
|
||||
}
|
||||
greeting_selected = false
|
||||
selected_count = 0
|
||||
selecting = false
|
||||
sweeping = false
|
||||
confirm_delete = false
|
||||
}
|
||||
|
||||
SelectionSet :: (index: s32, value: bool) {
|
||||
if index < 0 || index >= frame.chat_count || IsSelected(index) == value {
|
||||
return
|
||||
}
|
||||
slot := RowSlot(index)
|
||||
if slot < 0 {
|
||||
greeting_selected = value
|
||||
} else if slot < LUMI_SELECT_MAX {
|
||||
selected[slot] = value
|
||||
} else {
|
||||
return
|
||||
}
|
||||
selected_count += ifx value then 1 else -1
|
||||
}
|
||||
|
||||
// A press began on a row: it selects or clears that row, and dragging then
|
||||
// gives every row it sweeps over the same state.
|
||||
SweepStart :: (index: s32, value: bool) {
|
||||
sweeping = true
|
||||
sweep_anchor = RowSlot(index)
|
||||
sweep_value = value
|
||||
SelectionSet(index, value)
|
||||
}
|
||||
|
||||
SweepTo :: (index: s32) {
|
||||
if index < 0 {
|
||||
index = 0
|
||||
}
|
||||
if index >= frame.chat_count {
|
||||
index = frame.chat_count - 1
|
||||
}
|
||||
anchor := SlotRow(sweep_anchor)
|
||||
first := ifx index < anchor then index else anchor
|
||||
last := ifx index < anchor then anchor else index
|
||||
for row: first..last {
|
||||
SelectionSet(row, sweep_value)
|
||||
}
|
||||
}
|
||||
|
||||
// The template with its %d replaced by the count.
|
||||
CountText :: (template: string, count: s32) -> string {
|
||||
out: Vec(u8)
|
||||
at: s64 = 0
|
||||
while at < template.count {
|
||||
if at + 1 < template.count && template[at] == cast(u8)37 && template[at + 1] == cast(u8)100 {
|
||||
BuilderPrint(*out, "%", count)
|
||||
at += 2
|
||||
} else {
|
||||
BuilderPrint(*out, "%", template[at:at + 1])
|
||||
at += 1
|
||||
}
|
||||
}
|
||||
return BuilderFinish(out)
|
||||
}
|
||||
|
||||
SelectedText :: () -> string {
|
||||
out: Vec(u8)
|
||||
written: s32 = 0
|
||||
for index: cast(s32)0..frame.chat_count - 1 {
|
||||
if !IsSelected(index) {
|
||||
continue
|
||||
}
|
||||
if written > 0 {
|
||||
BuilderPrint(*out, "\n\n")
|
||||
}
|
||||
BuilderPrint(*out, "%", ReadLumiChatRowHost(index).text)
|
||||
written += 1
|
||||
}
|
||||
return BuilderFinish(out)
|
||||
}
|
||||
|
||||
// The bar replacing the top of the chat while messages are selected: close,
|
||||
// the count, then copy and delete, with delete asking first.
|
||||
SelectionBar :: (x: s32, top: s32, width: s32) {
|
||||
control := Scale(44)
|
||||
Box(frame.session, BoxProps.{.key = cast(u64)300369,
|
||||
.bounds = Bounds(0, 0, frame.width, top + control + Scale(8)),
|
||||
.fill = frame.background})
|
||||
if confirm_delete {
|
||||
Text(frame.session, TextProps.{.key = cast(u64)300370,
|
||||
.bounds = Bounds(x, top, width - Scale(216), control),
|
||||
.text = LumiViewLocaleHost("lumi_delete_confirm"), .font = frame.font,
|
||||
.wrap = cast(TextWrap)TextWrapAuto, .vertical_align = cast(TextAlign)TextAlignCenter})
|
||||
if Button(frame.session, ButtonProps.{.id = 30020,
|
||||
.bounds = Bounds(x + width - Scale(208), top, Scale(100), control),
|
||||
.label = LumiViewLocaleHost("cancel_button"), .fit_content = true,
|
||||
.tone = cast(ButtonTone)ButtonToneNeutral, .emphasis = cast(ButtonEmphasis)ButtonEmphasisSoft}) != 0 {
|
||||
confirm_delete = false
|
||||
}
|
||||
if Button(frame.session, ButtonProps.{.id = 30021,
|
||||
.bounds = Bounds(x + width - Scale(100), top, Scale(100), control),
|
||||
.label = LumiViewLocaleHost("delete_button"), .fit_content = true,
|
||||
.tone = cast(ButtonTone)ButtonToneDanger, .emphasis = cast(ButtonEmphasis)ButtonEmphasisFilled}) != 0 {
|
||||
// From the last row back, so earlier rows keep their indices.
|
||||
index := frame.chat_count - 1
|
||||
while index >= 0 {
|
||||
if IsSelected(index) {
|
||||
unused LumiDeleteRowHost(index)
|
||||
}
|
||||
index -= 1
|
||||
}
|
||||
SelectionClear()
|
||||
}
|
||||
return
|
||||
}
|
||||
if Button(frame.session, ButtonProps.{.id = 30022, .bounds = Bounds(x, top, control, control),
|
||||
.label = LumiViewLocaleHost("lumi_cancel_selection"), .icon_shape = LUMI_CLOSE_ICON, .icon_only = true,
|
||||
.tone = cast(ButtonTone)ButtonToneNeutral, .emphasis = cast(ButtonEmphasis)ButtonEmphasisGhost}) != 0 {
|
||||
SelectionClear()
|
||||
return
|
||||
}
|
||||
Box(frame.session, BoxProps.{.key = cast(u64)300371,
|
||||
.bounds = Bounds(x + control + Scale(8), top + Scale(6), Scale(150), control - Scale(12)),
|
||||
.fill = Color.{156, 188, 143, 48}, .radius = cast(float32)(control - Scale(12)) / 2.0})
|
||||
Text(frame.session, TextProps.{.key = cast(u64)300372,
|
||||
.bounds = Bounds(x + control + Scale(8), top, Scale(150), control),
|
||||
.text = CountText(LumiViewLocaleHost("lumi_selected_count"), selected_count), .font = frame.font,
|
||||
.wrap = cast(TextWrap)TextWrapNone, .align = cast(TextAlign)TextAlignCenter,
|
||||
.vertical_align = cast(TextAlign)TextAlignCenter})
|
||||
if Button(frame.session, ButtonProps.{.id = 30023,
|
||||
.bounds = Bounds(x + width - 2 * control - Scale(4), top, control, control),
|
||||
.label = LumiViewLocaleHost("lumi_copy"), .icon_shape = LUMI_COPY_ICON, .icon_only = true,
|
||||
.tone = cast(ButtonTone)ButtonToneNeutral, .emphasis = cast(ButtonEmphasis)ButtonEmphasisGhost}) != 0 {
|
||||
pending_copy = SelectedText()
|
||||
copy_pending = true
|
||||
SelectionClear()
|
||||
return
|
||||
}
|
||||
if Button(frame.session, ButtonProps.{.id = 30024,
|
||||
.bounds = Bounds(x + width - control, top, control, control),
|
||||
.label = LumiViewLocaleHost("delete_button"), .icon_shape = LUMI_DELETE_ICON, .icon_only = true,
|
||||
.tone = cast(ButtonTone)ButtonToneDanger, .emphasis = cast(ButtonEmphasis)ButtonEmphasisGhost}) != 0 {
|
||||
confirm_delete = true
|
||||
}
|
||||
}
|
||||
// A rounded square with a slash, and a paper plane, in Kryon's 24 x 24 icon
|
||||
// shape format.
|
||||
LUMI_COMMANDS_ICON :: "S1.8rr:M7 3H17C19.2091 3 21 4.79086 21 7V17C21 19.2091 19.2091 21 17 21H7C4.79086 21 3 19.2091 3 17V7C3 4.79086 4.79086 3 7 3Z|S1.8rr:M14.5 7.5L9.5 16.5"
|
||||
LUMI_SEND_ICON :: "F:M3.4 20.6L21.2 12.9C21.94 12.58 21.94 11.42 21.2 11.1L3.4 3.4C2.66 3.08 1.9 3.8 2.14 4.57L4.2 11L13 12L4.2 13L2.14 19.43C1.9 20.2 2.66 20.92 3.4 20.6Z"
|
||||
|
||||
MenuCommands :: (revision: s64) -> []LumiMenuCommand {
|
||||
if revision != menu_revision {
|
||||
menu_revision = revision
|
||||
table: [LUMI_MENU_COMMANDS]LumiMenuCommand = .[
|
||||
LumiMenuCommand.{.name = "/help", .description = LumiViewLocaleHost("lumi_command_help")},
|
||||
LumiMenuCommand.{.name = "/todo", .description = LumiViewLocaleHost("lumi_add"),
|
||||
.needs_text = true, .requirement = LUMI_LISTS},
|
||||
LumiMenuCommand.{.name = "/done", .description = LumiViewLocaleHost("lumi_complete"),
|
||||
.needs_text = true, .requirement = LUMI_LISTS},
|
||||
LumiMenuCommand.{.name = "/reopen", .description = LumiViewLocaleHost("lumi_reopen"),
|
||||
.needs_text = true, .requirement = LUMI_LISTS},
|
||||
LumiMenuCommand.{.name = "/lists", .description = LumiViewLocaleHost("lumi_open_lists"),
|
||||
.requirement = LUMI_LISTS},
|
||||
LumiMenuCommand.{.name = "/habit", .description = LumiViewLocaleHost("lumi_complete_habit"),
|
||||
.requirement = LUMI_HABITS},
|
||||
LumiMenuCommand.{.name = "/habits", .description = LumiViewLocaleHost("lumi_open_habits"),
|
||||
.requirement = LUMI_HABITS},
|
||||
LumiMenuCommand.{.name = "/journal", .description = LumiViewLocaleHost("lumi_write_diary"),
|
||||
.requirement = LUMI_DIARY},
|
||||
LumiMenuCommand.{.name = "/diary", .description = LumiViewLocaleHost("lumi_open_diary"),
|
||||
.requirement = LUMI_DIARY},
|
||||
LumiMenuCommand.{.name = "/meditate", .description = LumiViewLocaleHost("lumi_start_meditation"),
|
||||
.requirement = LUMI_PRACTICES},
|
||||
LumiMenuCommand.{.name = "/whm", .description = LumiViewLocaleHost("lumi_start_whm"),
|
||||
.requirement = LUMI_PRACTICES},
|
||||
LumiMenuCommand.{.name = "/practices", .description = LumiViewLocaleHost("lumi_open_practices"),
|
||||
.requirement = LUMI_PRACTICES},
|
||||
LumiMenuCommand.{.name = "/progress", .description = LumiViewLocaleHost("lumi_show_progress"),
|
||||
.requirement = LUMI_PRACTICES},
|
||||
LumiMenuCommand.{.name = "/feedback", .description = LumiViewLocaleHost("lumi_command_feedback"),
|
||||
.needs_text = true},
|
||||
LumiMenuCommand.{.name = "/donate", .description = LumiViewLocaleHost("lumi_show_donations")},
|
||||
LumiMenuCommand.{.name = "/cancel", .description = LumiViewLocaleHost("cancel_button"),
|
||||
.choice_only = true}]
|
||||
menu_commands = table
|
||||
}
|
||||
return menu_commands[:]
|
||||
}
|
||||
|
||||
// A draft of "/" and a command name opens the list; a space closes it,
|
||||
// since the command then takes its text.
|
||||
MenuOpen :: (value: string) -> bool {
|
||||
if value.count == 0 || value[0] != cast(u8)47 {
|
||||
return false
|
||||
}
|
||||
for byte: value {
|
||||
if CommandSpace(byte) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
CommandText :: (command: LumiMenuCommand) -> string {
|
||||
if !command.needs_text {
|
||||
return command.name
|
||||
}
|
||||
out: Vec(u8)
|
||||
BuilderPrint(*out, "% ", command.name)
|
||||
return BuilderFinish(out)
|
||||
}
|
||||
|
||||
FillDraft :: (text: string) {
|
||||
frame.value = text
|
||||
frame.cursor = cast(s32)text.count
|
||||
frame.anchor = frame.cursor
|
||||
frame.input_scroll = 0
|
||||
frame.selecting = false
|
||||
frame.preferred_x_valid = false
|
||||
frame.focused = true
|
||||
}
|
||||
|
||||
// Interpretation depends on the draft and translated command set. Cursor
|
||||
// blinking, scrolling and unchanged frames reuse the result, while sending
|
||||
// still validates the request against the current tools in LumiRespond.
|
||||
@@ -116,13 +427,7 @@ Suggestion :: (id: s32, text: string, bounds: Rectangle, label: string = "") ->
|
||||
if Button(frame.session, ButtonProps.{.id = id, .bounds = bounds,
|
||||
.label = ifx label.count > 0 then label else text, .pill = true, .tone = cast(ButtonTone)ButtonToneNeutral,
|
||||
.emphasis = cast(ButtonEmphasis)ButtonEmphasisSoft}) != 0 {
|
||||
frame.value = text
|
||||
frame.cursor = cast(s32)text.count
|
||||
frame.anchor = frame.cursor
|
||||
frame.input_scroll = 0
|
||||
frame.selecting = false
|
||||
frame.preferred_x_valid = false
|
||||
frame.focused = true
|
||||
FillDraft(text)
|
||||
return true
|
||||
}
|
||||
return false
|
||||
@@ -238,8 +543,185 @@ DonationCard :: (index: s32, x: s32, y: s32, width: s32) {
|
||||
}
|
||||
}
|
||||
|
||||
// Lumi's bubble with three dots that brighten and rise in turn, where its
|
||||
// answer will appear.
|
||||
TypingDots :: (x: s32, top: s32) {
|
||||
left := x + Scale(48)
|
||||
Image(frame.session, ImageProps.{.key = cast(u64)300380,
|
||||
.asset_path = "assets/lumi/mascot.png", .alt_text = "Lumi",
|
||||
.bounds = Bounds(x, top + Scale(16), Scale(40), Scale(40)),
|
||||
.source = Rectangle.{0.0, 0.0, -1254.0, 1254.0},
|
||||
.fit = cast(ImageFit)ImageFitContain})
|
||||
Box(frame.session, BoxProps.{.key = cast(u64)300381,
|
||||
.bounds = Bounds(left, top, Scale(96), Scale(60)),
|
||||
.fill = Color.{156, 156, 156, 24}, .radius = cast(float32)Scale(16)})
|
||||
Text(frame.session, TextProps.{.key = cast(u64)300382,
|
||||
.bounds = Bounds(left + Scale(14), top + Scale(8), Scale(68), Scale(20)),
|
||||
.text = "Lumi", .font = Scale(12)})
|
||||
for dot: cast(s32)0..2 {
|
||||
phase := frame.now * 1.4 - cast(float64)dot * 0.2
|
||||
phase = phase - cast(float64)cast(s64)phase
|
||||
if phase < 0.0 {
|
||||
phase += 1.0
|
||||
}
|
||||
level := ifx phase < 0.5 then phase * 2.0 else (1.0 - phase) * 2.0
|
||||
size := Scale(8)
|
||||
Box(frame.session, BoxProps.{.key = cast(u64)(300383 + dot),
|
||||
.bounds = Bounds(left + Scale(16) + dot * Scale(14),
|
||||
top + Scale(38) - cast(s32)(level * cast(float64)Scale(4)), size, size),
|
||||
.fill = Color.{170, 170, 170, cast(u8)(90.0 + 165.0 * level)},
|
||||
.radius = cast(float32)size / 2.0})
|
||||
}
|
||||
}
|
||||
|
||||
// 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) {
|
||||
key := ifx index == 0 then 0 else RowSlot(index) + 1
|
||||
press := Press(frame.session, PressProps.{.key = cast(u64)(410000 + key), .bounds = bounds,
|
||||
.label = LumiViewLocaleHost("lumi_message"), .now = frame.now, .capture = selecting})
|
||||
if !selecting && press.held {
|
||||
selecting = true
|
||||
confirm_delete = false
|
||||
SweepStart(index, true)
|
||||
} else if selecting && press.down && !sweeping {
|
||||
SweepStart(index, !IsSelected(index))
|
||||
}
|
||||
if sweeping && press.down {
|
||||
sweep_seen = true
|
||||
sweep_pointer_y = press.y
|
||||
SweepTo(LumiFirstVisibleRowHost(cast(s32)(press.y - content_y)))
|
||||
}
|
||||
if press.released {
|
||||
sweeping = false
|
||||
}
|
||||
}
|
||||
|
||||
// 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
|
||||
@@ -253,7 +735,45 @@ 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
|
||||
// Enter chooses the exact command, otherwise the first one listed.
|
||||
menu_target: s32 = -1
|
||||
if MenuOpen(frame.value) {
|
||||
for index: cast(s32)0..LUMI_MENU_COMMANDS - 1 {
|
||||
command := menu[index]
|
||||
if (command.requirement != 0 && (frame.available_apps & command.requirement) == 0) ||
|
||||
(command.choice_only && !frame.choosing_habit && !frame.choosing_diary) ||
|
||||
!LumiStarts(command.name, frame.value) {
|
||||
continue
|
||||
}
|
||||
if menu_target < 0 || LumiEqual(command.name, frame.value) {
|
||||
menu_target = menu_count
|
||||
}
|
||||
menu_matches[menu_count] = index
|
||||
menu_count += 1
|
||||
}
|
||||
}
|
||||
menu_row := Scale(44)
|
||||
menu_height := menu_count * menu_row
|
||||
// Four and a half rows show that a longer list scrolls.
|
||||
if menu_height > menu_row * 9 / 2 {
|
||||
menu_height = menu_row * 9 / 2
|
||||
}
|
||||
if menu_count > 0 && footer - Scale(8) - menu_height - history_top < Scale(68) {
|
||||
menu_height = footer - Scale(8) - history_top - Scale(68)
|
||||
if menu_height < menu_row {
|
||||
menu_height = menu_row
|
||||
}
|
||||
}
|
||||
menu_top := footer - Scale(8) - menu_height
|
||||
if menu_count > 0 {
|
||||
suggestions_top = menu_top
|
||||
} else {
|
||||
menu_scroll = 0
|
||||
}
|
||||
chat_height := suggestions_top - history_top - Scale(8)
|
||||
if chat_height < Scale(60) {
|
||||
chat_height = Scale(60)
|
||||
@@ -261,11 +781,20 @@ LumiView :: (message: LumiMessage, commands: LumiCommands, revision: s64) -> Lum
|
||||
if frame.follow_end {
|
||||
frame.scroll = 1000000
|
||||
}
|
||||
// While Lumi answers, its typing dots follow the last message after a
|
||||
// short pause.
|
||||
typing := frame.waiting && !frame.typing_pause
|
||||
typing_height := ifx typing then Scale(70) else 0
|
||||
history := Scroll(frame.session, ScrollProps.{.key = cast(u64)300100,
|
||||
.bounds = Bounds(x, history_top, width, chat_height),
|
||||
.content_height = frame.history_height, .scroll_offset = frame.scroll, .scale = frame.scale})
|
||||
.content_height = frame.history_height + typing_height, .scroll_offset = frame.scroll, .scale = frame.scale})
|
||||
frame.scroll = history.scroll_offset
|
||||
frame.follow_end = history.scroll_offset == history.max_scroll
|
||||
// Older messages load when the chat reaches its top, and at once while
|
||||
// the loaded ones do not fill the chat, which then cannot scroll.
|
||||
load_older := frame.has_older &&
|
||||
(history.max_scroll <= 0 || (!frame.follow_end && frame.scroll <= Scale(96)))
|
||||
anchor_drawn := false
|
||||
if history.opened {
|
||||
first := LumiFirstVisibleRowHost(history.scroll_offset)
|
||||
top := cast(s32)history.content.y + LumiRowOffsetHost(first)
|
||||
@@ -277,12 +806,21 @@ LumiView :: (message: LumiMessage, commands: LumiCommands, revision: s64) -> Lum
|
||||
row_height := row.height
|
||||
bubble_width := width - Scale(ifx row.user then 60 else 80)
|
||||
left := x + Scale(48)
|
||||
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})
|
||||
// The whole row takes holds and sweeps; its buttons sit above it.
|
||||
RowPress(index, Bounds(x, top, width, row_height - Scale(10)), history.content.y)
|
||||
if RowSlot(index) == sweep_anchor {
|
||||
anchor_drawn = true
|
||||
}
|
||||
if selecting {
|
||||
checked := IsSelected(index)
|
||||
toggled := Checkbox(frame.session, CheckboxProps.{.key = cast(u64)(420000 + RowSlot(index) + 1),
|
||||
.bounds = Bounds(x + Scale(8), top + (row_height - Scale(10)) / 2 - Scale(12), Scale(24), Scale(24)),
|
||||
.label = LumiViewLocaleHost("lumi_message"), .checked = checked})
|
||||
if toggled.changed {
|
||||
SelectionSet(index, toggled.checked)
|
||||
}
|
||||
} else if !row.user {
|
||||
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)),
|
||||
@@ -300,7 +838,7 @@ LumiView :: (message: LumiMessage, commands: LumiCommands, revision: s64) -> Lum
|
||||
props := TextProps.{.key = cast(u64)(300403 + index * 4),
|
||||
.bounds = Bounds(left + Scale(14), top + text_top,
|
||||
bubble_width - Scale(28), text_height),
|
||||
.text = row.text, .font = frame.font, .selectable = true,
|
||||
.text = row.text, .font = frame.font,
|
||||
.wrap = cast(TextWrap)TextWrapAuto}
|
||||
if !row.user {
|
||||
formatted := ReplyText(index, row.text)
|
||||
@@ -328,8 +866,54 @@ LumiView :: (message: LumiMessage, commands: LumiCommands, revision: s64) -> Lum
|
||||
}
|
||||
top += row_height
|
||||
}
|
||||
if typing {
|
||||
TypingDots(x, cast(s32)history.content.y + frame.history_height)
|
||||
}
|
||||
// Scrolling can carry the row the sweep began on out of view; its
|
||||
// press stays registered so the sweep goes on.
|
||||
if sweeping && !anchor_drawn {
|
||||
anchor := SlotRow(sweep_anchor)
|
||||
if anchor >= 0 && anchor < frame.chat_count {
|
||||
anchor_top := cast(s32)history.content.y + LumiRowOffsetHost(anchor)
|
||||
RowPress(anchor, Bounds(x, anchor_top, width,
|
||||
ReadLumiChatRowHost(anchor).height - Scale(10)), history.content.y)
|
||||
}
|
||||
}
|
||||
End(frame.session)
|
||||
}
|
||||
// Dragging near the chat's top or bottom scrolls it, faster nearer the
|
||||
// edge, so a sweep can reach every message.
|
||||
if sweeping && sweep_seen {
|
||||
edge := cast(float32)Scale(56)
|
||||
top_edge := cast(float32)Scale(60) + edge
|
||||
bottom_edge := cast(float32)(history_top + chat_height) - edge
|
||||
if sweep_pointer_y < top_edge {
|
||||
step := cast(s32)((top_edge - sweep_pointer_y) / 3.0) + Scale(4)
|
||||
if step > Scale(40) {
|
||||
step = Scale(40)
|
||||
}
|
||||
frame.scroll -= step
|
||||
if frame.scroll < 0 {
|
||||
frame.scroll = 0
|
||||
}
|
||||
frame.follow_end = false
|
||||
} else if sweep_pointer_y > bottom_edge {
|
||||
step := cast(s32)((sweep_pointer_y - bottom_edge) / 3.0) + Scale(4)
|
||||
if step > Scale(40) {
|
||||
step = Scale(40)
|
||||
}
|
||||
frame.scroll += step
|
||||
}
|
||||
}
|
||||
sweep_seen = false
|
||||
if selecting && selected_count <= 0 && !sweeping {
|
||||
SelectionClear()
|
||||
}
|
||||
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,
|
||||
commands.start_meditation, commands.start_sun, commands.start_patterns,
|
||||
@@ -342,8 +926,9 @@ LumiView :: (message: LumiMessage, commands: LumiCommands, revision: s64) -> Lum
|
||||
LUMI_LISTS, LUMI_HABITS, LUMI_PRACTICES, LUMI_DIARY, 0, 0, 0, 0, 0, LUMI_DIARY, LUMI_PRACTICES, 0]
|
||||
suggestion_count: s32 = 0
|
||||
selected: bool
|
||||
limit: s32 = 2
|
||||
chip_width := (width - Scale(8)) / limit
|
||||
// The command list replaces the suggestion chips while it is open.
|
||||
limit: s32 = ifx menu_count > 0 then 0 else 2
|
||||
chip_width := (width - Scale(8)) / 2
|
||||
action := DraftIntent(typed, commands, revision)
|
||||
if action.kind == 0 && frame.choosing_habit {
|
||||
action = LumiAction.{.kind = LUMI_COMPLETE_HABIT, .title = typed}
|
||||
@@ -411,13 +996,79 @@ LumiView :: (message: LumiMessage, commands: LumiCommands, revision: s64) -> Lum
|
||||
Bounds(x + suggestion_count * (chip_width + Scale(8)), suggestions_top, chip_width, Scale(36))) || selected
|
||||
suggestion_count += 1
|
||||
}
|
||||
chosen: s32 = -1
|
||||
if menu_count > 0 {
|
||||
Box(frame.session, BoxProps.{.key = cast(u64)360000,
|
||||
.bounds = Bounds(x, menu_top, width, menu_height),
|
||||
.fill = Color.{156, 156, 156, 24}, .radius = cast(float32)Scale(12)})
|
||||
menu_list := Scroll(frame.session, ScrollProps.{.key = cast(u64)360001,
|
||||
.bounds = Bounds(x, menu_top, width, menu_height),
|
||||
.content_height = menu_count * menu_row, .scroll_offset = menu_scroll, .scale = frame.scale})
|
||||
menu_scroll = menu_list.scroll_offset
|
||||
if menu_list.opened {
|
||||
name_width := Scale(104)
|
||||
for row: cast(s32)0..menu_count - 1 {
|
||||
top := cast(s32)menu_list.content.y + row * menu_row
|
||||
if top + menu_row < menu_top || top > menu_top + menu_height {
|
||||
continue
|
||||
}
|
||||
index := menu_matches[row]
|
||||
command := menu[index]
|
||||
key := 360100 + index * 4
|
||||
if row == menu_target {
|
||||
Box(frame.session, BoxProps.{.key = cast(u64)key,
|
||||
.bounds = Bounds(x, top, width, menu_row),
|
||||
.fill = Color.{156, 188, 143, 48}, .radius = cast(float32)Scale(12)})
|
||||
}
|
||||
if Button(frame.session, ButtonProps.{.id = 360200 + index,
|
||||
.bounds = Bounds(x, top, width, menu_row), .invisible = true,
|
||||
.label = command.description}) != 0 {
|
||||
chosen = index
|
||||
}
|
||||
strong: [1]TextRange = .[TextRange.{.start = 0, .end = cast(s32)command.name.count}]
|
||||
Text(frame.session, TextProps.{.key = cast(u64)(key + 1),
|
||||
.bounds = Bounds(x + Scale(16), top, name_width, menu_row),
|
||||
.text = command.name, .font = frame.font, .strong = strong[:],
|
||||
.wrap = cast(TextWrap)TextWrapNone, .vertical_align = cast(TextAlign)TextAlignCenter})
|
||||
// Long translations wrap to a second line on narrow phones.
|
||||
Text(frame.session, TextProps.{.key = cast(u64)(key + 2),
|
||||
.bounds = Bounds(x + Scale(16) + name_width, top,
|
||||
width - Scale(32) - name_width, menu_row),
|
||||
.text = command.description, .font = Scale(14),
|
||||
.wrap = cast(TextWrap)TextWrapAuto, .vertical_align = cast(TextAlign)TextAlignCenter})
|
||||
}
|
||||
End(frame.session)
|
||||
}
|
||||
}
|
||||
// As in Telegram, an empty draft offers the command button and a draft
|
||||
// offers Send. A pending answer keeps Send visible as its progress.
|
||||
show_commands := LumiTrim(frame.value).count == 0 && !frame.waiting
|
||||
if show_commands && Button(frame.session, ButtonProps.{.id = 30012,
|
||||
.bounds = Bounds(x + width - Scale(48), footer, Scale(48), Scale(48)),
|
||||
.label = LumiViewLocaleHost("lumi_commands"), .icon_shape = LUMI_COMMANDS_ICON, .icon_only = true,
|
||||
.tone = cast(ButtonTone)ButtonToneNeutral, .emphasis = cast(ButtonEmphasis)ButtonEmphasisGhost}) != 0 {
|
||||
FillDraft("/")
|
||||
selected = true
|
||||
}
|
||||
// The command button and the list keep typing in the draft, as Telegram
|
||||
// does, rather than leaving the focus on the pressed button. Apps built
|
||||
// before Kryon's focus fix give the focus back to that button on the
|
||||
// next frame, so the request lasts two frames.
|
||||
if selected || chosen >= 0 {
|
||||
focus_request = 2
|
||||
}
|
||||
field_input := frame.input
|
||||
if focus_request > 0 {
|
||||
field_input.focus = true
|
||||
focus_request -= 1
|
||||
}
|
||||
field := TextArea(frame.session, TextAreaProps.{.key = cast(u64)300200, .focus_id = 30010,
|
||||
.bounds = Bounds(x, footer, width - Scale(80), input_height),
|
||||
.bounds = Bounds(x, footer, width - Scale(56), input_height),
|
||||
.value = frame.value, .placeholder = LumiViewLocaleHost("lumi_placeholder"), .label = "Lumi",
|
||||
.cursor = frame.cursor, .anchor = frame.anchor, .scroll_y = frame.input_scroll,
|
||||
.selecting = frame.selecting, .preferred_x = frame.preferred_x,
|
||||
.preferred_x_valid = frame.preferred_x_valid, .wrap = true,
|
||||
.focused = frame.focused, .input = frame.input, .max_bytes = LUMI_INPUT_MAX - 1,
|
||||
.focused = frame.focused, .input = field_input, .max_bytes = LUMI_INPUT_MAX - 1,
|
||||
.max_codepoints = LUMI_INPUT_MAX - 1})
|
||||
if !selected {
|
||||
if field.edit.changed && field.edit.start >= 0 && field.edit.end >= field.edit.start &&
|
||||
@@ -441,17 +1092,38 @@ LumiView :: (message: LumiMessage, commands: LumiCommands, revision: s64) -> Lum
|
||||
}
|
||||
frame.clipboard_write = field.clipboard_write
|
||||
frame.clipboard_text = field.clipboard_text
|
||||
send := Button(frame.session, ButtonProps.{.id = 30011,
|
||||
.bounds = Bounds(x + width - Scale(72), footer, Scale(72), Scale(48)),
|
||||
.label = LumiViewLocaleHost("lumi_send"), .disabled = frame.waiting,
|
||||
.loading = frame.waiting, .tone = cast(ButtonTone)ButtonToneNeutral,
|
||||
.emphasis = cast(ButtonEmphasis)ButtonEmphasisSoft}) != 0
|
||||
if !frame.waiting && (send || field.committed) && LumiTrim(frame.value).count > 0 && !selected {
|
||||
if copy_pending {
|
||||
frame.clipboard_write = true
|
||||
frame.clipboard_text = pending_copy
|
||||
copy_pending = false
|
||||
}
|
||||
send := !show_commands && Button(frame.session, ButtonProps.{.id = 30011,
|
||||
.bounds = Bounds(x + width - Scale(48), footer, Scale(48), Scale(48)),
|
||||
.label = LumiViewLocaleHost("lumi_send"), .icon_shape = LUMI_SEND_ICON, .icon_only = true,
|
||||
.disabled = frame.waiting, .loading = frame.waiting, .tone = cast(ButtonTone)ButtonToneNeutral,
|
||||
.emphasis = cast(ButtonEmphasis)ButtonEmphasisGhost}) != 0
|
||||
if chosen < 0 && field.committed && !send && menu_target >= 0 && !frame.waiting && !selected {
|
||||
chosen = menu_matches[menu_target]
|
||||
}
|
||||
submit := ""
|
||||
if chosen >= 0 {
|
||||
// A command that needs text, or one chosen while Lumi is answering,
|
||||
// waits in the draft.
|
||||
text := CommandText(menu[chosen])
|
||||
if menu[chosen].needs_text || frame.waiting {
|
||||
FillDraft(text)
|
||||
} else {
|
||||
submit = text
|
||||
}
|
||||
} else if !frame.waiting && (send || field.committed) && LumiTrim(frame.value).count > 0 && !selected {
|
||||
submit = frame.value
|
||||
}
|
||||
if submit.count > 0 {
|
||||
message.action = LUMI_SEND
|
||||
// The host owns the draft buffer. Keep the submitted text before
|
||||
// WriteLumiUiHost clears that buffer for the next message.
|
||||
submitted: Vec(u8)
|
||||
BuilderPrint(*submitted, "%", frame.value)
|
||||
BuilderPrint(*submitted, "%", submit)
|
||||
message.input = BuilderFinish(submitted)
|
||||
frame.value = ""
|
||||
frame.cursor = 0
|
||||
@@ -463,7 +1135,7 @@ LumiView :: (message: LumiMessage, commands: LumiCommands, revision: s64) -> Lum
|
||||
frame.follow_end = true
|
||||
}
|
||||
WriteLumiUiHost(frame)
|
||||
if message.action != LUMI_SEND && frame.has_older && !frame.follow_end && frame.scroll <= Scale(96) {
|
||||
if message.action != LUMI_SEND && load_older {
|
||||
unused LumiLoadOlderHost()
|
||||
}
|
||||
return message
|
||||
|
||||
@@ -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
|
||||
}
|
||||
@@ -1,5 +1,14 @@
|
||||
# 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.
|
||||
|
||||
## [1.1.3] - 2026-10-07
|
||||
|
||||
- Keep app labels and content visible after updating Inner Breeze.
|
||||
|
||||
@@ -8,7 +8,8 @@
|
||||
"inbe.practices",
|
||||
"inbe.lists",
|
||||
"inbe.diary",
|
||||
"inbe.lumi"
|
||||
"inbe.lumi",
|
||||
"inbe.leaderboard"
|
||||
]
|
||||
}
|
||||
]
|
||||
+33
-19
@@ -1,42 +1,56 @@
|
||||
{
|
||||
"host_api": 4,
|
||||
"host_api": 8,
|
||||
"oldest_host_api": 5,
|
||||
"module_api": 2,
|
||||
"apps": {
|
||||
"inbe": {
|
||||
"id": "inbe",
|
||||
"version": "2.1.20",
|
||||
"sequence": 17,
|
||||
"bundled": true
|
||||
"version": "2.1.30",
|
||||
"sequence": 27,
|
||||
"bundled": true,
|
||||
"host_api": 8
|
||||
},
|
||||
"habits": {
|
||||
"id": "inbe.habits",
|
||||
"version": "1.0.3",
|
||||
"sequence": 4,
|
||||
"bundled": true
|
||||
"version": "1.0.5",
|
||||
"sequence": 6,
|
||||
"bundled": true,
|
||||
"host_api": 5
|
||||
},
|
||||
"practices": {
|
||||
"id": "inbe.practices",
|
||||
"version": "1.1.3",
|
||||
"sequence": 5,
|
||||
"bundled": true
|
||||
"version": "1.1.5",
|
||||
"sequence": 7,
|
||||
"bundled": true,
|
||||
"host_api": 5
|
||||
},
|
||||
"lists": {
|
||||
"id": "inbe.lists",
|
||||
"version": "1.0.3",
|
||||
"sequence": 4,
|
||||
"bundled": true
|
||||
"version": "1.0.6",
|
||||
"sequence": 7,
|
||||
"bundled": true,
|
||||
"host_api": 5
|
||||
},
|
||||
"diary": {
|
||||
"id": "inbe.diary",
|
||||
"version": "1.1.5",
|
||||
"sequence": 7,
|
||||
"bundled": true
|
||||
"version": "1.1.10",
|
||||
"sequence": 12,
|
||||
"bundled": true,
|
||||
"host_api": 7
|
||||
},
|
||||
"lumi": {
|
||||
"id": "inbe.lumi",
|
||||
"version": "1.3.3",
|
||||
"sequence": 10,
|
||||
"bundled": true
|
||||
"version": "1.4.0",
|
||||
"sequence": 17,
|
||||
"bundled": true,
|
||||
"host_api": 8
|
||||
},
|
||||
"leaderboard": {
|
||||
"id": "inbe.leaderboard",
|
||||
"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.
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 1106 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user