Add terminal client, memory, model fallback, version and install improvements
- codecraft: full-screen terminal client (ratatui) – local tools and files, models via the CodeCraft server gateway or own providers (standalone with a guided setup), slash commands, @files, permission dialogs, resume, update - Static Linux CLI builds (x86_64/aarch64, cargo-zigbuild) served by the server: /cli/install.sh and /cli/download/<target> - Project memory (remember tool, .codecraft/memory.md) and personal memory - Model fallback when a host is unreachable or a budget is used up - Version/commit in UI and health, daily release check, "What's new" dialog - PWA: install button, maskable icon, manifest id and screenshots - Case-insensitive detection of connection errors for retries Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
aa1f8cf016
commit
6dffcb501a
52 files changed
+6477
-765
No files matched your search
@@ -0,0 +1,41 @@
|
||||
/** PWA installation: keep the browser's install prompt for an in-app button. */
|
||||
type PromptEvent = Event & { prompt: () => Promise<void>; userChoice: Promise<{ outcome: string }> };
|
||||
|
||||
let deferred: PromptEvent | null = null;
|
||||
const listeners = new Set<() => void>();
|
||||
|
||||
window.addEventListener("beforeinstallprompt", (e) => {
|
||||
e.preventDefault();
|
||||
deferred = e as PromptEvent;
|
||||
listeners.forEach((l) => l());
|
||||
});
|
||||
window.addEventListener("appinstalled", () => {
|
||||
deferred = null;
|
||||
listeners.forEach((l) => l());
|
||||
});
|
||||
|
||||
export const canPrompt = () => !!deferred;
|
||||
export const isInstalled = () => matchMedia("(display-mode: standalone)").matches || (navigator as any).standalone === true;
|
||||
export function onInstallChange(fn: () => void) {
|
||||
listeners.add(fn);
|
||||
return () => void listeners.delete(fn);
|
||||
}
|
||||
|
||||
export async function promptInstall(): Promise<boolean> {
|
||||
if (!deferred) return false;
|
||||
await deferred.prompt();
|
||||
const choice = await deferred.userChoice;
|
||||
deferred = null;
|
||||
listeners.forEach((l) => l());
|
||||
return choice.outcome === "accepted";
|
||||
}
|
||||
|
||||
/** Which manual instructions fit this browser. */
|
||||
export function platformHint(): "ios" | "firefox" | "samsung" | "chrome" | "desktop" {
|
||||
const ua = navigator.userAgent;
|
||||
if (/iPhone|iPad|iPod/.test(ua)) return "ios";
|
||||
if (/Firefox/.test(ua)) return "firefox";
|
||||
if (/SamsungBrowser/.test(ua)) return "samsung";
|
||||
if (/Android/.test(ua)) return "chrome";
|
||||
return "desktop";
|
||||
}
|
||||
Reference in new issue
Block a user