Browser-based graphical shell and control plane for a Linux server you own — real terminal, file manager, live metrics and BYOK AI in one mobile-first workspace. Next.js 16 · React 19 · node-pty · Tailwind v4 · shadcn/ui. Public alpha, self-hosted.
TypeScript browser-shellcontrol-planefile-managerhomelabmobile-firstnextjsptyreactself-hostedserver-managementshadcn-uisysadmintailwindcssterminaltypescriptvpsweb-desktopweb-terminal
fix(alfa): preserve provider configuration and verify inference
Rahman2690b5e37818
diff --git a/AGENTS.md b/AGENTS.mdindex 2a9cc939..c85023a4 100644--- a/AGENTS.md+++ b/AGENTS.md@@ -102,6 +102,8 @@ and official skill `mso-agent-bootstrap`, not by jumping to `exec_run`.## Shipping+Run validation with `umask 077`: security fixtures must create private files/directories, not inherit group-writable shell defaults. On a busy shared host, bound Vitest concurrency with `VITEST_MAX_WORKERS=2` before changing timeout or coverage limits.+Follow `CLAUDE.md`: update `docs/PROGRESS.md`, run the relevant gates, and ship through`bun run ship "<conventional commit>"`. Do not replace the repository's release path with abare push.diff --git a/app/api/config/route.test.ts b/app/api/config/route.test.tsindex 9fd4adc3..14cce001 100644--- a/app/api/config/route.test.ts+++ b/app/api/config/route.test.ts@@ -7,25 +7,25 @@ const upsertCustomProvider = vi.fn();const removeCustomProvider = vi.fn();const removeOAuthBundle = vi.fn();const readConfig = vi.fn();+const getKey = vi.fn();vi.mock("@/lib/auth/require-session", () => ({ requireSession: vi.fn(async () => true) }));-vi.mock("@/lib/config/store", () => ({+vi.mock("@/lib/config/store", async (importOriginal) => ({+ ...await importOriginal<typeof import("@/lib/config/store")>(),DEFAULT_MODEL: "default-model",DEFAULT_PROVIDER: "anthropic",readConfig: (...args: unknown[]) => readConfig(...args),writeConfig: (...args: unknown[]) => writeConfig(...args),hostCredentialStore: () => ({- getKey: vi.fn(async () => ""),+ getKey: (...args: unknown[]) => getKey(...args),setKey: (...args: unknown[]) => setKey(...args),deleteKey: (...args: unknown[]) => deleteKey(...args),}),- isBuiltinProvider: (id: string) => ["anthropic", "openai", "openrouter", "google", "groq", "xai", "deepseek", "mistral"].includes(id),- slugifyProvider: (value: string) => value.trim().toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, ""),upsertCustomProvider: (...args: unknown[]) => upsertCustomProvider(...args),removeCustomProvider: (...args: unknown[]) => removeCustomProvider(...args),removeOAuthBundle: (...args: unknown[]) => removeOAuthBundle(...args),}));-vi.mock("@/lib/models/defaults", () => ({ defaultModelFor: (p: string) => `${p}-default` }));+vi.mock("@/lib/models/defaults", () => ({ DEFAULT_PROVIDER: "anthropic", defaultModelFor: (p: string) => `${p}-default` }));vi.mock("@/lib/host/ssrf", () => ({resolveSafeProviderEndpoint: vi.fn(async (url: string) => ({ url: new URL(url) })),}));@@ -45,6 +45,73 @@ describe("/api/config provider-auth vs model-selection contract", () => {removeCustomProvider.mockReset().mockResolvedValue(undefined);removeOAuthBundle.mockReset().mockResolvedValue(undefined);readConfig.mockReset().mockResolvedValue({ provider: "anthropic", model: "claude-active", keys: {}, customProviders: {}, oauthTokens: {} });+ getKey.mockReset().mockResolvedValue("");+ });++ it.each([+ null, [], { provider: 1 }, { provider: " " }, { provider: "../openai" },+ { provider: "constructor" }, { provider: "missing-provider" }, { model: [] }, { model: " " },+ { apiKey: {} }, { select: "false" }, { customProvider: "invalid" },+ { customProvider: { name: "constructor", baseURL: "https://ai.example.com/v1", apiKey: "secret" } },+ { customProvider: { name: "Hub", apiKey: 1 } },+ { customProvider: { name: "Hub", baseURL: "https://ai.example.com/v1", apiKey: "secret", models: "m1" } },+ ].map((body) => [body]))("rejects malformed config before mutation: %j", async (body) => {+ const { POST } = await import("./route");+ expect((await POST(request(body))).status).toBe(400);+ expect(writeConfig).not.toHaveBeenCalled();+ expect(setKey).not.toHaveBeenCalled();+ expect(upsertCustomProvider).not.toHaveBeenCalled();+ });++ it("preserves the active provider on a model-only update", async () => {+ readConfig.mockResolvedValue({ provider: "google", model: "gemini-old" });+ const { POST } = await import("./route");+ expect((await POST(request({ model: "gemini-next" }))).status).toBe(200);+ expect(writeConfig).toHaveBeenCalledWith({ provider: "google", model: "gemini-next" });+ });++ it("uses the new built-in provider default when switching without a model", async () => {+ const { POST } = await import("./route");+ await POST(request({ provider: "google" }));+ expect(writeConfig).toHaveBeenCalledWith({ provider: "google", model: "google-default" });+ });++ it("requires an explicit account model when switching to Codex", async () => {+ const { POST } = await import("./route");+ expect((await POST(request({ provider: "openai-codex" }))).status).toBe(400);+ expect(writeConfig).not.toHaveBeenCalled();+ });++ it("keeps the selected Codex model when updating its existing selection", async () => {+ readConfig.mockResolvedValue({ provider: "openai-codex", model: "gpt-account-model" });+ const { POST } = await import("./route");+ expect((await POST(request({ provider: "openai-codex" }))).status).toBe(200);+ expect(writeConfig).toHaveBeenCalledWith({ provider: "openai-codex", model: "gpt-account-model" });+ });++ it("selects the first declared custom model without inheriting the old model", async () => {+ readConfig.mockResolvedValue({ provider: "anthropic", model: "claude-active", customProviders: { hub: { baseUrl: "https://ai.example.com/v1", models: ["hub-model"] } } });+ const { POST } = await import("./route");+ await POST(request({ provider: "hub" }));+ expect(writeConfig).toHaveBeenCalledWith({ provider: "hub", model: "hub-model" });+ });++ it("only connects a custom provider with no known model", async () => {+ const { POST } = await import("./route");+ const response = await POST(request({ customProvider: { name: "Hub", baseURL: "https://ai.example.com/v1", apiKey: "secret" } }));+ expect(response.status).toBe(200);+ expect(await response.json()).toMatchObject({ selected: false });+ expect(setKey).toHaveBeenCalled();+ expect(writeConfig).not.toHaveBeenCalled();+ });++ it("lists env-connected built-ins without exposing or masking their keys", async () => {+ getKey.mockImplementation(async (_tenant: unknown, id: string) => id === "google" ? "env-private-sentinel" : "");+ const { GET } = await import("./route");+ const response = await GET();+ const body = await response.json();+ expect(body.providers).toEqual([expect.objectContaining({ id: "google", kind: "builtin", hasKey: true, masked: "" })]);+ expect(JSON.stringify(body)).not.toContain("env-private");});it("stores a built-in provider key with select:false without changing the active provider/model", async () => {diff --git a/app/api/config/route.ts b/app/api/config/route.tsindex 703f95a6..00ac70ec 100644--- a/app/api/config/route.ts+++ b/app/api/config/route.ts@@ -11,7 +11,9 @@ import {upsertCustomProvider,removeCustomProvider,removeOAuthBundle,+ safeProviderId,} from "@/lib/config/store";+import { PROVIDERS } from "@/lib/models";import { defaultModelFor } from "@/lib/models/defaults";import { resolveSafeProviderEndpoint } from "@/lib/host/ssrf";@@ -38,13 +40,14 @@ export async function GET() {const stored = keys[provider] ?? (provider === "anthropic" ? cfg.anthropicApiKey : undefined) ?? "";const key = stored || (await hostCredentialStore().getKey(undefined, provider)) || "";- // Connected = every provider with a stored key, plus custom + OAuth providers.- // Custom rows carry baseUrl/protocol/models; OAuth rows just report "signed in".- const ids = new Set([...Object.keys(keys), ...Object.keys(custom), ...Object.keys(oauth)]);+ const connected = Object.fromEntries(await Promise.all(Object.keys(PROVIDERS).map(async (id) =>+ [id, Boolean(await hostCredentialStore().getKey(undefined, id))] as const)));+ const ids = new Set([...Object.keys(keys), ...Object.keys(custom), ...Object.keys(oauth),+ ...Object.keys(connected).filter((id) => connected[id])]);const providers = [...ids].sort().map((id) => ({id,kind: oauth[id] ? "oauth" : isBuiltinProvider(id) ? "builtin" : "custom",- hasKey: !!keys[id] || !!oauth[id],+ hasKey: !!keys[id] || !!oauth[id] || connected[id] === true,masked: oauth[id] ? "signed in" : mask(keys[id] ?? ""),baseUrl: custom[id]?.baseUrl,protocol: custom[id]?.protocol,@@ -80,6 +83,19 @@ export async function POST(req: NextRequest) {};try {body = await req.json();+ if (!body || typeof body !== "object" || Array.isArray(body)+ || [body.provider, body.model, body.apiKey, body.anthropicApiKey, body.tokenSaver].some((v) => v !== undefined && typeof v !== "string")+ || (body.select !== undefined && typeof body.select !== "boolean")+ || (body.model !== undefined && !body.model.trim())) throw new Error("invalid");+ if (body.provider !== undefined) safeProviderId(body.provider.trim());+ if (body.customProvider !== undefined) {+ const c = body.customProvider;+ if (!c || typeof c !== "object" || Array.isArray(c)+ || [c.name, c.baseURL, c.baseUrl, c.apiKey].some((v) => v !== undefined && typeof v !== "string")+ || (c.protocol !== undefined && c.protocol !== "openai" && c.protocol !== "anthropic")+ || (c.models !== undefined && (!Array.isArray(c.models) || c.models.some((m) => typeof m !== "string")))) throw new Error("invalid");+ slugifyProvider(c.name ?? "");+ }} catch {return NextResponse.json({ error: "Invalid request body" }, { status: 400 });}@@ -96,7 +112,7 @@ export async function POST(req: NextRequest) {const c = body.customProvider;const slug = slugifyProvider(String(c.name ?? ""));if (!slug) return NextResponse.json({ error: "Provider name is required" }, { status: 400 });- if (isBuiltinProvider(slug)) {+ if (isBuiltinProvider(slug) || slug === "openai-codex") {return NextResponse.json({ error: `"${slug}" is a built-in provider — choose another name` }, { status: 400 });}if (!c.apiKey || !c.apiKey.trim()) return NextResponse.json({ error: "API key is required" }, { status: 400 });@@ -114,21 +130,25 @@ export async function POST(req: NextRequest) {...(models.length ? { models } : {}),});await hostCredentialStore().setKey(undefined, slug, c.apiKey.trim());- // Preserve legacy Settings behavior unless the caller explicitly asks to only- // configure credentials. This is what lets `mso models` manage auth while- // `mso model` remains the only model-selection UX.- if (body.select !== false) {- await writeConfig({ provider: slug, ...(models[0] ? { model: models[0] } : {}) });+ const model = body.model?.trim() || models[0];+ const selected = body.select !== false && Boolean(model);+ if (selected) {+ await writeConfig({ provider: slug, model });}- return NextResponse.json({ ok: true, slug, selected: body.select !== false });+ return NextResponse.json({ ok: true, slug, selected });}// ── Set a built-in provider / model / key ──────────────────────────────────- const provider = (body.provider || DEFAULT_PROVIDER).trim();+ const cfg = await readConfig();+ const provider = (body.provider ?? (body.anthropicApiKey !== undefined ? "anthropic" : cfg.provider) ?? DEFAULT_PROVIDER).trim();+ if (!isBuiltinProvider(provider) && provider !== "openai-codex" && !Object.hasOwn(cfg.customProviders ?? {}, provider)) {+ return NextResponse.json({ error: "Unknown provider" }, { status: 400 });+ }if (body.select !== false) {- const patch: { model?: string; provider?: string } = { provider };- if (typeof body.model === "string" && body.model.trim()) patch.model = body.model.trim();- await writeConfig(patch);+ const model = body.model?.trim() || (provider === cfg.provider ? cfg.model : undefined)+ || cfg.customProviders?.[provider]?.models?.[0] || (isBuiltinProvider(provider) ? defaultModelFor(provider) : undefined);+ if (!model) return NextResponse.json({ error: "Select a model for this provider" }, { status: 400 });+ await writeConfig({ provider, model });}// Key routes through the per-provider store. Empty string clears it (incl. the@@ -155,8 +175,7 @@ export async function DELETE(req: NextRequest) {await hostCredentialStore().deleteKey(undefined, slug);await removeCustomProvider(slug);await removeOAuthBundle(slug);- // If the deleted provider was selected, fall back to the default so the- // assistant never points at a now-keyless provider.+ // Reset a deleted selection; the default provider may still need credentials.const cfg = await readConfig();if (cfg.provider === slug) await writeConfig({ provider: DEFAULT_PROVIDER, model: DEFAULT_MODEL });return NextResponse.json({ ok: true });diff --git a/app/api/models/test/route.test.ts b/app/api/models/test/route.test.tsindex 9b131081..bfcd00ed 100644--- a/app/api/models/test/route.test.ts+++ b/app/api/models/test/route.test.ts@@ -5,6 +5,7 @@ const readOAuthBundle = vi.fn();const writeOAuthBundle = vi.fn();const codexModels = vi.fn();const ensureFreshCodex = vi.fn();+const streamCodex = vi.fn();vi.mock("@/lib/auth/require-session", () => ({ requireSession: vi.fn(async () => true) }));vi.mock("@/lib/config/store", () => ({@@ -18,6 +19,7 @@ vi.mock("@/lib/ai/oauth/codex", () => ({codexModels: (...args: unknown[]) => codexModels(...args),ensureFreshCodex: (...args: unknown[]) => ensureFreshCodex(...args),}));+vi.mock("@/lib/ai/codex-stream", () => ({ streamCodex: (...args: unknown[]) => streamCodex(...args) }));vi.mock("@/lib/models", () => ({ resolveModel: vi.fn() }));vi.mock("@/lib/host/ssrf", () => ({ safeProviderFetch: vi.fn() }));@@ -29,13 +31,22 @@ describe("/api/models/test OpenAI Codex OAuth", () => {ensureFreshCodex.mockReset().mockResolvedValue(bundle);codexModels.mockReset().mockResolvedValue(["gpt-5.6-sol", "gpt-5.6-terra"]);writeOAuthBundle.mockReset().mockResolvedValue(undefined);+ streamCodex.mockReset().mockImplementation(async ({ emit }) => {+ emit("delta", "OK");+ emit("done", { stopReason: "end_turn" });+ });});- it("validates the selected subscription model via the account model list", async () => {+ it("validates the selected subscription model with a real streaming request", async () => {const { POST } = await import("./route");const res = await POST();expect(await res.json()).toEqual({ ok: true, provider: "openai-codex", model: "gpt-5.6-sol" });expect(codexModels).toHaveBeenCalled();+ expect(streamCodex).toHaveBeenCalledWith(expect.objectContaining({+ model: "gpt-5.6-sol",+ messages: [{ role: "user", text: "Reply with OK only." }],+ signal: expect.any(AbortSignal),+ }));});it("reports a selected model that the account does not expose", async () => {@@ -43,5 +54,22 @@ describe("/api/models/test OpenAI Codex OAuth", () => {const { POST } = await import("./route");const res = await POST();expect(await res.json()).toMatchObject({ ok: false, error: expect.stringContaining("not available") });+ expect(streamCodex).not.toHaveBeenCalled();+ });++ it("does not report ready when inference fails despite model-list access", async () => {+ streamCodex.mockRejectedValueOnce(new Error("openai-codex HTTP 429"));+ const { POST } = await import("./route");+ expect(await (await POST()).json()).toEqual({ ok: false, error: "openai-codex HTTP 429" });+ });++ it("rejects empty or unfinished streams", async () => {+ const { POST } = await import("./route");+ for (const events of [["done"], ["delta"]]) {+ streamCodex.mockImplementationOnce(async ({ emit }) => {+ for (const event of events) emit(event, event === "delta" ? "OK" : { stopReason: "end_turn" });+ });+ expect(await (await POST()).json()).toEqual({ ok: false, error: "OpenAI ChatGPT returned no completed reply" });+ }});});diff --git a/app/api/models/test/route.ts b/app/api/models/test/route.tsindex a7bcf46e..a2c44afa 100644--- a/app/api/models/test/route.ts+++ b/app/api/models/test/route.ts@@ -5,11 +5,12 @@ import { resolveModelRef, hostCredentialStore, selectedCustomConn, readOAuthBundimport { resolveModel } from "@/lib/models";import { safeProviderFetch } from "@/lib/host/ssrf";import { codexModels, ensureFreshCodex } from "@/lib/ai/oauth/codex";+import { streamCodex } from "@/lib/ai/codex-stream";export const runtime = "nodejs";export const dynamic = "force-dynamic";-// 1-token validation of the SELECTED provider's key + endpoint. Session-gated POST.+// Minimal inference validation of the SELECTED provider's key + endpoint. Session-gated POST.// Returns { ok:true } or { ok:false, error } (HTTP 200 either way — a failed key is// a normal UX outcome, not a server error). Mirrors models-rahmanef-com testCredential.export async function POST() {@@ -27,6 +28,17 @@ export async function POST() {if (!models.includes(selectedModel)) {return NextResponse.json({ ok: false, error: `model ${selectedModel} is not available for this ChatGPT account` });}+ let text = "";+ let completed = false;+ await streamCodex({+ bundle: fresh, model: selectedModel, messages: [{ role: "user", text: "Reply with OK only." }],+ system: "You are checking inference readiness. Reply with OK only.", signal: AbortSignal.timeout(30_000),+ emit: (event, data) => {+ if (event === "delta" && typeof data === "string") text += data;+ if (event === "done") completed = true;+ },+ });+ if (!completed || !text.trim()) return NextResponse.json({ ok: false, error: "OpenAI ChatGPT returned no completed reply" });return NextResponse.json({ ok: true, provider: "openai-codex", model: selectedModel });} catch (e) {return NextResponse.json({ ok: false, error: (e as Error).message });diff --git a/bun.lock b/bun.lockindex cda851ef..ee3c1d43 100644--- a/bun.lock+++ b/bun.lock@@ -26,7 +26,7 @@"geist": "^1.7.2","konva": "^10.6.0","lucide-react": "^1.47.0",- "next": "^16.3.5",+ "next": "^16.3.8","node-pty": "^1.1.0","react": "^19.3.0","react-dom": "^19.3.0",@@ -46,7 +46,7 @@"@types/react-dom": "^19.3.0","@vitest/coverage-v8": "5.0.1","eslint": "^9.39.4",- "eslint-config-next": "^16.3.5",+ "eslint-config-next": "^16.3.8","fast-check": "^4.10.2","parse5": "8.0.1","postcss": "^8.5.28",@@ -219,25 +219,25 @@"@napi-rs/wasm-runtime": ["@napi-rs/[email protected]", "", { "dependencies": { "@tybys/wasm-util": "^0.10.3" }, "peerDependencies": { "@emnapi/core": "^1.7.1 || ^2.0.0-alpha.3", "@emnapi/runtime": "^1.7.1 || ^2.0.0-alpha.3" } }, "sha512-JfB4kuJQjaoHuCTseIINHtHWeJnvgEcxjwA5t/Y00ZgaOO1Crz3fjT/p8kT28zA/Caz7oiUMn3d6H2yOVCVwuw=="],- "@next/env": ["@next/[email protected]", "", {}, "sha512-NWEXVDMqoEo0ktmU6u0sE2Vg0LOcsD7NnOTJNo3/fEaTfsg+F1bMIxuDmQbda4e3yTIQwVdUREF2yIuMOusKtg=="],+ "@next/env": ["@next/[email protected]", "", {}, "sha512-Al9zqHVV7TJv0eFuOU4U7Lvv74PTih4Ch63sk2xCIpSTkE3udFnaOcnzP2lQVymiL7yS9Cj2iClUXlR3EQ5sEw=="],- "@next/eslint-plugin-next": ["@next/[email protected]", "", { "dependencies": { "@eslint-community/eslint-utils": "4.9.1", "fast-glob": "3.3.1" } }, "sha512-PGfSeItHJ12DH8t+6sEbuMe59NE5rAhCfgk06QKTH2ne9VUL1JlaXdYXY3B8RaiF2SO50rDYvd39TulP6A6xZQ=="],+ "@next/eslint-plugin-next": ["@next/[email protected]", "", { "dependencies": { "@eslint-community/eslint-utils": "4.9.1", "fast-glob": "3.3.1" } }, "sha512-eCR9RcLTZrVS+K3+VOhi0xMdUUGNuriCHHhU1ZoABC/QQ/Gp0OWbLKQxV2/9DkmihYdYRcQWFmZXW8M1AMUXYw=="],- "@next/swc-darwin-arm64": ["@next/[email protected]", "", { "os": "darwin", "cpu": "arm64" }, "sha512-pMmGgETfKvElucLHtVaeiMRbp2zUbvKx7b1yGko0liBz3cw1mKSggWN/Rp/wPz8z+E1O82u3r4L1Co+ZS5hokQ=="],+ "@next/swc-darwin-arm64": ["@next/[email protected]", "", { "os": "darwin", "cpu": "arm64" }, "sha512-2JPRMh2nmQG5CiL7cXGL9AGwnPWJQ//cTtAUCT+w511QHk79SYz3LGv/pc5X643B/WEO0rvu3Yww0hqwt3kgeA=="],- "@next/swc-darwin-x64": ["@next/[email protected]", "", { "os": "darwin", "cpu": "x64" }, "sha512-76VaGYvf6HPa5/w12yLkE3dXTn9AfdEviI79oEL3aZoAmRLc9rWitjWqyjViVysK/ht/y9YKzFkBrUdi/wGkow=="],+ "@next/swc-darwin-x64": ["@next/[email protected]", "", { "os": "darwin", "cpu": "x64" }, "sha512-GZtCCOBKJ4leVIT/Th0llWKhD1ca92lzbQiS5R5ON9QkoiFnilFsebDae1JU2a3HWoKMEmEZWGs1AGLavVM72Q=="],- "@next/swc-linux-arm64-gnu": ["@next/[email protected]", "", { "os": "linux", "cpu": "arm64" }, "sha512-zKDELJ5jSQMHeO/hmXUQsAzagX4bQD4OiMi3pQ5FbUj+yK506oLVHnKA2YXMlbg1EHHqJYtyePOgByIDXD1lqw=="],+ "@next/swc-linux-arm64-gnu": ["@next/[email protected]", "", { "os": "linux", "cpu": "arm64" }, "sha512-O659ygeQYqneJ1fBKMpFxIFqYkYswu8IAS1OCKK/4f3ZgJJm1dRz4fVJZRi/kLLWjnBKnebOePA4WNv+sV1pVA=="],- "@next/swc-linux-arm64-musl": ["@next/[email protected]", "", { "os": "linux", "cpu": "arm64" }, "sha512-7Vql0pgzCoHagv6+FNOZoqmJqA52c6zeVbhtS/47qFozO1MSx4ms7x7GHiciY8R5CDsSMKMQjJEryoJLcsBIbA=="],+ "@next/swc-linux-arm64-musl": ["@next/[email protected]", "", { "os": "linux", "cpu": "arm64" }, "sha512-dSjKSyWpzxoO1d3DIZZcP4XJcNaKeLmxQMFOiYl5vuBRMmweIqnAhty8tAmRsvTss779cK1FtYnDMj40e4TQlg=="],- "@next/swc-linux-x64-gnu": ["@next/[email protected]", "", { "os": "linux", "cpu": "x64" }, "sha512-NH/xzehyHEFWE2nlcZon7TB/0+H4shfWCi7S1zka815XCOhJDYZhoeJtOYy0dh0WVRWACVXSyGNFFytoMxUhRg=="],+ "@next/swc-linux-x64-gnu": ["@next/[email protected]", "", { "os": "linux", "cpu": "x64" }, "sha512-lbqOuz3RPRcv+o9msNsJw5x4+Y1ZwPTs6vmL6DCf7i0fZfvng/F59wyeDwqHIvV0mK//RBy/jJkZ+nCKsSMXjQ=="],- "@next/swc-linux-x64-musl": ["@next/[email protected]", "", { "os": "linux", "cpu": "x64" }, "sha512-lV4+EhWMfS8jcC+EH2nn/Cm5cn6XsgbE07bU9tMH8fCo0tNAqhyzi1b5wQ/Tn6NGFTvKDY65w3ZH95EjwBRAnQ=="],+ "@next/swc-linux-x64-musl": ["@next/[email protected]", "", { "os": "linux", "cpu": "x64" }, "sha512-+316WswI8ScVgZeUd+1KGaXkHhaYQzCjvH/05TZSpJ8zBizb1a4G7DtO7F12jcBIqMOtsz9ji1t48fmKtzqsGA=="],- "@next/swc-win32-arm64-msvc": ["@next/[email protected]", "", { "os": "win32", "cpu": "arm64" }, "sha512-/wKzAREX2RF++MhicjDbg8tGn2AiBIM0+EFeTFKoUEUbW5D6amCJehd5Z5G1H5/gxNdgnwoXMcHz24H/c2tGkQ=="],+ "@next/swc-win32-arm64-msvc": ["@next/[email protected]", "", { "os": "win32", "cpu": "arm64" }, "sha512-ji0gd4kMYUxO+1fJBIbiBVRCjzG/lloiyCccnlebvb1ZJ5qXCPZqYg4Jl1DrrixnWNMKylzgpmMWx0yNDYXlzw=="],- "@next/swc-win32-x64-msvc": ["@next/[email protected]", "", { "os": "win32", "cpu": "x64" }, "sha512-LNdCHzgLFc+UeqMS84LzXPaeBRKyqDN9OMyFAr1OrB0XrNw78IRrEVtZvvA7245W/HsaoeVOQX9jPjPk8jojwA=="],+ "@next/swc-win32-x64-msvc": ["@next/[email protected]", "", { "os": "win32", "cpu": "x64" }, "sha512-WcTlaKt/TWkh5kUjdJcUmB1XgZ+1c6fz4Y9fDHL73YNSdGaUWjceeWrrlwF0nv19iABYWC4iAq1oX1w4Bn0vfg=="],"@nodelib/fs.scandir": ["@nodelib/[email protected]", "", { "dependencies": { "@nodelib/fs.stat": "2.0.5", "run-parallel": "^1.1.9" } }, "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g=="],@@ -689,7 +689,7 @@"eslint": ["[email protected]", "", { "dependencies": { "@eslint-community/eslint-utils": "^4.8.0", "@eslint-community/regexpp": "^4.12.1", "@eslint/config-array": "^0.21.2", "@eslint/config-helpers": "^0.4.2", "@eslint/core": "^0.17.0", "@eslint/eslintrc": "^3.3.6", "@eslint/js": "9.39.5", "@eslint/plugin-kit": "^0.4.1", "@humanfs/node": "^0.16.6", "@humanwhocodes/module-importer": "^1.0.1", "@humanwhocodes/retry": "^0.4.2", "@types/estree": "^1.0.6", "ajv": "^6.14.0", "chalk": "^4.0.0", "cross-spawn": "^7.0.6", "debug": "^4.3.2", "escape-string-regexp": "^4.0.0", "eslint-scope": "^8.4.0", "eslint-visitor-keys": "^4.2.1", "espree": "^10.4.0", "esquery": "^1.5.0", "esutils": "^2.0.2", "fast-deep-equal": "^3.1.3", "file-entry-cache": "^8.0.0", "find-up": "^5.0.0", "glob-parent": "^6.0.2", "ignore": "^5.2.0", "imurmurhash": "^0.1.4", "is-glob": "^4.0.0", "json-stable-stringify-without-jsonify": "^1.0.1", "lodash.merge": "^4.6.2", "minimatch": "^3.1.5", "natural-compare": "^1.4.0", "optionator": "^0.9.3" }, "peerDependencies": { "jiti": "*" }, "optionalPeers": ["jiti"], "bin": { "eslint": "bin/eslint.js" } }, "sha512-DgZS62aPLXKlnxILS/AYCoRvHaZeXceIzlXPkkGGzJWSow1aEk0lbTlxUSlyjC8jcaKxAdOnTDz+o1JFSBsyjw=="],- "eslint-config-next": ["[email protected]", "", { "dependencies": { "@next/eslint-plugin-next": "16.3.5", "eslint-import-resolver-node": "^0.3.6", "eslint-import-resolver-typescript": "^3.5.2", "eslint-plugin-import": "^2.32.0", "eslint-plugin-jsx-a11y": "^6.10.0", "eslint-plugin-react": "^7.37.0", "eslint-plugin-react-hooks": "^7.0.0", "globals": "16.4.0", "typescript-eslint": "^8.46.0" }, "peerDependencies": { "eslint": ">=9.0.0", "typescript": ">=3.3.1" }, "optionalPeers": ["typescript"] }, "sha512-wPjq9MLQuWykHs8tsm2gH6OJThk6N27L8Te2JatlaGZ7jT1gtgGmJKukygL28xOlWsg5J1a1bGy/PvLyQC8OYA=="],+ "eslint-config-next": ["[email protected]", "", { "dependencies": { "@next/eslint-plugin-next": "16.3.8", "eslint-import-resolver-node": "^0.3.6", "eslint-import-resolver-typescript": "^3.5.2", "eslint-plugin-import": "^2.32.0", "eslint-plugin-jsx-a11y": "^6.10.0", "eslint-plugin-react": "^7.37.0", "eslint-plugin-react-hooks": "^7.0.0", "globals": "16.4.0", "typescript-eslint": "^8.46.0" }, "peerDependencies": { "eslint": ">=9.0.0", "typescript": ">=3.3.1" }, "optionalPeers": ["typescript"] }, "sha512-81vovwMe6NGnoFsl0KUJWzlS+y239i3fdsxs49gSEX3pDQW2cuKy+fxUPXNkQqqx6OCPheYPtBlSufc9aZ0k+w=="],"eslint-import-resolver-node": ["[email protected]", "", { "dependencies": { "debug": "^3.2.7", "is-core-module": "^2.16.1", "resolve": "^2.0.0-next.6" } }, "sha512-tRrKqFyCaKict5hOd244sL6EQFNycnMQnBe+j8uqGNXYzsImGbGUU4ibtoaBmv5FLwJwcFJNeg1GeVjQfbMrDQ=="],@@ -973,7 +973,7 @@"ndarray": ["[email protected]", "", { "dependencies": { "iota-array": "^1.0.0", "is-buffer": "^1.0.2" } }, "sha512-B4JHA4vdyZU30ELBw3g7/p9bZupyew5a7tX1Y/gGeF2hafrPaQZhgrGQfsvgfYbgdFZjYwuEcnaobeM/WMW+HQ=="],- "next": ["[email protected]", "", { "dependencies": { "@next/env": "16.3.5", "@swc/helpers": "0.5.23", "baseline-browser-mapping": "^2.9.19", "caniuse-lite": "^1.0.30001579", "postcss": "8.5.23", "styled-jsx": "5.1.6" }, "optionalDependencies": { "@next/swc-darwin-arm64": "16.3.5", "@next/swc-darwin-x64": "16.3.5", "@next/swc-linux-arm64-gnu": "16.3.5", "@next/swc-linux-arm64-musl": "16.3.5", "@next/swc-linux-x64-gnu": "16.3.5", "@next/swc-linux-x64-musl": "16.3.5", "@next/swc-win32-arm64-msvc": "16.3.5", "@next/swc-win32-x64-msvc": "16.3.5", "sharp": "^0.35.4" }, "peerDependencies": { "@opentelemetry/api": "^1.1.0", "@playwright/test": "^1.51.1", "babel-plugin-react-compiler": "*", "react": "^18.2.0 || 19.0.0-rc-de68d2f4-20241204 || ^19.0.0", "react-dom": "^18.2.0 || 19.0.0-rc-de68d2f4-20241204 || ^19.0.0", "sass": "^1.3.0" }, "optionalPeers": ["@opentelemetry/api", "@playwright/test", "babel-plugin-react-compiler", "sass"], "bin": { "next": "dist/bin/next" } }, "sha512-MdtsTgzyfCPRLC6uJ1mN8ao7lyJ4BB0U6Inhnx3gta1UcCIdHK3yxLG0E8OWQteWD8/Q0qb8A5o7wJaL8M9y2w=="],+ "next": ["[email protected]", "", { "dependencies": { "@next/env": "16.3.8", "@swc/helpers": "0.5.23", "baseline-browser-mapping": "^2.9.19", "caniuse-lite": "^1.0.30001579", "postcss": "8.5.23", "styled-jsx": "5.1.6" }, "optionalDependencies": { "@next/swc-darwin-arm64": "16.3.8", "@next/swc-darwin-x64": "16.3.8", "@next/swc-linux-arm64-gnu": "16.3.8", "@next/swc-linux-arm64-musl": "16.3.8", "@next/swc-linux-x64-gnu": "16.3.8", "@next/swc-linux-x64-musl": "16.3.8", "@next/swc-win32-arm64-msvc": "16.3.8", "@next/swc-win32-x64-msvc": "16.3.8", "sharp": "^0.35.4" }, "peerDependencies": { "@opentelemetry/api": "^1.1.0", "@playwright/test": "^1.51.1", "babel-plugin-react-compiler": "*", "react": "^18.2.0 || 19.0.0-rc-de68d2f4-20241204 || ^19.0.0", "react-dom": "^18.2.0 || 19.0.0-rc-de68d2f4-20241204 || ^19.0.0", "sass": "^1.3.0" }, "optionalPeers": ["@opentelemetry/api", "@playwright/test", "babel-plugin-react-compiler", "sass"], "bin": { "next": "dist/bin/next" } }, "sha512-U7QEZaTini6wKrb8A8hqLLqYQyCetegKjCpJOyxk642vWoMoU1x5PyZCJFvgYgiptA8xc5j/9xYlZFO7w9Sjmw=="],"node-addon-api": ["[email protected]", "", {}, "sha512-5m3bsyrjFWE1xf7nz7YXdN4udnVtXK6/Yfgn5qnahL6bCkf2yKt4k3nuTKAtT4r3IG8JNR2ncsIMdZuAzJjHQQ=="],diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.mdindex ed4922f8..142bed7e 100644--- a/docs/CHANGELOG.md+++ b/docs/CHANGELOG.md@@ -4,6 +4,12 @@Newest first. `docs/PROGRESS.md` is the source of truth for *why* a change was made;this is the *what*, and it is what Settings → Account → About shows as “What's new”.+## 2026-10-02++**Fixed**++- `alfa` preserve provider configuration and verify inference+## 2026-09-30**Added**diff --git a/docs/PROGRESS.md b/docs/PROGRESS.mdindex 08280bd9..b7860146 100644--- a/docs/PROGRESS.md+++ b/docs/PROGRESS.md@@ -1,3 +1,9 @@+## 2026-10-02 — Alfa configuration and inference readiness++Alfa's shared configuration route rejects malformed selections before writing, preserves the active provider on model-only changes, and stops provider changes from inheriting another provider's model. Codex needs an explicit account model when switching; custom connections without a model stay connect-only. Environment-backed built-ins now appear in the connected-provider list without exposing their keys. The Codex connection test uses the existing streaming adapter for a bounded inference check instead of relying only on model-list access. No additional AI SDK dependency is needed for the existing provider path. Regression checks cover malformed input, provider/model preservation, connect-only behavior, environment credentials and inference failures. Live Codex chat and a harmless function-call/result round trip were verified before release; deployment proof is recorded separately by the workflow.++The strict release audit found Next.js 16.3.5 affected by [GHSA-vcvr-r3jv-pc5j](https://github.com/vercel/next.js/security/advisories/GHSA-vcvr-r3jv-pc5j). Next.js and its matching ESLint configuration move to 16.3.8, with a clean strict dependency audit and a verified node-pty load. Shared-host verification uses a private umask and bounded Vitest workers; the original failed fixture cases pass under those conditions without relaxing security, timeout or coverage thresholds.+## 2026-09-30 — Follow-up scan: atomic CLI state and native environmentThe exact security release closed all seven reported alerts and exposed two file-check/use findings in previously integrated native-install and A2A-trace code. Native environment creation now uses one exclusive descriptor while preserving existing configuration, and all saved trace reads use a capped O_NOFOLLOW descriptor. Trace persistence accepts only known bounded metadata fields and validated identifiers; malformed API metadata is rejected before writing. The remaining network-to-file finding is intentional private JSON session/workflow metadata persistence, never an executable download; review and scanner state are recorded separately from the two code fixes.diff --git a/frontend/slices/assistant/CONTRACT.md b/frontend/slices/assistant/CONTRACT.mdindex dd2b7725..c31cb25b 100644--- a/frontend/slices/assistant/CONTRACT.md+++ b/frontend/slices/assistant/CONTRACT.md@@ -132,6 +132,7 @@ The Assistant chat now has a compact **Cockpit** bar + responsive panel (desktop- `Activity & Runs` merges client-side Alfa host-tool events with server MCP workflow activity only at the presentation layer. The execution engines remain separate; this is observability, not a fake shared workflow id.- Native MSO Agent sessions shown in Cockpit are **read-only summaries** and are explicitly separate from Alfa's browser YAML chat threads.- Provider/credential management remains Settings' responsibility. Cockpit can switch/test provider + model only among providers that are already connected; it never creates, copies, or exposes credentials.+- Connected providers include environment-backed built-ins. Model-only configuration keeps the active provider; provider changes choose that provider's default or declared model, and Codex requires an explicit account model. Custom providers without a model connect without changing the active selection. Codex's connection test performs a short inference through Alfa's existing streamer, with a 30-second timeout, rather than treating model-list access as chat readiness.Browser Automations likewise do not introduce a second executor. `Run` turns the saved ordered recipe into one Alfa task; the normal host-tool schemas, server guards, and approval rendezvous remain the execution path.diff --git a/lib/config/store.ts b/lib/config/store.tsindex 5ffe81e1..97a1ff16 100644--- a/lib/config/store.ts+++ b/lib/config/store.ts@@ -39,7 +39,7 @@ const RESERVED_RECORD_KEYS = new Set(["__proto__", "prototype", "constructor"]);export const DEFAULT_MODEL = defaultModelFor(DEFAULT_PROVIDER);export { DEFAULT_PROVIDER };-function safeProviderId(value: string): string {+export function safeProviderId(value: string): string {if (!PROVIDER_ID_RE.test(value) || RESERVED_RECORD_KEYS.has(value)) throw new Error("invalid provider id");return value;}diff --git a/package.json b/package.jsonindex 456f2fc8..d9f191fa 100644--- a/package.json+++ b/package.json@@ -78,7 +78,7 @@"geist": "^1.7.2","konva": "^10.6.0","lucide-react": "^1.47.0",- "next": "^16.3.5",+ "next": "^16.3.8","node-pty": "^1.1.0","react": "^19.3.0","react-dom": "^19.3.0",@@ -107,7 +107,7 @@"@types/react-dom": "^19.3.0","@vitest/coverage-v8": "5.0.1","eslint": "^9.39.4",- "eslint-config-next": "^16.3.5",+ "eslint-config-next": "^16.3.8","fast-check": "^4.10.2","parse5": "8.0.1","postcss": "^8.5.28",