Ask about Lumi's online terms when it opens, with a connection button
Opening Lumi now shows its online terms right away until you answer them, once each time Inner Breeze starts: "Not now" keeps Lumi offline until the next start or until you tap the connection button. Terms you withdrew, or Lumi switched offline, aren't asked about again. The title bar's Offline/Online switch is now a connection button: a connected icon while Lumi is online, a disconnected one while it is offline, and one tap to switch. Its label still says Online or Offline. Without the terms agreed, a tap shows them. A wrench beside it opens Settings > Lumi. The icons come from the MingCute icon package, which Inner Breeze now uses for its apps.
This commit is contained in:
1 parent
c093340abd
commit
3f5f46f770
28 files changed
+177
-65
No files matched your search
@@ -3,7 +3,7 @@
|
||||
## [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 switch between offline and online. 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.
|
||||
- A title bar with a connection button that switches Lumi between offline and online, and a wrench that opens Settings > Lumi. 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.
|
||||
- Settings > Lumi: 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.
|
||||
### Changed
|
||||
- Offline, Lumi sends nothing: no AI requests, no feedback delivery and no Telegram messages until you switch it online.
|
||||
|
||||
+29
-15
@@ -22,8 +22,6 @@
|
||||
#import "title_bar_props"
|
||||
#import "title_bar_widget"
|
||||
#import "dropdown_props"
|
||||
#import "toggle_props"
|
||||
#import "toggle_widget"
|
||||
#import "tree"
|
||||
#import "text"
|
||||
#import "byte_text_linux"
|
||||
@@ -35,6 +33,9 @@
|
||||
#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;
|
||||
@@ -57,6 +58,7 @@ 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;
|
||||
OpenLumiSettingsHost :: () -> bool #foreign host_api;
|
||||
frame: LumiUiFrame;
|
||||
// The terms panel's scroll and its formatted text.
|
||||
agreement_scroll: s32;
|
||||
@@ -593,29 +595,41 @@ RowPress :: (index: s32, bounds: Rectangle, content_y: float32) {
|
||||
}
|
||||
}
|
||||
|
||||
// Lumi's title bar: its name, and a switch between offline and online.
|
||||
// Returns the bar's height.
|
||||
// Lumi's title bar: its name, a connection button that switches between
|
||||
// offline and online, and a wrench that opens Settings > Lumi. Returns the
|
||||
// bar's height.
|
||||
LumiTitleBar :: () -> s32 {
|
||||
height := Scale(52)
|
||||
switch_width := ifx frame.connection then Scale(184) else 0
|
||||
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 = switch_width}, options[0:0])
|
||||
.trailing_width = trailing}, options[0:0])
|
||||
if !frame.connection || bar.trailing_bounds.width <= 0.0 {
|
||||
return height
|
||||
}
|
||||
switch_height := Scale(34)
|
||||
area := bar.trailing_bounds
|
||||
switch := Toggle(frame.session, ToggleProps.{.key = cast(u64)300401, .id = 30040,
|
||||
.bounds = Rectangle.{area.x, area.y + (area.height - cast(float32)switch_height) / 2.0,
|
||||
area.width, cast(float32)switch_height},
|
||||
.value = frame.online, .label = LumiViewLocaleHost("lumi_toggle_online"),
|
||||
.off_label = LumiViewLocaleHost("lumi_toggle_offline"),
|
||||
.on_label = LumiViewLocaleHost("lumi_toggle_online")})
|
||||
if switch.changed {
|
||||
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(switch.value)
|
||||
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
|
||||
}
|
||||
|
||||
+1
-1
@@ -2844,7 +2844,7 @@ Offline
|
||||
Online
|
||||
---
|
||||
[lumi_settings_agreed]
|
||||
Souhlasili jste s podmínkami Lumi online. Lumi je online jen tehdy, když je přepínač v jejím záhlaví zapnutý.
|
||||
Souhlasili jste s podmínkami Lumi online. Lumi je online jen tehdy, když je tlačítko připojení v jejím záhlaví zapnuté.
|
||||
---
|
||||
[lumi_settings_not_agreed]
|
||||
Lumi zůstane offline, dokud nebudete souhlasit s jejími podmínkami online.
|
||||
|
||||
+1
-1
@@ -2838,7 +2838,7 @@ Offline
|
||||
Online
|
||||
---
|
||||
[lumi_settings_agreed]
|
||||
Du hast Lumis Online-Bedingungen zugestimmt. Lumi geht nur online, solange der Schalter in seiner Titelleiste an ist.
|
||||
Du hast Lumis Online-Bedingungen zugestimmt. Lumi geht nur online, solange die Verbindungstaste in seiner Titelleiste an ist.
|
||||
---
|
||||
[lumi_settings_not_agreed]
|
||||
Lumi bleibt offline, bis du seinen Online-Bedingungen zustimmst.
|
||||
|
||||
+1
-1
@@ -2862,7 +2862,7 @@ Offline
|
||||
Online
|
||||
---
|
||||
[lumi_settings_agreed]
|
||||
You agreed to Lumi’s online terms. Lumi goes online only while its title bar switch is on.
|
||||
You agreed to Lumi’s online terms. Lumi goes online only while the connection button in its title bar is on.
|
||||
---
|
||||
[lumi_settings_not_agreed]
|
||||
Lumi stays offline until you agree to its online terms.
|
||||
|
||||
+1
-1
@@ -2838,7 +2838,7 @@ Sin red
|
||||
En línea
|
||||
---
|
||||
[lumi_settings_agreed]
|
||||
Aceptaste las condiciones en línea de Lumi. Lumi solo se conecta mientras el interruptor de su barra de título está activado.
|
||||
Aceptaste las condiciones en línea de Lumi. Lumi solo se conecta mientras el botón de conexión de su barra de título está activado.
|
||||
---
|
||||
[lumi_settings_not_agreed]
|
||||
Lumi sigue sin conexión hasta que aceptes sus condiciones en línea.
|
||||
|
||||
+1
-1
@@ -2826,7 +2826,7 @@ Hors ligne
|
||||
En ligne
|
||||
---
|
||||
[lumi_settings_agreed]
|
||||
Tu as accepté les conditions en ligne de Lumi. Lumi ne passe en ligne que lorsque l’interrupteur de sa barre de titre est activé.
|
||||
Tu as accepté les conditions en ligne de Lumi. Lumi ne passe en ligne que lorsque le bouton de connexion de sa barre de titre est activé.
|
||||
---
|
||||
[lumi_settings_not_agreed]
|
||||
Lumi reste hors ligne tant que tu n’as pas accepté ses conditions en ligne.
|
||||
|
||||
+1
-1
@@ -2827,7 +2827,7 @@ Luring
|
||||
Daring
|
||||
---
|
||||
[lumi_settings_agreed]
|
||||
Kamu sudah menyetujui ketentuan daring Lumi. Lumi hanya daring selama sakelar di bilah judulnya menyala.
|
||||
Kamu sudah menyetujui ketentuan daring Lumi. Lumi hanya daring selama tombol koneksi di bilah judulnya menyala.
|
||||
---
|
||||
[lumi_settings_not_agreed]
|
||||
Lumi tetap luring sampai kamu menyetujui ketentuan daringnya.
|
||||
|
||||
+1
-1
@@ -2827,7 +2827,7 @@ Offline
|
||||
Online
|
||||
---
|
||||
[lumi_settings_agreed]
|
||||
Hai accettato i termini online di Lumi. Lumi va online solo quando l’interruttore nella sua barra del titolo è attivo.
|
||||
Hai accettato i termini online di Lumi. Lumi va online solo quando il pulsante di connessione nella sua barra del titolo è attivo.
|
||||
---
|
||||
[lumi_settings_not_agreed]
|
||||
Lumi resta offline finché non accetti i suoi termini online.
|
||||
|
||||
+1
-1
@@ -2823,7 +2823,7 @@ Lumi をオンラインで使いますか?
|
||||
オンライン
|
||||
---
|
||||
[lumi_settings_agreed]
|
||||
Lumi のオンライン規約に同意済みです。Lumi はタイトルバーのスイッチがオンのときだけオンラインになります。
|
||||
Lumi のオンライン規約に同意済みです。Lumi はタイトルバーの接続ボタンがオンのときだけオンラインになります。
|
||||
---
|
||||
[lumi_settings_not_agreed]
|
||||
オンライン規約に同意するまで、Lumi はオフラインのままです。
|
||||
|
||||
+1
-1
@@ -2833,7 +2833,7 @@ Lumi를 온라인으로 쓸까요?
|
||||
온라인
|
||||
---
|
||||
[lumi_settings_agreed]
|
||||
Lumi 온라인 약관에 동의했어요. Lumi는 제목 표시줄 스위치가 켜져 있을 때만 온라인이 돼요.
|
||||
Lumi 온라인 약관에 동의했어요. Lumi는 제목 표시줄의 연결 버튼이 켜져 있을 때만 온라인이 돼요.
|
||||
---
|
||||
[lumi_settings_not_agreed]
|
||||
온라인 약관에 동의할 때까지 Lumi는 오프라인으로 있어요.
|
||||
|
||||
+1
-1
@@ -2836,7 +2836,7 @@ Offline
|
||||
Online
|
||||
---
|
||||
[lumi_settings_agreed]
|
||||
Você concordou com os termos online da Lumi. A Lumi só fica online enquanto o botão na barra de título estiver ligado.
|
||||
Você concordou com os termos online da Lumi. A Lumi só fica online enquanto o botão de conexão na barra de título estiver ligado.
|
||||
---
|
||||
[lumi_settings_not_agreed]
|
||||
A Lumi fica offline até você concordar com os termos online dela.
|
||||
|
||||
+1
-1
@@ -2832,7 +2832,7 @@ no: нет | оставь | оставить | отмена
|
||||
Онлайн
|
||||
---
|
||||
[lumi_settings_agreed]
|
||||
Вы приняли условия Lumi в сети. Lumi подключается, только пока включён переключатель в её строке заголовка.
|
||||
Вы приняли условия Lumi в сети. Lumi подключается, только пока включена кнопка подключения в её строке заголовка.
|
||||
---
|
||||
[lumi_settings_not_agreed]
|
||||
Lumi остаётся без сети, пока вы не примете её условия.
|
||||
|
||||
+1
-1
@@ -2838,7 +2838,7 @@ no: 否 | 不 | 不要 | 取消 | 保留
|
||||
在线
|
||||
---
|
||||
[lumi_settings_agreed]
|
||||
你已同意 Lumi 的在线条款。只有当标题栏开关打开时,Lumi 才会在线。
|
||||
你已同意 Lumi 的在线条款。只有当标题栏的连接按钮打开时,Lumi 才会在线。
|
||||
---
|
||||
[lumi_settings_not_agreed]
|
||||
在你同意在线条款之前,Lumi 会保持离线。
|
||||
|
||||
@@ -26,6 +26,7 @@ for feature in lists habits practices diary lumi leaderboard; do
|
||||
if [ "$feature" = practices ]; then source=practice; entry=practice; fi
|
||||
"$ziran" bundle --root . --module-path src \
|
||||
--module-path build/packages/kryon/src/ui \
|
||||
--module-path mingcute=build/packages/mingcute/src \
|
||||
--define KRYON_HOSTED_UI \
|
||||
--module-path build/packages/ziran/std \
|
||||
--asset-dir "assets=build/package-assets/$feature/assets" \
|
||||
|
||||
@@ -88,6 +88,7 @@ link raylib raylib
|
||||
link game2d game2d
|
||||
link qrcode qrcode
|
||||
link plot plot
|
||||
link mingcute mingcute
|
||||
link daochi-client daochi_client
|
||||
link sqlite sqlite
|
||||
link curl curl
|
||||
|
||||
@@ -382,7 +382,7 @@ ScreenGuideLumiSteps :: (app: *InnerBreeze, steps: []GuideOverlayStep) -> s32 {
|
||||
matches: [3]GuideMatch = .[
|
||||
GuideMatch.{.key = cast(u64)300200, .kind = WidgetKindTextArea, .enclosing = -1},
|
||||
GuideMatch.{.key = cast(u64)30011, .kind = WidgetKindButton, .enclosing = -1},
|
||||
GuideMatch.{.key = cast(u64)300401, .kind = WidgetKindToggle, .enclosing = -1}]
|
||||
GuideMatch.{.key = cast(u64)300401, .kind = WidgetKindButton, .enclosing = -1}]
|
||||
found: [3]Rectangle
|
||||
GuideFind(app.ui.session, matches[:], found[:])
|
||||
if !GuideRectangleValid(found[0]) {
|
||||
|
||||
@@ -42,6 +42,8 @@ c :: #system_library "c";
|
||||
|
||||
LumiAgreement :: struct {
|
||||
agreed: bool
|
||||
// Agreed or withdrawn under the current terms.
|
||||
answered: bool
|
||||
time: s64
|
||||
}
|
||||
|
||||
@@ -57,8 +59,9 @@ LumiNodeAgreement :: () -> LumiAgreement {
|
||||
version := ReadNumber(record, FieldAt(record, 0, "version"))
|
||||
time := ReadNumber(record, FieldAt(record, 0, "time"))
|
||||
agreed_at := FieldAt(record, 0, "agreed")
|
||||
agreement.agreed = version.valid && version.value == cast(float64)LUMI_AGREEMENT_VERSION &&
|
||||
agreed_at >= 0 && MatchLiteral(record, agreed_at, "true")
|
||||
agreement.answered = version.valid && version.value == cast(float64)LUMI_AGREEMENT_VERSION &&
|
||||
agreed_at >= 0
|
||||
agreement.agreed = agreement.answered && MatchLiteral(record, agreed_at, "true")
|
||||
if time.valid {
|
||||
agreement.time = cast(s64)time.value
|
||||
}
|
||||
@@ -69,6 +72,12 @@ LumiNodeAgreed :: () -> bool {
|
||||
return LumiNodeAgreement().agreed
|
||||
}
|
||||
|
||||
// Withdrawn on this or another device under the current terms.
|
||||
LumiNodeDeclined :: () -> bool {
|
||||
agreement := LumiNodeAgreement()
|
||||
return agreement.answered && !agreement.agreed
|
||||
}
|
||||
|
||||
LumiRecordNodeAgreement :: (agreed: bool) -> bool {
|
||||
out: Vec(u8)
|
||||
BuilderPrint(*out, "{\"version\":%,\"agreed\":%,\"time\":%}", LUMI_AGREEMENT_VERSION,
|
||||
|
||||
@@ -505,7 +505,8 @@ ModuleAllows :: (context: *void, module_name: string, name: string) -> bool {
|
||||
name == "ReadLumiDonationHost" || name == "LumiDonationActionHost" ||
|
||||
name == "ReadLumiSuggestionTaskHost" ||
|
||||
name == "ReadLumiSuggestionHabitHost" || name == "LumiViewLocaleHost" ||
|
||||
name == "SetLumiOnlineHost" || name == "LumiAgreementHost"))
|
||||
name == "SetLumiOnlineHost" || name == "LumiAgreementHost" ||
|
||||
name == "OpenLumiSettingsHost"))
|
||||
}
|
||||
if kind == MODULE_LEADERBOARD {
|
||||
allowed = allowed || WidgetHostSupports(module_name, name) ||
|
||||
|
||||
@@ -106,6 +106,12 @@ lumi_rows_measured: s32;
|
||||
// The chat changed while its rows were still being measured.
|
||||
lumi_rows_history_pending: bool;
|
||||
lumi_pending_route: s32 = -1;
|
||||
// The title bar's wrench opens Settings > Lumi after the frame.
|
||||
lumi_pending_settings: bool;
|
||||
// Opening Lumi shows its online terms until they are answered, once a run:
|
||||
// after "Not now" they wait for the next run or the connection button.
|
||||
lumi_agreement_due: bool;
|
||||
lumi_agreement_prompted: bool;
|
||||
lumi_pending_practice: s32 = -1;
|
||||
lumi_choosing_habit: bool;
|
||||
lumi_choosing_diary: bool;
|
||||
@@ -147,6 +153,7 @@ app_lumi_reset :: () {
|
||||
lumi_draft_width = 0
|
||||
lumi_pending_route = -1
|
||||
lumi_pending_practice = -1
|
||||
lumi_pending_settings = false
|
||||
lumi_history_loading = false
|
||||
lumi_choosing_habit = false
|
||||
lumi_choosing_diary = false
|
||||
@@ -209,8 +216,18 @@ LumiAgreementPrepare :: (width: s32) {
|
||||
lumi_ui.agreement_height = lumi_agreement_height
|
||||
}
|
||||
|
||||
// The title bar's switch. Going online without the agreement for where
|
||||
// requests go opens the terms instead: 1 online, 2 terms shown, 0 offline.
|
||||
// Whether opening Lumi now shows its online terms: not yet agreed for where
|
||||
// requests would go, never withdrawn or switched offline, with an own
|
||||
// provider ready to name, and not shown before in this run.
|
||||
LumiAgreementPromptWanted :: () -> bool {
|
||||
return LUMI_AGREEMENT_REQUIRED != 0 && !lumi_agreement_prompted && lumi_ui.agreement == 0 &&
|
||||
StoredAccountMode() != AccountModeDelegate && LumiOnlineWanted() && !LumiAiAgreed() &&
|
||||
!LumiNodeDeclined() && (!LumiOwnProviderSelected() || LumiOwnProviderReady())
|
||||
}
|
||||
|
||||
// The title bar's connection button. Going online without the agreement
|
||||
// for where requests go opens the terms instead: 1 online, 2 terms shown,
|
||||
// 0 offline.
|
||||
LumiSetOnline :: (on: bool) -> s32 {
|
||||
if StoredAccountMode() == AccountModeDelegate {
|
||||
return 0
|
||||
@@ -696,6 +713,11 @@ LumiUiCall :: (context: *void, module: *u8, function: *u8,
|
||||
result.* = HostScalar("bool", ifx chosen then 1 else 0)
|
||||
return 1
|
||||
}
|
||||
if name == "OpenLumiSettingsHost" && count == 0 {
|
||||
lumi_pending_settings = true
|
||||
result.* = HostScalar("bool", 1)
|
||||
return 1
|
||||
}
|
||||
// The offline harness runs the same validated tools as the online model.
|
||||
if name == "LumiToolHost" && count == 2 &&
|
||||
HostScalarValid(arguments[0], "string", cast(s32)HostString) &&
|
||||
@@ -1038,6 +1060,7 @@ lumi_screen_draw :: (app: *InnerBreeze) {
|
||||
lumi_history_loading = false
|
||||
lumi_ui.follow_end = true
|
||||
lumi_ui.scroll = 1000000
|
||||
lumi_agreement_due = true
|
||||
}
|
||||
lumi_last_drawn = opened_at
|
||||
LumiPrepareTools(app)
|
||||
@@ -1110,6 +1133,13 @@ lumi_screen_draw :: (app: *InnerBreeze) {
|
||||
lumi_draft_height = cast(s32)draft.bounds.height
|
||||
}
|
||||
lumi_ui.draft_height = lumi_draft_height
|
||||
if lumi_agreement_due {
|
||||
lumi_agreement_due = false
|
||||
if LumiAgreementPromptWanted() {
|
||||
lumi_agreement_prompted = true
|
||||
lumi_ui.agreement = 1
|
||||
}
|
||||
}
|
||||
// The terms wrap clear of their scroll bar, as Lumi's view draws them.
|
||||
LumiAgreementPrepare(column_width - AppScale(24))
|
||||
typed: [512]u8
|
||||
@@ -1119,6 +1149,7 @@ lumi_screen_draw :: (app: *InnerBreeze) {
|
||||
lumi_ui.input.commit = enter && !lumi_ui.input.shift
|
||||
lumi_pending_route = -1
|
||||
lumi_pending_practice = -1
|
||||
lumi_pending_settings = false
|
||||
WidgetHostBegin(app.ui.session, HostedAssetAllowed)
|
||||
CellsUiBegin(LumiUiCall, cast(*void)app)
|
||||
response := LumiRun(LumiMessage.{.action = LUMI_FRAME})
|
||||
@@ -1133,6 +1164,12 @@ lumi_screen_draw :: (app: *InnerBreeze) {
|
||||
if lumi_pending_route >= 0 {
|
||||
app_apply_nav_route(app, lumi_pending_route)
|
||||
}
|
||||
if lumi_pending_settings {
|
||||
lumi_pending_settings = false
|
||||
app_apply_nav_route(app, APP_NAV_ROUTE_SETTINGS)
|
||||
app.settings_tab = SETTINGS_TAB_LUMI
|
||||
app.settings_overview = 0
|
||||
}
|
||||
}
|
||||
|
||||
#program_export
|
||||
|
||||
@@ -29,7 +29,9 @@ with tempfile.TemporaryDirectory(prefix='inbe-emphasis-') as directory:
|
||||
app_used_habits='1', app_used_practices='1', app_used_diary='1',
|
||||
main_tab='4', language='en', language_setup_done='1', apps_setup_done='1',
|
||||
lumi_introduced='1', package_updates_allowed='0', tutorial_seen='1',
|
||||
habits_guide_seen='1', lumi_guides_seen='127', lumi_archive_migrated='0', lumi_chat=json.dumps(history))
|
||||
habits_guide_seen='1', lumi_guides_seen='127', lumi_archive_migrated='0', lumi_chat=json.dumps(history),
|
||||
# Switched offline, Lumi opens on its chat rather than its terms.
|
||||
lumi_online='0')
|
||||
for key, value in settings.items():
|
||||
db.execute('INSERT INTO settings(user_id,key,value,updated_at) VALUES(?,?,?,1) '
|
||||
'ON CONFLICT(user_id,key) DO UPDATE SET value=excluded.value', (user,key,value))
|
||||
|
||||
@@ -2,11 +2,13 @@
|
||||
private display, at phone size (1080x1920, UI scale 2.5) and desktop size
|
||||
(900x720), against a local stand-in for an OpenAI-compatible provider.
|
||||
|
||||
Lumi starts offline: an unknown request gets the offline answer and a habit
|
||||
request still works on the device, while the provider receives nothing.
|
||||
The title bar's switch opens the terms; after agreeing, the provider gets
|
||||
the request with the key only in its Authorization header. Switched off,
|
||||
nothing is sent again. Settings > Lumi shows the provider and reopens the
|
||||
Opening Lumi shows its online terms until they are answered, once a run.
|
||||
After "Not now" Lumi stays offline: an unknown request gets the offline
|
||||
answer and a habit request still works on the device, while the provider
|
||||
receives nothing. The title bar's connection button opens the terms; after
|
||||
agreeing, the provider gets the request with the key only in its
|
||||
Authorization header. Switched off, nothing is sent again. The title bar's
|
||||
wrench opens Settings > Lumi, which shows the provider and reopens the
|
||||
terms. Screenshots of each step are kept in build/lumi-harness-ui-test.
|
||||
"""
|
||||
import ast
|
||||
@@ -151,12 +153,17 @@ def setting(profile, key):
|
||||
return row[0] if row else None
|
||||
|
||||
|
||||
def tap_switch(window, size, online):
|
||||
"""Lumi's title bar keeps its switch, 184 units wide, 12 from the right."""
|
||||
def tap_title_button(window, size, button):
|
||||
"""Lumi's title bar ends 12 units from the right with two 40-unit
|
||||
buttons 4 apart: the connection button, then the wrench."""
|
||||
width, _, scale = size
|
||||
scale /= 10
|
||||
left = width - round((12 + 184) * scale)
|
||||
tap(window, left + round((138 if online else 46) * scale), round(26 * scale))
|
||||
centre = 12 + 20 if button == 'wrench' else 12 + 40 + 4 + 20
|
||||
tap(window, width - round(centre * scale), round(26 * scale))
|
||||
|
||||
|
||||
def terms_open(window, label):
|
||||
return any(row['text'] == 'Agree' for row in words(window, label))
|
||||
|
||||
|
||||
def tap_composer(window, size, label):
|
||||
@@ -243,7 +250,20 @@ def run(name, size, port):
|
||||
lumi_provider='own', lumi_provider_url=f'http://127.0.0.1:{port}/v1',
|
||||
lumi_provider_model='test-model', lumi_provider_key=KEY))
|
||||
with application(profile, size, name) as window:
|
||||
# Opening Lumi asks right away; "Not now" keeps it offline.
|
||||
wait_for(lambda: terms_open(window, name + '-prompt-wait'), 'Opening Lumi did not show the terms')
|
||||
capture(window, name + '-prompt-on-open')
|
||||
assert not Provider.requests, 'Showing the terms sent something'
|
||||
tap_word(window, 'Not', name + '-not-now', lowest=True)
|
||||
time.sleep(0.8)
|
||||
assert not terms_open(window, name + '-after-not-now'), 'The terms stayed open'
|
||||
capture(window, name + '-title-offline')
|
||||
# Once a run: leaving Lumi and coming back doesn't ask again.
|
||||
action(window, 'mcp.open_view', dict(view='settings'))
|
||||
time.sleep(1.5)
|
||||
action(window, 'mcp.open_view', dict(view='lumi'))
|
||||
time.sleep(0.8)
|
||||
assert not terms_open(window, name + '-reopened'), 'The terms showed twice in one run'
|
||||
answer = send(window, profile, 'tell me a joke', name + '-1')
|
||||
assert 'offline' in answer.lower() or 'title bar' in answer, answer
|
||||
answer = send(window, profile, 'add a habit stretching every day at 8', name + '-2')
|
||||
@@ -264,9 +284,8 @@ def run(name, size, port):
|
||||
capture(window, name + '-habits-offline')
|
||||
assert not Provider.requests, 'Lumi reached the provider while offline'
|
||||
|
||||
tap_switch(window, size, True)
|
||||
wait_for(lambda: any(row['text'] == 'Agree' for row in words(window, name + '-terms-wait')),
|
||||
'The terms did not open')
|
||||
tap_title_button(window, size, 'connection')
|
||||
wait_for(lambda: terms_open(window, name + '-terms-wait'), 'The terms did not open')
|
||||
capture(window, name + '-agreement')
|
||||
assert not Provider.requests, 'Opening the terms sent something'
|
||||
tap_word(window, 'Agree', name + '-agree', lowest=True)
|
||||
@@ -290,23 +309,18 @@ def run(name, size, port):
|
||||
assert KEY not in json.dumps(body)
|
||||
capture(window, name + '-online-answer')
|
||||
|
||||
tap_switch(window, size, False)
|
||||
tap_title_button(window, size, 'connection')
|
||||
time.sleep(0.4)
|
||||
capture(window, name + '-title-offline-again')
|
||||
answer = send(window, profile, 'another joke please', name + '-4')
|
||||
assert len(Provider.requests) == 1, 'Lumi reached the provider while switched off'
|
||||
|
||||
action(window, 'mcp.open_view', dict(view='settings'))
|
||||
time.sleep(0.8)
|
||||
# Settings lists Lumi's tab right after Appearance.
|
||||
found = words(window, name + '-settings-tabs')
|
||||
appearance = [row for row in found if row['text'] == 'Appearance']
|
||||
assert appearance, 'Settings did not open'
|
||||
below = sorted((row for row in found if row['text'] == 'Lumi'
|
||||
and int(row['top']) > int(appearance[0]['top'])),
|
||||
key=lambda row: int(row['top']))
|
||||
assert below, 'Settings has no Lumi tab'
|
||||
tap(window, int(below[0]['left']) + int(below[0]['width']) // 2,
|
||||
int(below[0]['top']) + int(below[0]['height']) // 2)
|
||||
# The wrench opens Settings > Lumi.
|
||||
tap_title_button(window, size, 'wrench')
|
||||
time.sleep(0.8)
|
||||
found = words(window, name + '-settings-lumi-words')
|
||||
assert any(row['text'] == 'Read' for row in found), 'The wrench did not open Settings > Lumi'
|
||||
assert any(row['text'] == 'Model' for row in found), 'Settings > Lumi shows no provider'
|
||||
capture(window, name + '-settings-lumi')
|
||||
assert setting(profile, 'lumi_provider_key') == KEY
|
||||
tap_word(window, 'Read', name + '-read-terms')
|
||||
@@ -323,5 +337,5 @@ try:
|
||||
run(name, size, server.server_address[1])
|
||||
finally:
|
||||
server.shutdown()
|
||||
print('Lumi harness UI: offline until agreed, terms, own provider request and Settings > Lumi passed; '
|
||||
f'screenshots in {OUTPUT.relative_to(ROOT)}')
|
||||
print('Lumi harness UI: terms on opening once a run, offline until agreed, connection button, '
|
||||
f'own provider request and the wrench to Settings > Lumi passed; screenshots in {OUTPUT.relative_to(ROOT)}')
|
||||
@@ -126,7 +126,9 @@ with tempfile.TemporaryDirectory(prefix="inbe-chat-history-") as directory, cont
|
||||
user = db.execute("SELECT id FROM users LIMIT 1").fetchone()[0]
|
||||
settings = dict(enabled_apps="31", main_tab="4", language="en", language_setup_done="1",
|
||||
apps_setup_done="1", launcher_guide_seen="1", lumi_introduced="1", tutorial_seen="1",
|
||||
package_updates_allowed="0", lumi_archive_migrated="1")
|
||||
package_updates_allowed="0", lumi_archive_migrated="1", lumi_guides_seen="127",
|
||||
# Switched offline, Lumi opens on its chat rather than its terms.
|
||||
lumi_online="0")
|
||||
settings.update({"app_used_" + name: "1" for name in ("lumi", "habits", "lists", "diary", "practices")})
|
||||
for key, value in settings.items():
|
||||
db.execute("INSERT INTO settings(user_id,key,value,updated_at) VALUES(?,?,?,1) "
|
||||
|
||||
@@ -91,7 +91,9 @@ with tempfile.TemporaryDirectory(prefix="inbe-lumi-performance-") as temporary,
|
||||
"launcher_favorite_count": 5,
|
||||
**{f"launcher_favorite_{index}": route
|
||||
for index, route in enumerate((12, 1, 2, 3, 11))},
|
||||
"main_tab": 4, "lumi_chat": json.dumps(history)}
|
||||
"main_tab": 4, "lumi_chat": json.dumps(history),
|
||||
# Switched offline, Lumi opens on its chat rather than its terms.
|
||||
"lumi_online": 0}
|
||||
for key, value in values.items():
|
||||
db.execute("INSERT INTO settings(user_id,key,value,updated_at) VALUES(?,?,?,1) "
|
||||
"ON CONFLICT(user_id,key) DO UPDATE SET value=excluded.value", (user, key, str(value)))
|
||||
|
||||
@@ -129,8 +129,22 @@ def application(profile, label):
|
||||
app.wait(timeout=5)
|
||||
|
||||
|
||||
def keep_offline(profile):
|
||||
"""Switched offline and with its guide seen, Lumi opens on its chat
|
||||
rather than its online terms or guide."""
|
||||
with sqlite3.connect(profile / "inbe.db") as db:
|
||||
user = db.execute("SELECT id FROM users LIMIT 1").fetchone()[0]
|
||||
for key, value in (("lumi_online", "0"), ("lumi_guides_seen", "127")):
|
||||
db.execute("INSERT INTO settings(user_id,key,value,updated_at) VALUES(?,?,?,1) "
|
||||
"ON CONFLICT(user_id,key) DO UPDATE SET value=excluded.value",
|
||||
(user, key, value))
|
||||
|
||||
|
||||
with tempfile.TemporaryDirectory(prefix="inbe-lumi-selection-") as temporary:
|
||||
profile = Path(temporary)
|
||||
with application(profile, "select-initialize"):
|
||||
pass
|
||||
keep_offline(profile)
|
||||
with application(profile, "select") as window:
|
||||
send(window, "alpha note")
|
||||
send(window, "omega note")
|
||||
@@ -171,6 +185,7 @@ with tempfile.TemporaryDirectory(prefix="inbe-lumi-selection-scroll-") as tempor
|
||||
profile = Path(temporary)
|
||||
with application(profile, "scroll-initialize"):
|
||||
pass
|
||||
keep_offline(profile)
|
||||
with sqlite3.connect(profile / "inbe.db") as db:
|
||||
user = db.execute("SELECT id FROM users LIMIT 1").fetchone()[0]
|
||||
db.execute("INSERT INTO settings(user_id,key,value,updated_at) VALUES(?,?,?,1) "
|
||||
|
||||
@@ -186,6 +186,8 @@ with tempfile.TemporaryDirectory(prefix="inbe-lumi-ui-") as directory:
|
||||
"main_tab": "4", "language": "en", "language_setup_done": "1",
|
||||
"apps_setup_done": "1", "lumi_introduced": "1", "package_updates_allowed": "0",
|
||||
"tutorial_seen": "1", "habits_guide_seen": "1", "lumi_guides_seen": "127",
|
||||
# Switched offline, Lumi opens on its chat rather than its terms.
|
||||
"lumi_online": "0",
|
||||
}.items():
|
||||
db.execute("INSERT INTO settings(user_id,key,value,updated_at) VALUES(?,?,?,1) "
|
||||
"ON CONFLICT(user_id,key) DO UPDATE SET value=excluded.value", (user, key, value))
|
||||
|
||||
+9
-1
@@ -52,6 +52,14 @@
|
||||
"ref": "master",
|
||||
"url": "https://github.com/ziranlang/oqs.git"
|
||||
},
|
||||
{
|
||||
"commit": "933691600cf10e81b1f53d9919dbcb371c1968e1",
|
||||
"dependencies": {},
|
||||
"id": "p56788fa3dab3e73a",
|
||||
"name": "mingcute",
|
||||
"ref": "master",
|
||||
"url": "https://github.com/kryonlabs/mingcute.git"
|
||||
},
|
||||
{
|
||||
"commit": "fafa2cea97d0cb379d832086ba45a989fa6f9c8e",
|
||||
"dependencies": {},
|
||||
@@ -113,7 +121,7 @@
|
||||
}
|
||||
],
|
||||
"root": {
|
||||
"dependencies": {"curl": "pc4b263336680098b", "daochi_client": "p96e1f539ccb91af5", "game2d": "paa08e1730a25bda0", "kryon": "p0ca95e1c45564da9", "kss": "p03de317562242e4f", "liboqs": "pfb3df7cb222b1bdc", "monocypher": "p2ff634c7b007140d", "oqs": "p55635fc8976895a9", "plot": "pa5dd7b8b83307b18", "qrcode": "pf0ce9cea355c9228", "rini": "p09fa77e94b0dfc6c", "sqlite": "p151b83a361c86f2d"},
|
||||
"dependencies": {"curl": "pc4b263336680098b", "daochi_client": "p96e1f539ccb91af5", "game2d": "paa08e1730a25bda0", "kryon": "p0ca95e1c45564da9", "kss": "p03de317562242e4f", "liboqs": "pfb3df7cb222b1bdc", "mingcute": "p56788fa3dab3e73a", "monocypher": "p2ff634c7b007140d", "oqs": "p55635fc8976895a9", "plot": "pa5dd7b8b83307b18", "qrcode": "pf0ce9cea355c9228", "rini": "p09fa77e94b0dfc6c", "sqlite": "p151b83a361c86f2d"},
|
||||
"name": "Inbe"
|
||||
},
|
||||
"toolchain": {
|
||||
|
||||
@@ -59,3 +59,7 @@ ref = "master"
|
||||
[dependencies.plot]
|
||||
git = "https://github.com/kryonlabs/plot.git"
|
||||
ref = "master"
|
||||
|
||||
[dependencies.mingcute]
|
||||
git = "https://github.com/kryonlabs/mingcute.git"
|
||||
ref = "master"
|
||||
Reference in new issue
Block a user