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:
@@ -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 */ }
|
||||
}
|
||||
Reference in New Issue
Block a user