Web UI: runtime console + KV session panel, with runtime/storage libs and tests (#32)

* Add web runtime console and KV sessions

* test(web): cover runtime and KV session behavior

* Fix runtime helper formatting
This commit is contained in:
ZacharyZcR
2026-07-12 07:40:01 +08:00
committed by GitHub
parent d7ffdc45be
commit 57730f6196
9 changed files with 349 additions and 36 deletions
+19
View File
@@ -0,0 +1,19 @@
export interface StringStorage {
getItem(key: string): string | null
setItem(key: string, value: string): void
removeItem(key: string): void
}
export function stored(storage: Pick<StringStorage, "getItem">, key: string, fallback: string) {
try { return storage.getItem(key) || fallback } catch { return fallback }
}
export function persistPublicSettings(storage: StringStorage, baseUrl: string, model: string) {
try {
storage.setItem("colibri.baseUrl", baseUrl)
storage.setItem("colibri.model", model)
// API credentials intentionally remain memory-only. Remove values left by
// older web releases whenever public settings are persisted.
storage.removeItem("colibri.apiKey")
} catch { /* restricted storage mode */ }
}