Users, file manager, image generation, budgets and agent workflow

- User management: local accounts (Argon2) and OpenID Connect, admin/user
  roles, per-user folders plus admin-shared folders, read-only session
  sharing, event filtering per user
- File manager with CodeMirror editor and git client (status, diff,
  stage, commit, branches, fetch/pull/push, log, clone/init)
- Image generation via fal.ai: generate_image tool and image page
- Budgets: monthly limits per provider, provider balances/costs
  (OpenRouter, Anthropic admin cost report, fal.ai), price discovery
- Subagents on other models, background tasks, concurrency limits per
  host/model/subagent
- MCP tools loaded on demand (mcp_search/mcp_call), read-only hints
- Permission mode "auto", safe read-only commands always allowed
- Persistent message queue with attachments, deletable
- Live reasoning incl. <think> tags, activity animations, CSS themes,
  mobile layout, statistics per user, upload size handling
- Docker: named volume for state, localhost-bound port

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Richard ZinkandClaude Opus 5.5 committed 2026-11-08 16:54:08 +01:00
1 parent f3a2fe3816
commit 49262c612c
70 files changed
+8495 -714

No files matched your search

+35 -13
View File
@@ -1,34 +1,56 @@
import { useState } from "react";
import { get, setToken } from "../api";
import { post } from "../api";
import { useT } from "../i18n";
import type { Info } from "../types";
export function Login({ onSuccess }: { onSuccess: () => void }) {
/** Sign-in, or creation of the first admin when no users exist yet. */
export function Login({ info, onSuccess }: { info: Info; onSuccess: () => void }) {
const t = useT();
const [token, setValue] = useState("");
const [error, setError] = useState(false);
const setup = info.setup_required;
const [form, setForm] = useState({ username: "", password: "", password2: "", code: "" });
const [error, setError] = useState<string>();
const [busy, setBusy] = useState(false);
const submit = async (e: React.FormEvent) => {
e.preventDefault();
setToken(token.trim());
setError(undefined);
if (setup && form.password !== form.password2) return setError(t("login.mismatch"));
setBusy(true);
try {
await get("/sessions");
if (setup) await post("/auth/setup", { code: form.code, username: form.username, password: form.password });
else await post("/auth/login", { username: form.username, password: form.password });
onSuccess();
} catch {
setError(true);
} catch (err: any) {
setError(err.status === 401 ? t(setup ? "login.invalidCode" : "login.invalid") : err.message);
} finally {
setBusy(false);
}
};
const set = (k: keyof typeof form) => (e: React.ChangeEvent<HTMLInputElement>) => setForm({ ...form, [k]: e.target.value });
return (
<div className="login">
<form onSubmit={submit}>
<img src="/icon.svg" alt="" />
<h2 style={{ margin: 0 }}>CodeCraft</h2>
<div style={{ color: "var(--fg3)" }}>{t("login.prompt")}</div>
<input type="password" autoFocus value={token} onChange={(e) => setValue(e.target.value)} placeholder={t("login.token")} />
{error && <div style={{ color: "var(--red)" }}>{t("login.invalid")}</div>}
<button className="primary" type="submit" disabled={!token.trim()}>
{t("login.submit")}
<div style={{ color: "var(--fg3)" }}>{setup ? t("login.setupPrompt") : t("login.prompt")}</div>
{setup && <input autoFocus placeholder={t("login.setupCode")} value={form.code} onChange={set("code")} autoComplete="one-time-code" />}
<input autoFocus={!setup} placeholder={t("login.username")} value={form.username} onChange={set("username")} autoComplete="username" autoCapitalize="none" />
<input type="password" placeholder={t("login.password")} value={form.password} onChange={set("password")} autoComplete={setup ? "new-password" : "current-password"} />
{setup && <input type="password" placeholder={t("login.passwordRepeat")} value={form.password2} onChange={set("password2")} autoComplete="new-password" />}
{error && <div style={{ color: "var(--red)" }}>{error}</div>}
<button className="primary" type="submit" disabled={busy || !form.username || !form.password}>
{setup ? t("login.createAdmin") : t("login.submit")}
</button>
{!setup && info.oidc && (
<>
<div style={{ color: "var(--muted)", fontSize: 12 }}>{t("login.or")}</div>
<a className="button" href="/api/auth/oidc/start">
{info.oidc.label}
</a>
</>
)}
</form>
</div>
);