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
feat(models): discover model ids from custom endpoints
Abdurrahman Fakhrul5fc9a5f548ec
diff --git a/app/api/models/discover/route.test.ts b/app/api/models/discover/route.test.tsnew file mode 100644index 00000000..324f51be--- /dev/null+++ b/app/api/models/discover/route.test.ts@@ -0,0 +1,158 @@+import { beforeEach, describe, expect, it, vi } from "vitest";+import { NextRequest } from "next/server";+import { requireSession } from "@/lib/auth/require-session";++const mocks = vi.hoisted(() => ({+ readConfig: vi.fn(),+ getKey: vi.fn(),+ safeProviderId: vi.fn(),+ discoverEndpointModels: vi.fn(),+ assertSafeUrl: vi.fn(),+ safeProviderFetch: vi.fn(),+}));+const { readConfig, getKey, safeProviderId, discoverEndpointModels, assertSafeUrl, safeProviderFetch } = mocks;++vi.mock("@/lib/auth/require-session", () => ({ requireSession: vi.fn(async () => true) }));+vi.mock("@/lib/config/store", () => ({+ readConfig: mocks.readConfig,+ hostCredentialStore: () => ({ getKey: mocks.getKey }),+ safeProviderId: mocks.safeProviderId,+}));+vi.mock("@/lib/models/discover.js", () => ({ discoverEndpointModels: mocks.discoverEndpointModels }));+vi.mock("@/lib/host/ssrf", () => ({+ assertSafeUrl: mocks.assertSafeUrl,+ safeProviderFetch: mocks.safeProviderFetch,+}));++const post = (body: unknown) =>+ new NextRequest("http://localhost/api/models/discover", {+ method: "POST",+ body: JSON.stringify(body),+ });++describe("/api/models/discover", () => {+ beforeEach(() => {+ vi.mocked(requireSession).mockReset().mockResolvedValue(true);+ readConfig.mockReset().mockResolvedValue({});+ getKey.mockReset().mockResolvedValue("stored-key");+ safeProviderId.mockReset().mockImplementation((v: string) => v);+ discoverEndpointModels.mockReset().mockResolvedValue([{ id: "gpt-oss", name: "gpt-oss" }]);+ assertSafeUrl.mockReset().mockImplementation((raw: string) => new URL(raw));+ });++ it("requires Owner before reading config or touching a URL", async () => {+ vi.mocked(requireSession).mockResolvedValue(false);+ const { POST } = await import("./route");+ const res = await POST(post({ baseURL: "https://gateway.example/v1", apiKey: "sk-secret" }));+ expect(res.status).toBe(401);+ expect(requireSession).toHaveBeenCalledWith("owner");+ expect(discoverEndpointModels).not.toHaveBeenCalled();+ expect(assertSafeUrl).not.toHaveBeenCalled();+ expect(readConfig).not.toHaveBeenCalled();+ });++ it("rejects a malformed body with 400 before any network access", async () => {+ const { POST } = await import("./route");+ for (const body of [null, [], { protocol: "nope" }, { baseURL: 5 }, { apiKey: true }]) {+ expect((await POST(post(body))).status).toBe(400);+ }+ expect(discoverEndpointModels).not.toHaveBeenCalled();+ });++ it("discovers inline credentials through the pinned transport and never echoes the key", async () => {+ const { POST } = await import("./route");+ const res = await POST(+ post({ baseURL: "https://gateway.example/v1/", apiKey: "sk-secret", protocol: "anthropic" }),+ );+ expect(res.status).toBe(200);+ const body = await res.json();+ expect(body).toEqual({ ok: true, count: 1, models: [{ id: "gpt-oss", name: "gpt-oss" }] });+ expect(JSON.stringify(body)).not.toContain("sk-secret");+ expect(assertSafeUrl).toHaveBeenCalledWith("https://gateway.example/v1/");+ expect(discoverEndpointModels).toHaveBeenCalledWith(+ { baseUrl: "https://gateway.example/v1", apiKey: "sk-secret", protocol: "anthropic" },+ { fetchImpl: safeProviderFetch },+ );+ });++ it("defaults the inline protocol to openai", async () => {+ const { POST } = await import("./route");+ await POST(post({ baseURL: "https://gateway.example/v1", apiKey: "sk-secret" }));+ expect(discoverEndpointModels).toHaveBeenCalledWith(+ { baseUrl: "https://gateway.example/v1", apiKey: "sk-secret", protocol: "openai" },+ { fetchImpl: safeProviderFetch },+ );+ });++ it("requires baseURL and apiKey for the inline path", async () => {+ const { POST } = await import("./route");+ expect((await POST(post({ baseURL: "https://gateway.example/v1" }))).status).toBe(400);+ expect((await POST(post({ apiKey: "sk" }))).status).toBe(400);+ expect(discoverEndpointModels).not.toHaveBeenCalled();+ });++ it("maps an unsafe URL to 400 without fetching", async () => {+ assertSafeUrl.mockImplementation(() => {+ throw new Error("Base URL must use HTTPS");+ });+ const { POST } = await import("./route");+ const res = await POST(post({ baseURL: "http://169.254.169.254/v1", apiKey: "sk" }));+ expect(res.status).toBe(400);+ expect(await res.json()).toEqual({ error: "Base URL must use HTTPS" });+ expect(discoverEndpointModels).not.toHaveBeenCalled();+ });++ it("discovers a saved provider using the host-stored key", async () => {+ readConfig.mockResolvedValue({+ customProviders: { "my-llm": { baseUrl: "https://gw.example/v1", protocol: "anthropic" } },+ });+ getKey.mockResolvedValue("stored-key");+ const { POST } = await import("./route");+ const res = await POST(post({ provider: "my-llm" }));+ expect(res.status).toBe(200);+ expect(await res.json()).toEqual({ ok: true, count: 1, models: [{ id: "gpt-oss", name: "gpt-oss" }] });+ expect(getKey).toHaveBeenCalledWith(undefined, "my-llm");+ expect(assertSafeUrl).not.toHaveBeenCalled();+ expect(discoverEndpointModels).toHaveBeenCalledWith(+ { baseUrl: "https://gw.example/v1", apiKey: "stored-key", protocol: "anthropic" },+ { fetchImpl: safeProviderFetch },+ );+ });++ it("rejects an unknown custom provider with 400", async () => {+ readConfig.mockResolvedValue({ customProviders: {} });+ const { POST } = await import("./route");+ const res = await POST(post({ provider: "nope" }));+ expect(res.status).toBe(400);+ expect(discoverEndpointModels).not.toHaveBeenCalled();+ });++ it("maps a provider-id validation failure to 400", async () => {+ safeProviderId.mockImplementation(() => {+ throw new Error("invalid provider id");+ });+ const { POST } = await import("./route");+ expect((await POST(post({ provider: "bad id" }))).status).toBe(400);+ expect(discoverEndpointModels).not.toHaveBeenCalled();+ });++ it("reports a missing stored key without calling the endpoint", async () => {+ readConfig.mockResolvedValue({ customProviders: { "my-llm": { baseUrl: "https://gw.example/v1" } } });+ getKey.mockResolvedValue(null);+ const { POST } = await import("./route");+ const res = await POST(post({ provider: "my-llm" }));+ expect(res.status).toBe(200);+ expect(await res.json()).toMatchObject({ ok: false, error: expect.stringContaining("no stored API key") });+ expect(discoverEndpointModels).not.toHaveBeenCalled();+ });++ it("surfaces a discovery failure as ok:false without leaking the key", async () => {+ discoverEndpointModels.mockRejectedValue(new Error("model discovery HTTP 401"));+ const { POST } = await import("./route");+ const res = await POST(post({ baseURL: "https://gw.example/v1", apiKey: "sk-secret" }));+ expect(res.status).toBe(200);+ const body = await res.json();+ expect(body).toEqual({ ok: false, error: "model discovery HTTP 401" });+ expect(JSON.stringify(body)).not.toContain("sk-secret");+ });+});diff --git a/app/api/models/discover/route.ts b/app/api/models/discover/route.tsnew file mode 100644index 00000000..52d673a9--- /dev/null+++ b/app/api/models/discover/route.ts@@ -0,0 +1,70 @@+import { NextRequest, NextResponse } from "next/server";+import { requireSession } from "@/lib/auth/require-session";+import { hostCredentialStore, readConfig, safeProviderId } from "@/lib/config/store";+import { discoverEndpointModels } from "@/lib/models/discover.js";+import { assertSafeUrl, safeProviderFetch } from "@/lib/host/ssrf";++export const runtime = "nodejs";+export const dynamic = "force-dynamic";++// List the model ids a custom endpoint actually serves, so it can be configured+// without knowing them in advance. Owner-only. Two credential sources:+// • `provider` — an already-saved custom provider; the key comes from the host store.+// • `baseURL` + `apiKey` (+`protocol`) — while adding one, before it is saved.+// A custom URL is SSRF-checked and fetched through the pinned transport, so DNS+// cannot rebind at connect. The key is never returned, logged, or read back.+type DiscoverBody = { provider?: string; baseURL?: string; apiKey?: string; protocol?: string };++export async function POST(req: NextRequest) {+ if (!(await requireSession("owner"))) {+ return NextResponse.json({ error: "Unauthorized" }, { status: 401 });+ }++ let body: DiscoverBody;+ try {+ body = await req.json();+ if (!body || typeof body !== "object" || Array.isArray(body)+ || [body.provider, body.baseURL, body.apiKey].some((v) => v !== undefined && typeof v !== "string")+ || (body.protocol !== undefined && body.protocol !== "openai" && body.protocol !== "anthropic")) {+ throw new Error("invalid");+ }+ } catch {+ return NextResponse.json({ error: "Invalid request body" }, { status: 400 });+ }++ let baseUrl: string;+ let apiKey: string;+ let protocol: "openai" | "anthropic";+ if (body.provider !== undefined) {+ let slug: string;+ try {+ slug = safeProviderId(body.provider.trim());+ } catch {+ return NextResponse.json({ error: "Invalid provider" }, { status: 400 });+ }+ const conn = (await readConfig()).customProviders?.[slug];+ if (!conn) return NextResponse.json({ error: `"${slug}" is not a custom provider` }, { status: 400 });+ baseUrl = conn.baseUrl;+ protocol = conn.protocol === "anthropic" ? "anthropic" : "openai";+ apiKey = (await hostCredentialStore().getKey(undefined, slug)) ?? "";+ if (!apiKey) return NextResponse.json({ ok: false, error: `no stored API key for "${slug}"` });+ } else {+ if (!body.baseURL?.trim() || !body.apiKey?.trim()) {+ return NextResponse.json({ error: "baseURL and apiKey are required" }, { status: 400 });+ }+ try {+ baseUrl = assertSafeUrl(body.baseURL.trim()).toString().replace(/\/$/, "");+ } catch (e) {+ return NextResponse.json({ error: (e as Error).message }, { status: 400 });+ }+ apiKey = body.apiKey.trim();+ protocol = body.protocol === "anthropic" ? "anthropic" : "openai";+ }++ try {+ const models = await discoverEndpointModels({ baseUrl, apiKey, protocol }, { fetchImpl: safeProviderFetch });+ return NextResponse.json({ ok: true, count: models.length, models });+ } catch (e) {+ return NextResponse.json({ ok: false, error: (e as Error).message });+ }+}diff --git a/app/api/models/route.test.ts b/app/api/models/route.test.tsindex ab688648..0430bde1 100644--- a/app/api/models/route.test.ts+++ b/app/api/models/route.test.ts@@ -5,6 +5,7 @@ import { requireSession } from "@/lib/auth/require-session";const listModels = vi.fn();const readOAuthBundle = vi.fn();const writeOAuthBundle = vi.fn();+const readConfig = vi.fn();const codexModels = vi.fn();const ensureFreshCodex = vi.fn();@@ -13,6 +14,8 @@ vi.mock("@/lib/models", () => ({ listModels: (...args: unknown[]) => listModels(vi.mock("@/lib/config/store", () => ({readOAuthBundle: (...args: unknown[]) => readOAuthBundle(...args),writeOAuthBundle: (...args: unknown[]) => writeOAuthBundle(...args),+ readConfig: (...args: unknown[]) => readConfig(...args),+ safeProviderId: (value: string) => value,}));vi.mock("@/lib/ai/oauth/codex", () => ({codexModels: (...args: unknown[]) => codexModels(...args),@@ -48,6 +51,7 @@ describe("/api/models dynamic pricing and provider mapping", () => {]);readOAuthBundle.mockReset().mockResolvedValue(null);writeOAuthBundle.mockReset();+ readConfig.mockReset().mockResolvedValue({});codexModels.mockReset();ensureFreshCodex.mockReset();});@@ -74,6 +78,37 @@ describe("/api/models dynamic pricing and provider mapping", () => {expect(body.models.map((m: { id: string }) => m.id)).toEqual(["glm-free"]);});+ it("returns a custom provider's declared ids instead of an empty catalog", async () => {+ readConfig.mockResolvedValue({+ customProviders: { "my-llm": { baseUrl: "https://gw.example/v1", models: ["b", "a"] } },+ });+ const { GET } = await import("./route");+ const res = await GET(new NextRequest("http://localhost/api/models?provider=my-llm"));+ const body = await res.json();+ expect(body.models).toEqual([+ { ref: "my-llm/b", provider: "my-llm", id: "b", name: "b", free: false, agentReady: false },+ { ref: "my-llm/a", provider: "my-llm", id: "a", name: "a", free: false, agentReady: false },+ ]);+ expect(listModels).not.toHaveBeenCalled();+ });++ it("keeps a custom provider free query empty (no models.dev pricing)", async () => {+ readConfig.mockResolvedValue({+ customProviders: { "my-llm": { baseUrl: "https://gw.example/v1", models: ["a"] } },+ });+ const { GET } = await import("./route");+ const res = await GET(new NextRequest("http://localhost/api/models?provider=my-llm&free=1"));+ expect((await res.json()).models).toEqual([]);+ });++ it("falls back to the catalog when the provider is not custom", async () => {+ readConfig.mockResolvedValue({ customProviders: { other: { baseUrl: "https://gw.example/v1" } } });+ const { GET } = await import("./route");+ const res = await GET(new NextRequest("http://localhost/api/models?provider=glm"));+ expect((await res.json()).models).toHaveLength(3);+ expect(listModels).toHaveBeenCalled();+ });+it.each(["openai-codex", "glm", ""])("requires an owner before any provider access (%s)", async (provider) => {vi.mocked(requireSession).mockResolvedValue(false);const { GET } = await import("./route");@@ -84,6 +119,7 @@ describe("/api/models dynamic pricing and provider mapping", () => {expect(listModels).not.toHaveBeenCalled();expect(readOAuthBundle).not.toHaveBeenCalled();expect(writeOAuthBundle).not.toHaveBeenCalled();+ expect(readConfig).not.toHaveBeenCalled();expect(ensureFreshCodex).not.toHaveBeenCalled();expect(codexModels).not.toHaveBeenCalled();});diff --git a/app/api/models/route.ts b/app/api/models/route.tsindex c51c3fb8..1c528470 100644--- a/app/api/models/route.ts+++ b/app/api/models/route.ts@@ -2,7 +2,7 @@ import { NextRequest, NextResponse } from "next/server";import { requireSession } from "@/lib/auth/require-session";import { listModels } from "@/lib/models";import { isFreeModel, providerCatalogId } from "@/lib/models/discovery.js";-import { readOAuthBundle, writeOAuthBundle } from "@/lib/config/store";+import { readConfig, readOAuthBundle, safeProviderId, writeOAuthBundle } from "@/lib/config/store";import { codexModels, ensureFreshCodex } from "@/lib/ai/oauth/codex";export const runtime = "nodejs";@@ -44,6 +44,27 @@ export async function GET(req: NextRequest) {});}+ // A custom endpoint has no models.dev entry, so the picker reads the ids the+ // owner declared/discovered for it instead of returning an empty catalog.+ if (provider) {+ try {+ const conn = (await readConfig()).customProviders?.[safeProviderId(provider)];+ if (conn) {+ const models = freeOnly ? [] : (conn.models ?? []).map((id) => ({+ ref: `${provider}/${id}`,+ provider,+ id,+ name: id,+ free: false,+ agentReady: false,+ }));+ return NextResponse.json({ models });+ }+ } catch {+ // An invalid provider id falls through to the catalog filter below.+ }+ }+try {const all = await listModels();const catalogId = provider ? providerCatalogId(provider) : null;diff --git a/bin/mso.test.ts b/bin/mso.test.tsindex a3944400..d9576ddc 100644--- a/bin/mso.test.ts+++ b/bin/mso.test.ts@@ -153,7 +153,9 @@ describe("bin/mso", () => {// they actually issue, so this stays a method check, not a free pass.const HELPERS: Record<string, string[]> = {GET: ["jget", "reqraw", "curl"],- POST: ["jpost", "req -F", "-X POST"],+ // secret_post is the stdin-bodied POST used for credentials and now for+ // model discovery (which carries a pasted API key, so it must stay off argv).+ POST: ["jpost", "req -F", "-X POST", "secret_post"],PUT: ["jput"],PATCH: ["jpatch"],DELETE: ["jdel"],diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.mdindex ce3fd62d..9e847fb6 100644--- a/docs/CHANGELOG.md+++ b/docs/CHANGELOG.md@@ -4,1489 +4,14 @@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-15--**Fixed**--- `security-core` parse the provider case arm on its own lines-- `oauth` re-register a cached public client id on demand--**Faster**--- `appshell` memoise chat rows and show human tool identity--## 2026-10-14--**Added**--- `tenancy` owner-only enrollment CLI for tenant bindings--**Fixed**--- `cli` repair provider picker and make models add scriptable-- `config` keep tenant config path traceable by Turbopack--## 2026-10-13--**Added**--- `config` per-tenant credential store under OS_MULTIUSER_ROOT--**Tests**--- `e2e` right-click the desktop from its measured box-- `e2e` scope workflow directory assertions to the panel--**Build**--- `deps-dev` bump the development-minor-patch group with 3 updates-- `deps` bump the production-minor-patch group with 15 updates-- `deps-dev` bump the test-toolchain group with 2 updates--## 2026-10-12--**Added**--- `channels` start an Agent group from a bound Telegram group-- `agent-group` multi-agent discussion groups over Hermes profiles--**Fixed**--- `agent-group` spawn hermes by name to keep build tracing static--## 2026-10-10--**Added**--- `vault` read agent knowledge natively in MSO--**Fixed**--- `security` preserve worker grants and bound file reads-- `mcp` retain scanner limits and document mailbox parity-- `security` close credential sinks and revoke pending sessions-- `mcp` preserve managed configuration behind credential guards-- `security` bind receipts to authority and pin browser artifacts-- `security` keep connected app bootstrap code static-- `security` protect public admission and OAuth registration trust--**Faster**--- `vault` bound unfinished Markdown link matching--**Tests**--- `security` keep raw stream fixture fully parseable-- `e2e` scope MCP refresh to its tab panel-- `managed-apps` wait for durable job finalization before cleanup-- `workflows` complete waited receipt fixture schema-- `oauth` receive consent callbacks outside the shell-- `security` exercise webhook admission with explicit proxy trust-- `auth` isolate default proxy policy from host configuration--**Other**--- `mcp` keep local agent tools within architecture limit--## 2026-10-09--**Added**--- `apps` reuse MSO sessions for private connected apps-- `agent-vault` isolate repository progress in private Obsidian vaults--**Fixed**--- `security` close rescan authorization and isolation gaps-- `agent-vault` reuse shared styles within the shell bundle budget-- `security` pin bounded MCP store reads to one descriptor-- `oauth` keep registered consent within narrow viewports-- `security` enforce live delegated grants and bound provider and OAuth state-- `security` close remaining repository scan trust boundaries--**Tests**--- `security` assert oversized admission before body transfer-- `security` preserve regressions without synthetic scanner matches-- `security` exercise managed app authorization on its actual host-- `workflow` pin grant fixture time during revocation checks-- `security` run app cookie proof in the browser release lane--**Docs**--- `security` document legacy cookie cleanup configuration--## 2026-10-08--**Fixed**--- `macos` align window title and control edges-- `appshell` inherit macOS menu colors without extra CSS-- `appshell` align macOS menu symbol colors-- `macos` unify shared menu glass material-- `macos` unify shared menu typography with Figma reference-- `fs` cap the complete enumeration response-- `security` revalidate durable authority and bound follow-up scan paths-- `heartbeat` preserve relative env paths in cron-- `ux` reuse existing loading and glass styles within the shell budget-- `heartbeat` use parseable multiline shell case statements-- `ux` stack install notice above the update badge without overlap-- `build` keep guarded host runtime paths out of asset tracing-- `security` close resource and launcher gaps and repair gates-- `security` inspect ZIP output through pinned descriptor-- `ci` close gateway typing and audit file races-- `security` pin NodeSource bootstrap bytes-- `security` bound managed-app backup retention-- `security` bound audit growth and tail reads-- `security` bind gateway tunnels to proven local runtime-- `ux` Spotlight contrast, cold-load splash, and safe P2 polish-- `security` fail closed on mutable managed-app updates-- `security` keep OpenClaw provider keys out of argv-- `security` serialize managed-app lifecycle cross-process-- `security` bound archive generation resources-- `security` serialize bounded image imports-- `security` require exec for A2A loopback discovery-- `security` isolate PAT principals and revoke refresh replay-- `ci` clear typecheck, OSV, and reviewed history gates-- `security` require authenticated workflow webhooks-- `security` block delegated writes to control plane--**Changed**--- `macos` centralize shared chrome geometry and typography-- `security` keep authority fixes within architecture line limits--**Tests**--- `macos` measure menu width after opening animation-- `security` distinguish synthetic A2A redaction fixture-- `security` verify production sockets and preserve bounded project scans-- `lock` wait for the privacy curtain keyboard listener before unlocking--## 2026-10-07--**Fixed**--- `security` bound public ingress bodies-- `security` enforce live workflow authority-- `security` harden credential and A2A boundaries--**Docs**--- `security` record scan hardening boundaries--## 2026-10-06--**Added**--- `runtime` add opt-in cron heartbeat for fallback recovery-- integrate verified MSO shell and tenant changes--**Fixed**--- `deps` update sharp override for librsvg security patch-- `deps` update source-map-js to patched 1.2.2-- `agent` preserve overlapping standby wakeups--**Tests**--- `e2e` wait for deferred lock keyboard listener--**Docs**--- reconcile reviewed 9Router app-host proposal--## 2026-10-05--**Chores**--- `deps-dev` bump simple-icons--**CI**--- preserve strict audit and require native audit and shell journeys--## 2026-10-04--**Added**--- `appearance` refresh default light and dark wallpapers--**Fixed**--- `appearance` version immutable default wallpaper URLs-- `appearance` refine default 27 desktop wallpapers-- `security` clear unfixed dependency and Semgrep audit gates--**Chores**--- `deps` bump the actions-minor-patch group with 3 updates-- `deps` bump the production-minor-patch group with 5 updates-- `deps-dev` bump the test-toolchain group with 2 updates--## 2026-10-02--**Fixed**--- `alfa` preserve provider configuration and verify inference--## 2026-09-30--**Added**--- `settings` surface MSO updates in footer-- `assistant` show explicit run state and scoped approvals--**Fixed**--- `security` validate trace metadata and use atomic file descriptors-- `security` bound code-scanning filesystem paths and CLI test execution-- `organization` memoize focused groups and retain group search-- `deps` update brace-expansion within supported major lines-- `reconciliation` close combined environment and fixture contracts--**Changed**--- `local-agent` keep lifecycle initialization within source gate-- `alfa` extract dated transcript within source size gate--**Tests**--- `security` isolate count and identity scans from elapsed deadlines-- `store` align standalone assertions with page readiness budget--**Docs**--- `progress` record verified reconciliation takeover--## 2026-09-29--**Added**--- `a2a` add provider-neutral workflow trace skill--## 2026-09-28--**Added**--- `app-store` read bounded MANEF catalog metadata-- `host` begin native platform runtime adapters-- `store` import portable connected app manifests--**Tests**--- `host` exercise native macOS and Windows candidate build-- `projects` isolate count and deadline continuation budgets--**Chores**--- `deps-dev` bump the development-minor-patch group across 1 directory with 3 updates-- `deps` bump the actions-minor-patch group with 3 updates-- `deps` bump the production-minor-patch group with 5 updates-- `deps-dev` bump the test-toolchain group with 2 updates--## 2026-09-27--**Added**--- `shell` persist and embed external app connections-- `managed-apps` preflight install backend on host-- `jev` persist reusable session capsules-- `settings` nest version and updates under About--**Fixed**--- `settings` keep action labels readable on dark cards-- `install` preserve portable host commits and validate WSL2-- `jev` validate decision release contract-- `jev` open responsive session details in release journey-- `settings` align MCP release journey with breadcrumbs-- `settings` scroll MCP pages without reading a ref during render--**Docs**--- `features` define modular external feature contract-- `release` record Windows taskbar fidelity--## 2026-09-26--**Added**--- `jev` productionize decision plane-- `settings` add an Account section for profile, password, devices, and about-- `jev` add policy-bound MCP actions-- `workflows` isolate source-changing agents-- `agent` recover interrupted sessions automatically-- connect OpenRouter for JEV without switching model-- route JEV through OpenRouter and preserve sessions-- `integrations` clarify DOKU credential fields-- `memory` expose backup history and checksum-bound verification receipts--**Fixed**--- `jev` close release contract gaps-- `auth` rebuild the account profile before writing it-- `windows` match native taskbar proportions-- `worktrees` keep runtime paths out of build tracing-- `memory` keep runtime backup paths out of build tracing-- `tests` make recovery fixtures portable-- `workflows` close source isolation bypasses-- `config` document agent worktree root-- tolerate bounded session name contention--**Changed**--- `mcp` preserve architecture line ratchet--**Tests**--- `memory` isolate backup panel accessibility and preserve failure evidence--**Docs**--- refresh changelog for Windows taskbar fidelity-- `launch` focus demo on one verifiable agent journey-- `launch` define measurable MSO readiness contract--## 2026-09-25--**Added**--- `memory` preserve session sources and expose owner second brain-- `integrations` add native Google OAuth and read-only APIs--**Fixed**--- `memory` exclude guarded runtime backup paths from build tracing-- `integrations` expose native Google through MCP schemas--**Docs**--- `integrations` finalize native Google MCP verification-- `integrations` record native Google verification--**Other**--- `memory` preserve non-destructive backup worker checkpoint-- `memory` preserve bounded discovery worker checkpoint--## 2026-09-24--**Added**--- `memory-graph` add an owner knowledge graph-- `integrations` add JEV variables and AI providers tab-- `workflows` add Jev flow optimizer--**Changed**--- `workflows` remove optimizer type cycle--**Docs**--- `integrations` record release verification--**Chores**--- `workflows` finalize Jev flow optimizer release--## 2026-09-23--**Added**--- `mcp` add personal access tokens and auto-session fallback--**Fixed**--- `security` pin Termux guest installer payload-- `architecture` keep Dokploy adapter within ratchet-- `dokploy` sync public Docker build args-- `security` restore federation gate checks-- `dns` support wildcard staging hosts-- `termux` pin guest bootstrap and align platform contracts-- `ci` keep PAT scope case parseable by strict Semgrep--**Tests**--- `channels` avoid secret-like Discord fixture-- `termux` avoid check then read race in launcher fixture--**Docs**--- `mcp` record restored PAT quality gates-- `termux` record PRoot isolation and verification--**Other**--- `channels` allowlist synthetic Discord fixtures--## 2026-09-22--**Added**--- `channels` add Telegram and Discord channels-- `federation` bridge Batonly to MSO and SI-Coder-- `workflows` split n8n and improve org automation ux--**Fixed**--- `cli` cover federation status and PAT creation-- `termux` make partial installs resumable on low memory-- `mcp` restore main quality gates-- `termux` replace legacy launcher symlink safely-- `termux` isolate Linux runtime inside PRoot-- `mcp` publish modern cache hints-- `workflows` reopen details on node selection-- `mcp` normalize widget resource discovery--**Changed**--- `graph` establish shared flow foundation-- `ui` reduce organization and workflow chrome--**Tests**--- `workflows` update details selection contract--## 2026-09-21--**Added**--- `workflows` refine builder and organization focus UX--**Fixed**--- `mcp` negotiate native app ui--**Chores**--- `deps-dev` bump the development-minor-patch group with 3 updates-- `deps` bump the production-minor-patch group with 4 updates--## 2026-09-20--**Added**--- `workflows` add bounded repeat-until loops-- `agent` add durable local-agent standby--**Fixed**--- `alfa` restore mobile text selection and copy-- `mcp` add native UI host probe-- `chatgpt` stage portable OpenAI plugin package-- `memory` keep large typed projections mutable--## 2026-09-19--**Added**--- `memory` close self-improvement loop-- `cognitive` add bounded replay and candidate reuse-- `install` add detailed platform tabs-- `mcp` encode agent bootstrap and capability-parity map--**Fixed**--- `integrations` classify resend scope-limited doctor safely-- `browser` stop Camoufox session cleanly-- `plugin` distinguish staging from ChatGPT app install-- `memory` persist workflow and organization actions-- `browser` settle Camoufox viewer auth before reload-- `browser` keep Camoufox viewer transport clean-- `plugin` bind ChatGPT app by stable app id only-- `cli` keep candidate command parser strict-- `plugin` keep OpenAI app binding private per install-- `security` keep remote-authority test shell path trusted-- `security` keep installer sources strict-semgrep parseable-- `browser` reload viewer after ticket exchange-- `mcp` harden native UI and plugin bindings-- `ai` separate provider connect from selection-- `security` bind Convex snapshot path identity-- `browser` derive isolated Camoufox viewer origin-- `browser` probe cache-isolated Camoufox path-- `security` pin Convex snapshot import bytes-- `security` keep macOS installer fully parseable-- `mcp` keep architecture ratchet and bootstrap tests green-- `browser` route Camoufox websocket through viewer namespace-- `browser` isolate Camoufox viewer cache--**Changed**--- `security` isolate Convex snapshot staging--**Tests**--- `browser` keep viewer reload regression within architecture ratchet-- `security` keep snapshot regression descriptor-only--**Chores**--- `mcp` advance graph toolset signature--## 2026-09-18--**Added**--- `install` add cross-platform host adapters-- `integrations` add safe Convex Cloud deploy runner-- `ci` add independent exact-SHA verification runner-- `workflows` add reviewed external editor tabs-- `graph` add selected custom nodes and readable connection routing-- `organization` add internal project flows with callable CRUD--**Fixed**--- `browser` isolate sibling Camoufox viewer auth-- `integrations` allow Convex snapshot imports-- `security` cover reviewed static asset variants-- `review` preserve session and surface store invariants-- `security` validate cache exceptions from raw report-- `security` scope passive cache review by path-- `auth` permanently revoke retired cookie sessions-- `workflows` preserve explicit empty sandbox-- `security` review cache-only passive signal-- `graph` close routing and compact focus review-- `auth` bind sessions to cookie scope-- `workflows` remount editors when sandbox policy changes-- `workflows` retain approved shared surface placements-- `browser` keep Camoufox automation on demand-- `workflows` isolate external editors from cockpit session cookies-- `ci` preserve repository-owned local gate environment-- `graph` reconcile controlled selection and preserve routing groundwork-- `workflows` keep runtime registry out of deployment tracing-- `security` apply existing ZAP informational policy explicitly-- `security` require executed passive scan evidence-- `security` restore native dependency update cooldown-- `browser` retain private viewer connectivity without server access-- `release` align Node support and read-only browser reconnects-- `extensions` lock project controls until initial inspection-- `browser` diagnose secure viewer failures without losing power state--**Tests**--- `security` track reviewed cache signal-- `browser` make viewer fixtures independent of host configuration-- `security` inspect organization fixture through one descriptor--**Docs**--- `progress` preserve merged release order-- `ci` document independent runner state directory-- `security` document the hosted passive scan target--**Chores**--- `deps-dev` bump @types/node-- `deps` bump the production-minor-patch group across 1 directory with 7 updates--## 2026-09-17--**Added**--- `workflows` add exact session artifact history-- `store` unify VPS MCP and skills installation with dynamic host harness--**Fixed**--- `ci` reconcile dependency updates as matched toolchains-- `security` retain cooldown for native dependency updates-- `installer` lock isolated native build tool dependencies-- `proxy` finish portable managed-app loopback relay-- `workflows` pin private storage reads and atomic writes-- `ci` preserve strict scanner coverage on hosted release-- `forge` make sandbox bootstrap portable on hosted Linux-- `integrations` preserve implicit direct connection compatibility-- `doctor` respect no-systemd and remote runtimes-- `workflows` harden reconciled artifact history reads-- `integrations` prefer GitHub OAuth-- `hosted` restore updates and Hermes runtime-- `update` recover no-systemd container installs-- `installer` build node-pty reliably on Codespaces-- `managed-apps` support Hermes without systemd--**Faster**--- `workflows` keep runtime artifacts out of build tracing-- `shell` defer optional surfaces and bound cold-load bundles--**Changed**--- `gateway` isolate provider adapter boundary-- `gateway` make lifecycle provider agnostic--**Tests**--- `security` drain lock contenders before fixture cleanup-- `gateway` reap lock holder fixtures without orphan processes-- `workflows` stabilize repeated artifact inspection journeys--**Docs**--- `comparison` refresh product audit--**Chores**--- `deps` bump the actions-minor-patch group with 3 updates-- `deps-dev` bump postcss in the development-minor-patch group-- `deps` bump the production-minor-patch group with 7 updates-- `release` bump app version to 0.2.18-- `release` bump app version to 0.2.17--## 2026-09-16--**Added**--- `workflows` close session self-improvement loop-- `mcp` add compact ChatGPT list surface-- `plugins` add structured OpenAI skill contracts-- `workflows` stabilize semantic action references-- `workflows` add semantic session flows-- `workflows` visualize agent sessions-- `ai` add dynamic free provider discovery-- `workflows` maximize script and search automation--**Fixed**--- `plugin` support optional connector bindings-- `workflows` keep session nodes clear on compact canvas-- `workflows` dismiss session inspector on handoff-- `canvas` isolate react flow accessibility ids-- `workflows` keep compact session nodes clickable--**Changed**--- `workflows` satisfy session graph release gates--**Tests**--- `workflows` count hidden terminal sessions during inspector-- `workflows` expand semantic action receipt reliably-- `workflows` target semantic action summary-- `workflows` expand session actions before launch-- `mcp` close mobile session windows-- `canvas` scope graph controls per app-- `mcp` clean workflow window after session journey-- `mcp` restore settings after terminal handoff-- `mcp` preserve preexisting terminal state-- `mcp` close session terminal across shells-- `mcp` close terminal after session graph check--**Docs**--- `plugin` clarify extension taxonomy--## 2026-09-15--**Added**--- `workflows` finish edge controls and directory-- `workflows` complete canvas runtime-- `canvas` unify organization and workflow navigation-- `organization` surface as first-class app-- `organization` add agent org chart and routing-- `workflows` complete server-native automation parity-- `workflows` add server-native workflow graph--**Fixed**--- `responsive` reflow feature panes-- `workflows` separate runtime input from graph secret guards-- `workflows` allow inbound webhook trigger boundary-- `workflows` honor responsive shell modal policy-- `workflows` compact graph mcp surface-- `workflows` complete cli and release gates-- `mcp` expose downstream project tool results (#43)--**Tests**--- `mcp` register organization parity boundaries-- `cli` include organization command module in route coverage--## 2026-09-14--**Added**--- `integrations` simplify UI and secure credential exports-- `mcp` add original-byte file transfer--**Fixed**--- `shell` place server status in native chrome-- `integrations` use contrast-safe action tokens-- `integrations` inherit shell design tokens-- `integrations` align layout with Settings sidebar-- `mcp` harden bidirectional file transfer-- `mcp` bind ChatGPT Azure file trust to OAuth provenance-- `mcp` make project plugins explicit opt-in installs-- `mcp` trust verified ChatGPT Azure file host-- `integrations` preserve strict SC bundle validation-- `integrations` make shell embed frameable-- `integrations` add shell app and detect SC worktrees-- `integrations` expose native shell and managed SC project bindings-- `mcp` fall back when project MCP discover returns -32601--**Changed**--- `integrations` source compact width from responsive SSOT--## 2026-09-12--**Added**--- `mcp` unify responsive previews and recover session storage-- `mcp` add project automation flows and dynamic MCP sessions--**Fixed**--- `update` report latest builds without systemd-- `ui` theme native scrollbars across the MSO shell-- `ui` fill MCP Page height and apply MSO branding-- `flows` enforce canonical paths and bounded waits--**Tests**--- `ui` constrain simulated host message origins--**Docs**--- `mcp` add README quickstart and practical how-to-- `progress` record native scrollbar verification--## 2026-09-11--**Added**--- `install` enable MCP exec + document stable Cloudflare tunnel defaults--**Fixed**--- `ci` resolve synthetic history findings and await exact CodeQL evidence--**Tests**--- `forge` use node fixture commands under Bun runner--**Docs**--- `termux` add one-pass Android installer-- `security` document fresh-install MCP exec exposure--## 2026-09-10--**Added**--- `mcp` expose complete ChatGPT tool surface--## 2026-09-09--**Added**--- `integrations` unify semantic credential management-- add bounded Dokploy Dockerfile build operation-- `mcp` add session cards, readable logs and handover guide-- split MCP access and add plugin registry--**Fixed**--- `mcp` keep ChatGPT Page iframe-free-- `mcp` make Page surface registry instance-dynamic-- `update` harden release verification and settings UX-- `auth` harden browser session persistence-- `integrations` synchronize owner-local SC credential snapshots-- `security` eliminate parser gaps and enforce strict SAST coverage-- `gateway` wait for launcher handoff before tracking tunnel identity-- `build` separate runtime inputs and clarify mobile MCP guides-- `a11y` label settings controls and expose selected options-- `settings` clarify MCP navigation and enforce zero-warning tests-- persist the ready tunnel process identity after launcher exec-- reject login redirects normalized into external destinations-- isolate legacy browser credentials and close scanner findings-- keep the session mode badge clear of mobile navigation-- harden audited execution, integrations and release journeys--**Faster**--- `mcp` bound active session refresh to live leases--**Changed**--- `gateway` keep provisional readiness with pending lifecycle--**Tests**--- `pty` wait for terminal output to drain after exit-- remove obsolete preview directory configuration-- validate the bundle fixture before checking tag rejection-- stabilize authenticated release journeys and retain build failure logs-- distinguish desktop dock launch from icon selection-- target accessible launchers and clarify delegated sign-in--**Docs**--- record extended production browser verification-- record audit remediation verification and limits--## 2026-09-08--**Added**--- `desktop` give Finder, Explorer and Settings native platform layouts--**Fixed**--- `portability` allow configured auth query-- `portability` derive instance MCP context-- `integrations` verify self-hosted Convex admin keys--**Chores**--- standardize bun 1.4.2--## 2026-09-07--**Added**--- `integrations` share a responsive connection workbench-- `mcp` bind modular project tools to private integrations-- `infra` ensure Dokploy GitHub applications--**Fixed**--- `infra` allow Baton build SHA metadata--## 2026-09-06--**Added**--- `infra` add bounded Dokploy application deploy-- `infra` separate DOKU payment and MCP credentials-- `infra` add private DOKU MCP connections-- `infra` add private Convex env presence checks-- `infra` add safe Dokploy deployment recovery-- `infra` manage Convex Cloud custom domains safely-- `infra` add bounded Dokploy public env rollout--**Fixed**--- `infra` allow bounded Dokploy public env values-- `mcp` preserve compact integration headroom-- `infra` expose bounded Dokploy integration operations-- `infra` support modern pinned DNS lookups--## 2026-09-05--**Added**--- `integrations` detect local SI-Coder migration-- `agent` add native integrations slash skill-- `integrations` polish Finder TUI frame and UX-- `integrations` use Finder-style column browser-- `integrations` add interactive terminal navigator-- `hostinger` add Mail API connection operations-- `integrations` add portable JSON transfer and standalone import adapter-- `integrations` unify native users connections and source-aware execution-- `artifacts` add private per-session screenshot storage and retention-- `integrations` add native secure credential setup in browser and MCP Page-- add safe local maintenance and visual README-- `mcp` preserve restricted project service bridge--**Fixed**--- `security` enforce actual branch code-scanning alerts-- `security` make import preview confirmations opaque-- `security` key portable import preview confirmations-- `mcp` render one bounded inline Page preview-- preserve home-relative stores and prove tunnel rollback completion-- `security` verify exact branch dispositions and narrow message origins-- `security` retain artifact-lock compatibility and require fresh scan evidence-- `security` pin store paths and eliminate unsafe file-read patterns-- `mcp` add explicit browser sign-in for reviewed embedded apps-- `security` gate on actual GitHub open findings-- `integrations` repair embedded setup and complete native provider catalog-- `integrations` recover setup UI and cached chat links-- `release` wait for HTTP readiness before validating served assets-- `mcp` initialize page previews and verify embedded app readiness-- reconcile maintenance handoff and CLI version contracts-- `security` close exec expansion gap and exact test discovery-- `security` harden share audit and release verification-- `update` handle diverged checkout explicitly--**Changed**--- remove unused symbols and enforce compiler checks--**Tests**--- make insecure-permission fixture explicit under private umask-- validate PR integration and maintenance safety boundaries--**Docs**--- show the interactive mso terminal in README-- restore inline demo and lead with agent capabilities-- `mcp` document service tokens and update reconciliation--**Chores**--- `security` expose sanitized alert annotations-- release security and visual documentation fixes as app 0.2.4--## 2026-09-04--**Added**--- `mcp` simplify ChatGPT UI to Block and Page-- `assistant` turn Alfa into MSO cockpit--**Fixed**--- `mcp` align widgets with rahmanef palette-- `release` bound local dependency audit--**Changed**--- `mcp` dedupe ChatGPT CSP metadata--## 2026-09-03--**Added**--- `mcp` embed Play Together securely-- `mcp` add secure ChatGPT MSO Surface-- `agent` add P10 memory lifecycle calibration-- `mcp` complete Fresh 3 plugin contracts-- `mcp` maximize Fresh 3 operator capabilities-- `mcp` harden ChatGPT profile and project bridge--**Fixed**--- `mcp` correct Fresh 3 Surface scope-- `mcp` open contextual MSO views-- `runtime` prevent live Next build corruption-- `mcp` harden Open in MSO navigation-- `agent` calibrate correction memory semantics-- `agent` compare normalized token proofs per row-- `mcp` advertise implemented protocol era-- `mcp` support trusted browser probes-- `oauth` issue distinct dynamic client ids-- `mcp` make read pipeline schema portable--**Faster**--- `agent` add P8 calibration harness-- `agent` add repeatable corpus runner-- `agent` expand objective repo corpus--**Changed**--- `mcp` unify ChatGPT Surface UI--**Tests**--- `agent` calibrate local semantic memory retrieval-- separate corpus accounting ownership-- keep Fresh 3 within architecture ratchets-- `gateway` await complete browser argv capture--**Docs**--- bound Cognitive Runtime claims to verified evidence-- refresh maintainability changelog-- `agent` record P9 memory calibration-- `agent` record P8 calibration baseline-- `agent` record P7 repeated corpus baseline--## 2026-09-02--**Added**--- `mcp` add two-way local agent receive-- `mcp` add read-only result pipeline-- add RASMIC orchestration memory automation-- `agent` section terminal and recover API errors-- `agent` name sessions and wrap composer-- `agent` correlate local replies and add subagents-- `agent` add native local session messaging-- `agent` add restart and new session-- `a2a` enable local and inbound defaults-- ship authenticated and local A2A-- `agent` add eval-gated tool forge-- `agent` add interactive permissions and a2a v1--**Fixed**--- make modular shell ownership explicit-- `agent` wake on local requests-- `cli` clear ShellCheck warnings-- `agent` require live receiver for mentions-- `agent` make restart process-safe-- `a2a` harden remote v1 delegation--**Faster**--- `agent` normalize provider usage semantics-- `agent` add comparable quality corpus-- `agent` route capabilities before model reasoning--**Changed**--- split installer phases and lock release lifecycle-- split CLI into bounded command modules-- separate shared client server contracts-- segment host capability facades-- separate workflow and memory ownership-- enforce one-way shell dependencies-- extract capability kernel and architecture ratchets--**Tests**--- lock security coverage for new boundaries-- follow modular onboarding owner-- follow RASMIC storage split--**Docs**--- generate MCP catalog and lock architecture ownership-- reconcile RASMIC with latest agent docs-- publish catalog-first RASMIC runtime-- publish RASMIC MCP contract-- `testing` record 1.12 live verification--**Chores**--- `agent` sync docs and trim internal exports--**Other**--- cover maintainability architecture boundaries-- pin ZAP Docker Hub mirror-- cover RASMIC orchestration--## 2026-09-01--**Added**--- `agent` ship cognitive runtime p1-- `agent` humanize sessions and add yolo mode-- `mcp` ship cognitive runtime p0-- `agent` add interrupt-safe terminal controls-- `agent` add arrow picker and skill states-- `agent` align model and session terminal UX-- `install` make upgrades agent-friendly-- `agent` add interactive slash palette-- `agent` add project-aware slash skills-- `agent` persist terminal and MCP sessions-- `mcp` render live workflow progress in ChatGPT-- `cli` add MSO folder ASCII icon--**Fixed**--- `agent` resolve resumes across full session store-- `mcp` remove session lookup contention-- `agent` wake prompt after child tty sigint-- `cli` clarify version and update labels-- `agent` stabilize terminal banner navigation-- `cli` make updates visible and idempotent-- `9router` proxy over internal Docker network-- `mcp` preserve app-only workflow status schema--## 2026-08-31--**Added**--- `cli` add MSO agent and infrastructure providers-- `mcp` add guided client setup--**Fixed**--- `update` wait through systemd restart drain-- `cli` diagnose HTTPS login and add doctor --fix-- `mcp` validate browser origins-- `security` avoid recovery guard fsync convoy-- `runtime` verify service readiness before handoff-- `jobs` finish retention before releasing runtime-- `runtime` preserve fallback recovery readiness-- `runtime` keep service starts on shared exclusion-- `service` bound lifecycle exclusion wait-- `settings` hide premature update warning-- `update` enforce main and raise MCP daily limit-- `mcp` raise daily token call limit-- `gateway` canonicalize public origin assignment-- `git` restore executable script modes-- `runtime` close service installer and notice races-- `install` hold update lock across checkout refresh-- `install` restore service after pre-mutation abort--**Tests**--- `security` remove recovery marker TOCTOU-- `gateway` assert one live tunnel after concurrent start-- `install` read abort capture by descriptor-- `install` align bootstrap and abort harness-- `install` make abort recovery harness static--**Docs**--- `mcp` mark guided setup shipped--**Chores**--- `deps` bump aquasecurity/trivy-action (#32)-- `deps` bump actions/checkout from 6.1.0 to 7.0.1 (#31)-- `deps-dev` bump @types/react-dom (#29)--## 2026-08-30--**Added**--- `gateway` secure laptop public access lifecycle-- `gateway` add loopback-only public web gateway--**Fixed**--- `runtime` close update authority and stop races-- `runtime` preserve installer and env lifecycles-- `runtime` serialize deploy and service starts-- `gateway` recheck web state under lock-- `update` reject unowned live runtimes-- `runtime` verify live update identities-- `runtime` close final update web edges-- `update` emit success after runtime restore-- `update` serialize all checkout runtimes-- `gateway` reject active named tunnel switches-- `gateway` serialize runtime recovery and updates-- `gateway` close final lifecycle boundaries-- `gateway` close tunnel fork signal race-- `gateway` serialize offline recovery state-- `gateway` harden update and proxy edges-- `gateway` close lifecycle review gaps-- `security` harden gateway scanner fixtures-- `install` survive Bun bin metadata corruption-- `install` keep bootstrap guard shellcheck-clean-- `install` guard earliest bootstrap prefix-- `install` make bootstrap handoff truncation-safe-- `install` make one-line bootstrap atomic-- `install` bind readiness to runtime instance-- `install` preserve caller path semantics-- `install` prove stable-id service takeover-- `install` keep security hint literal-- `install` make WSL CLI setup reliable-- `security` harden GitHub quality controls-- `security` canonicalize writable path containment--**Tests**--- `gateway` treat zombie children as stopped-- `gateway` isolate lifecycle fixtures-- `cli` lock offline update dispatch-- `gateway` harden hosted security fixtures--**Docs**--- `security` disclose scorecard posture gaps--## 2026-08-29--**Fixed**--- `security` keep path sinks in validated branches-- `security` make root containment explicit-- `security` close follow-up CodeQL flows--**Docs**--- `comparison` use explicit SEO-friendly ratings--**Chores**--- `deps` hold incompatible toolchain majors-- `deps` migrate to lucide-react 1.33.0--## 2026-08-28--**Added**--- `operations` add evidence-backed comparison and delegated control-- `mcp` add bounded async exec jobs--**Fixed**--- `security` remediate hosted CodeQL findings-- `security` remediate ultimate assurance findings-- `security` resolve full assurance findings-- `security` raise complete component scan budget-- `security` keep Codex scan state private-- `security` block recursive credential relocation--**Chores**--- `deps` bump actions/setup-python from 6.3.0 to 7.0.0-- `deps` bump zaproxy/action-baseline-- `deps` bump actions/setup-node from 6.5.0 to 7.0.0-- `deps` bump actions/upload-artifact from 4.6.2 to 7.0.1-- `deps` bump ossf/scorecard-action in the actions-minor-patch group-- `deps-dev` bump the development-minor-patch group with 4 updates-- `deps` bump the production-minor-patch group with 4 updates-- `security` update Codex Security to 0.1.21--## 2026-08-26--**Added**--- `mcp` add reverse-engineering implementation playbook--**Fixed**--- `security` split documentation scan scope-- `security` bound Codex component scope-- `security` use complete Codex component scans-- `security` size Codex budget for full scan--**Docs**--- refresh changelog--**Chores**--- `security` add ultimate assurance suite-- `security` add Codex Security scanning--## 2026-08-24--**Added**--- `managed-apps` add 9Router as a one-click managed app--**Fixed**--- `managed-apps` embed 9router existing domain-- `managed-apps` make 9router public-ip first-- harden security state and credential guards--## 2026-08-23--**Added**--- add interactive onboarding and skill market-- complete terminal and mobile app surfaces--**Fixed**--- `android` clear notch in app drawer-- `mobile` stabilize widgets back and viewport--**Changed**--- `ui` separate shell design systems--**Docs**--- refresh architecture and ChatGPT MCP guide--## 2026-08-22--**Fixed**--- `settings` adopt native iOS hierarchy-- `icons` align mobile platform artwork-- `responsive` harden mobile and landscape layouts-- `git` isolate push-gate test repositories-- `settings` improve MCP UI and activity scrolling--## 2026-08-21--**Added**--- `projects` add opt-in function capabilities--## 2026-08-20--**Added**--- `mcp` global project/skill discovery, drop image generation-- `mcp` import ChatGPT generated files-- `mcp` add provider-backed image generation--**Fixed**--- `mcp` lossless scan continuation and exact-id project resolution-- `mcp` one project validator, dirent budgets, resumable caps-- `mcp` contain, bound and uniquely identify project discovery-- `mcp` make ChatGPT file imports region agnostic-- `mcp` allow ChatGPT India South Central file storage-- `mcp` allow ChatGPT New Zealand file storage-- `mcp` allow ChatGPT Australia file storage-- `mcp` allow ChatGPT regional file storage-- `mcp` report rejected file host safely--## 2026-08-19--**Added**--- enable image generation and full access defaults-- `mcp` isolate workflows and standardize skill flows-- `mcp` streamline bootstrap and workflow visibility-- add semantic skill memory and workflow recipes-- add secure temporary screenshot links-- add MCP screenshots and live activity--**Fixed**--- `oauth` force visible ChatGPT callback-- `icons` use native macOS and Windows artwork-- `update` remove passwordless sudo requirement-- use official agent logos--## 2026-08-18--**Added**--- finish native platform icon set-- harden skills and refresh platform icons--**Fixed**--- use transparent feature icon artwork--## 2026-08-17--**Added**--- `settings` render the changelog as records in a scroll area, not injected markdown-- `update` a Check again row, so a release that lands while the panel is open is visible-- `files` long-press opens the context menu, so Preview is reachable on a phone-- `update` tell the running build from the checkout, so a pending rebuild is visible-- `settings,preview` update MSO from the app, and preview the formats a real disk has--**Fixed**--- `security` shell rc files hold API tokens — the credential denylist now says so-- `changelog` a regeneration commit must not appear in the file it regenerates-- `deps` pin nanoid >=3.3.18 — the audit gate has been failing on main-- `managed-apps` say why a dashboard is missing instead of silently opening a terminal-- `install` write the uid out — %U resolves to 0 for a User=<name> system unit-- `managed-apps` fail closed on an unreadable bus, and stop a retry eating the live venv-- `managed-apps` one-click install died, and installed apps read as "not installed", under systemd-- `install` bind loopback by default, and restart the service on re-run--**Changed**--- one download helper, one path helper, and gates for the drifts they hid--**Tests**--- `e2e` a committed browser check for Preview and the update panel-- `preview` one anchor the e2e can read on both surfaces--**Docs**--- `progress` record the codebase audit — what was duplicated, drifted, undefended-- record external MCP consumer compatibility-- `readme` the update button, and what Preview actually opens-- plain http to an IP cannot complete a login — say so where it matters--## 2026-08-11--**Added**--- `ship` one command that changelogs, pushes, rebuilds and verifies-- `shells` Windows/iOS/Android to their 2026 specs, plus a backup for local state--**Fixed**--- `ship` amend on retry, and collapse a repeated subject in the changelog-- `ai` Codex DOES do tool calling — implement it instead of announcing it cannot-- `pwa,chat` notch clearance, a doubled iOS inset, and an assistant that was lying--**Tests**--- `e2e` a browser that actually loads the page — and the three bugs it found--**Docs**--- `progress` log the shell-spec pass, the springs, and the backup--## 2026-08-10--**Added**--- give Alfa the reach MCP has, and a gate so they cannot drift apart again-- `mcp` managed-app logs and lifecycle, tiered by blast radius not by layer-- `mcp` an MCP server so ChatGPT, Claude.ai or Cursor can drive this VPS--**Fixed**--- `cli` four missing verbs, a prod-breaking build, and a silently-wrong --base-- close the four cheap findings from the tool-surface parity audit-- `mcp` the audit trail was recording refused commands as successes-- `audit` stop a test run appending to the owner's forensic trail-- `mcp` record what an MCP token did — the trail it was bypassing-- `a11y,perf` name the dock icons, announce login errors, stop the resize storm-- `perf,ux` halve the boot API calls, unstick the dead chunk spinner, cut 9 orphans--**Faster**--- get the shell chrome and the Alfa catalog out of first load--**Changed**--- delete five retired subsystems nothing could reach--**Docs**--- `progress` log the three-surface parity audit and what it fixed-- `progress` log the MCP server and what was verified live-- cut five finished plans, trim PROGRESS's tail, log the audit follow-up--## 2026-08-04--**Fixed**--- `hydration` render the shell after mount — zero mismatches anywhere-- `hydration` kill 3 of 4 React #418 sources; mobile contrast + back labels-- `css` un-break every border-color utility, and make Android's Back visible--## 2026-08-03+## 2026-10-17**Added**-- `ci` real dependency + build gates, and fix the sharp CVE they caught-- migrate pnpm -> bun, and fix what the audit actually found-- `shell` Docs app, a state-aware dock, and quicklinks back to the owner-- `cli` print a paste-ready command under every device-- `cli` complete API coverage, doctor, completion, global options-- `cli` device pending + revoke all, per-command help, version-- `cli` add `mso` CLI + agent skills so the web UI is one frontend, not the product--**Fixed**--- `a11y` raise 4 mobile touch targets to the WCAG 24x24 floor-- `security` close 3 of 4 rm -rf bypasses, and stop a corrupt file wiping the device allowlist-- `cli` name the near-miss flag, and report what's left after a revoke-- `cli` make `device` a subcommand group and say what an unknown command was--**Faster**+- `models` discover model ids from custom endpoints-- keep the OS shell out of every route, stop sleeping on every stats poll--**Changed**--- delete 836 net lines of metadata and dead exports nothing reads-- `quicklinks` owner's links become owner's data, repo keeps a neutral fallback-- rename os-vps -> mso across code, config and prod wiring--**Docs**--- reconcile every live doc against what the box actually does-- `progress` record the 2026-08-03 bun migration, audit and gate work--**Chores**--- drop the one-shot contrast tuner nothing invokes--## 2026-08-02+## 2026-10-15**Other**-- Initial commit+- Merge pull request #121 from rahmanef63/dependabot/bun/development-minor-patch-fd1384ab1ediff --git a/docs/MODELS-INTEGRATION.md b/docs/MODELS-INTEGRATION.mdindex 1089f8f9..84d47f89 100644--- a/docs/MODELS-INTEGRATION.md+++ b/docs/MODELS-INTEGRATION.md@@ -47,6 +47,29 @@ Likewise, an Anthropic/OpenRouter/etc API key is unrelated to MSO's own OAuth seA custom endpoint stores its provider metadata in the host config and routes through thesame streaming abstraction after URL/protocol validation.+### Discovering a custom endpoint's models++Instead of making the owner guess model ids, MSO can ask a custom endpoint which ids it+serves and offer them as choices — the same idea as OpenCode's built-in discovery for known+runtimes. It is explicit, never silent: the owner triggers it, reviews the list, and the+models text field stays the source of truth for what is saved.++- **Settings → AI → Add custom provider** has a **Discover models** button that POSTs+ `{baseURL, apiKey, protocol}` to `POST /api/models/discover`; the returned ids render as+ toggle chips that edit the models field (`toggleModelInList`). Discovery only fills the+ field in — it never saves on its own.+- **`mso models add <name> --base-url … --api-key …`** with no `--models` queries the same+ route, confirms interactively (or auto-fills in scripts), and falls back to manual ids+ when discovery fails. The key reaches the server over stdin via `secret_post`, never argv.+- A **saved** custom provider is re-discoverable with `{provider}` (its key comes from the+ host credential store), and `GET /api/models?provider=<slug>` now returns its stored ids so+ the Browse drawer is never empty.++Discovery calls the endpoint's own list API — OpenAI-compatible `GET {baseUrl}/models` with+`Authorization: Bearer`, Anthropic `GET {baseUrl}/v1/models` with `x-api-key` ++`anthropic-version`. It is owner-only, SSRF-pinned through `safeProviderFetch`, bounded in+size and time, and the key is never returned, logged, or echoed back.+## 4. OpenAI Codex / ChatGPT subscription provider`openai-codex` is a distinct optional Alfa provider. It uses the ChatGPT consumer@@ -90,6 +113,8 @@ provider. Host mutation approval and filesystem boundaries remain separate MSO c- `lib/config/store.ts` — credential/provider persistence- `app/api/config/route.ts` — Settings configuration API- `app/api/models/route.ts`, `app/api/models/test/route.ts` — catalog/test surfaces+- `lib/models/discover.js` — endpoint model-discovery helpers (list URL, auth headers, bounded parse)+- `app/api/models/discover/route.ts` — `POST /api/models/discover` (owner-only, SSRF-pinned)- `app/api/assistant/route.ts` — common assistant gateway- `lib/ai/openai-stream.ts` — OpenAI-compatible streaming- `lib/ai/codex-stream.ts` — ChatGPT Codex Responses streamingdiff --git a/docs/PROGRESS.md b/docs/PROGRESS.mdindex eab3c780..3cb2c10d 100644--- a/docs/PROGRESS.md+++ b/docs/PROGRESS.md@@ -1,3 +1,11 @@+## 2026-10-17: Let a custom provider discover the models it actually serves++Adding a custom OpenAI/Anthropic-compatible endpoint meant typing model ids by hand; leave the list empty and the picker for that provider had nothing to show, because models.dev has no entry for a self-hosted slug. MSO can now ask the endpoint which ids it serves, the way OpenCode already does for known runtimes.++Discovery is explicit and owner-gated, never silent. `POST /api/models/discover` accepts either an unsaved `{baseURL, apiKey, protocol}` while the provider is being added, or a saved `{provider}` whose key is read from the host credential store, and answers `{ok, count, models:[{id,name}]}` — the key is never returned or logged. It calls the endpoint's own list API (OpenAI-compatible `GET {base}/models`, Anthropic `GET {base}/v1/models`) through the SSRF-pinned `safeProviderFetch`, with a size and time bound, mirroring the existing connection test.++In Settings → AI the new **Discover models** button renders the ids as toggle chips that write into the models field; the field stays authoritative, so discovery only fills in what the owner then saves. `mso models add <name> --base-url … --api-key …` with no `--models` queries the same route (the key travels over stdin via `secret_post`, never argv), confirms interactively or auto-fills in scripts, and falls back to manual ids on failure. `GET /api/models?provider=<custom-slug>` now returns a saved custom provider's stored ids instead of an empty catalog, so its Browse drawer is no longer blank.+## 2026-10-15: Let a cached OAuth client id authorize again, and unbreak the Semgrep gateThe consent page rejected every `client_id` it had not minted itself with "This client must register before requesting authorization", but ChatGPT's user-defined connector caches a self-declared id and never calls `/oauth/register` — so that client could never authorize. The rejection also added no security, because `/oauth/register` is already a public endpoint that mints a client for any https callback; the only thing it broke was clients whose registration had been swept (the store deletes unreferenced clients an hour after creation). An unknown but well-formed public id is now registered on demand at `/oauth/authorize` for its exact callback, and again inside the approval action so a swept registration cannot dead-end the click. The registration is server-side and inert until the owner approves and completes PKCE; server-owned MSO principals (`manual:`, `pat:`, `mso_`) and malformed ids still fail closed, and an existing client only ever has redirect targets unioned, never replaced. Client lifecycle moved to `lib/mcp/store-clients.ts` so both files stay inside the 220-line architecture ratchet.diff --git a/frontend/slices/os-settings/components/custom-provider-config.test.ts b/frontend/slices/os-settings/components/custom-provider-config.test.tsindex fe43834a..d4ea5d88 100644--- a/frontend/slices/os-settings/components/custom-provider-config.test.ts+++ b/frontend/slices/os-settings/components/custom-provider-config.test.ts@@ -1,5 +1,5 @@import { describe, it, expect } from "vitest";-import { parseCustomProviderConfig, parseModelList } from "./custom-provider-config";+import { parseCustomProviderConfig, parseModelList, toggleModelInList } from "./custom-provider-config";describe("parseCustomProviderConfig", () => {it("parses field aliases + a delimited models string", () => {@@ -17,4 +17,12 @@ describe("parseCustomProviderConfig", () => {it("parseModelList splits comma + newline and trims blanks", () => {expect(parseModelList("a, b\n c ,")).toEqual(["a", "b", "c"]);});++ it("toggleModelInList adds then removes a discovered id", () => {+ expect(toggleModelInList("", "gpt-oss")).toBe("gpt-oss");+ expect(toggleModelInList("a", "gpt-oss")).toBe("a, gpt-oss");+ expect(toggleModelInList("a, gpt-oss, b", "gpt-oss")).toBe("a, b");+ expect(toggleModelInList("a, b", "a")).toBe("b");+ expect(toggleModelInList("a", " ")).toBe("a");+ });});diff --git a/frontend/slices/os-settings/components/custom-provider-config.ts b/frontend/slices/os-settings/components/custom-provider-config.tsindex 61a836d9..2e4dfeba 100644--- a/frontend/slices/os-settings/components/custom-provider-config.ts+++ b/frontend/slices/os-settings/components/custom-provider-config.ts@@ -7,6 +7,16 @@ export type CustomConfig = { name: string; baseURL: string; apiKey: string; protexport const parseModelList = (s: string): string[] => s.split(/[\n,]/).map((m) => m.trim()).filter(Boolean);+/** Toggle one discovered id in a delimited model list, keeping the text field the+ * single source of truth. Returns the new list string (comma-space joined). */+export function toggleModelInList(current: string, id: string): string {+ const target = id.trim();+ if (!target) return current;+ const ids = parseModelList(current);+ const next = ids.includes(target) ? ids.filter((m) => m !== target) : [...ids, target];+ return next.join(", ");+}+export function parseCustomProviderConfig(json: string): CustomConfig {const o = JSON.parse(json);const name = o.name ?? o.slug,diff --git a/frontend/slices/os-settings/components/custom-provider-form.tsx b/frontend/slices/os-settings/components/custom-provider-form.tsxindex 4779d5bc..4a86a794 100644--- a/frontend/slices/os-settings/components/custom-provider-form.tsx+++ b/frontend/slices/os-settings/components/custom-provider-form.tsx@@ -6,11 +6,16 @@ import { Input } from "@/components/ui/input";import { Textarea } from "@/components/ui/textarea";import { Button } from "@/components/ui/button";import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";-import { parseCustomProviderConfig, parseModelList } from "./custom-provider-config";+import { parseCustomProviderConfig, parseModelList, toggleModelInList } from "./custom-provider-config";++type DiscoveredModel = { id: string; name: string };// Add a custom OpenAI-compatible / Anthropic-Messages provider. Two input modes:// • fields — name / protocol / baseURL / key (+ optional comma/newline models)// • JSON — paste {name, baseURL, apiKey, protocol, models[]} whole+// "Discover models" asks the endpoint's own list API (POST /api/models/discover,+// SSRF-pinned, key sent only to that host) so the owner can pick ids instead of+// guessing them; discovered ids are toggled as chips into the models field.// POSTs { customProvider } to /api/config (SSRF-checked, slug-reserved server-side);// the added provider is selected immediately. onAdded refreshes the parent.export function CustomProviderForm({ onAdded }: { onAdded: () => void }) {@@ -22,6 +27,35 @@ export function CustomProviderForm({ onAdded }: { onAdded: () => void }) {const [models, setModels] = useState("");const [json, setJson] = useState("");const [busy, setBusy] = useState(false);+ const [found, setFound] = useState<DiscoveredModel[]>([]);+ const [scanning, setScanning] = useState(false);++ async function discover() {+ setScanning(true);+ try {+ const r = await fetch("/api/models/discover", {+ method: "POST",+ headers: { "content-type": "application/json" },+ body: JSON.stringify({ baseURL, apiKey: key, protocol }),+ });+ const d = (await r.json().catch(() => ({}))) as { ok?: boolean; count?: number; models?: DiscoveredModel[]; error?: string };+ if (!r.ok) {+ toast(d.error || "Couldn't reach that endpoint", { tone: "error" });+ return;+ }+ if (!d.ok || !d.models?.length) {+ setFound([]);+ toast(d.error || "No models found at that endpoint", { tone: "error" });+ return;+ }+ setFound(d.models);+ toast(`Discovered ${d.models.length} model${d.models.length === 1 ? "" : "s"} — tap to add`);+ } catch (e) {+ toast((e as Error).message || "Discovery failed", { tone: "error" });+ } finally {+ setScanning(false);+ }+ }async function submit() {setBusy(true);@@ -40,7 +74,7 @@ export function CustomProviderForm({ onAdded }: { onAdded: () => void }) {toast(d.error || "Couldn’t add provider", { tone: "error" });return;}- setName(""); setBaseURL(""); setKey(""); setModels(""); setJson("");+ setName(""); setBaseURL(""); setKey(""); setModels(""); setJson(""); setFound([]);toast(`Added ${d.slug ?? "provider"}`);onAdded();} catch (e) {@@ -80,7 +114,30 @@ export function CustomProviderForm({ onAdded }: { onAdded: () => void }) {</div><Input disabled={busy} placeholder="https://host/v1" value={baseURL} onChange={(e) => setBaseURL(e.target.value)} /><Input disabled={busy} type="password" placeholder="API key" value={key} onChange={(e) => setKey(e.target.value)} />- <Input disabled={busy} placeholder="models (optional) — comma/newline, e.g. minimax-m3, gpt-4o" value={models} onChange={(e) => setModels(e.target.value)} />+ <div className="flex items-center gap-2">+ <Input disabled={busy} placeholder="models (optional) — comma/newline, e.g. minimax-m3, gpt-4o" value={models} onChange={(e) => setModels(e.target.value)} className="flex-1" />+ <Button type="button" variant="outline" size="sm" className="[@media(pointer:coarse)]:min-h-[44px]" disabled={busy || scanning || !baseURL || !key} onClick={discover}>+ {scanning ? "Discovering…" : "Discover models"}+ </Button>+ </div>+ {found.length > 0 && (+ <div className="flex flex-wrap gap-1.5">+ {found.map((m) => {+ const on = parseModelList(models).includes(m.id);+ return (+ <button+ key={m.id}+ type="button"+ title={m.name}+ onClick={() => setModels((prev) => toggleModelInList(prev, m.id))}+ className={`rounded-md border px-2 py-1 font-mono text-xs [@media(pointer:coarse)]:min-h-[44px] ${on ? "border-primary bg-primary/10 text-primary" : "border-border text-muted-foreground"}`}+ >+ {m.id}+ </button>+ );+ })}+ </div>+ )}</div>) : (<Textareadiff --git a/lib/models/discover.js b/lib/models/discover.jsnew file mode 100644index 00000000..15cf0416--- /dev/null+++ b/lib/models/discover.js@@ -0,0 +1,106 @@+// Discover which models a custom endpoint actually serves.+// The owner knows a base URL and an API key but not the model ids; this asks the+// endpoint's own list API so the picker is never empty. Runtime-only, bounded, and+// credential-safe: the key is sent to the endpoint's pinned host, never returned,+// logged, or placed on a process argv.++const MAX_MODELS = 500+const MAX_BODY_BYTES = 2 * 1024 * 1024++/** List endpoint for a protocol. Anthropic keys live under /v1/models; an+ * OpenAI-compatible base already carries its own version segment. */+export function modelsEndpoint(baseUrl, protocol) {+ const base = String(baseUrl || '').replace(/\/+$/, '')+ if (protocol === 'anthropic') return /\/v\d+$/.test(base) ? `${base}/models` : `${base}/v1/models`+ return `${base}/models`+}++export function modelDiscoveryHeaders(protocol, apiKey) {+ if (protocol === 'anthropic') {+ return { accept: 'application/json', 'x-api-key': apiKey, 'anthropic-version': '2023-06-01' }+ }+ return { accept: 'application/json', authorization: `Bearer ${apiKey}` }+}++function collect(value, out) {+ if (typeof value === 'string') {+ const id = value.trim()+ if (id) out.set(id, id)+ return+ }+ if (Array.isArray(value)) {+ for (const row of value) collect(row, out)+ return+ }+ if (!value || typeof value !== 'object') return+ const id = value.id ?? value.name ?? value.model+ if (typeof id === 'string' && id.trim()) {+ const named = typeof value.name === 'string' && value.name.trim() ? value.name.trim() : id.trim()+ out.set(id.trim(), named)+ }+}++/** Tolerant parse of the common list shapes: `{data:[{id}]}`, `{models:[…]}`,+ * `{result:[…]}`, or a bare array of ids/objects. Deduped, sorted, bounded. */+export function parseDiscoveredModels(payload) {+ const out = new Map()+ if (Array.isArray(payload)) collect(payload, out)+ else if (payload && typeof payload === 'object') {+ for (const key of ['data', 'models', 'result']) if (key in payload) { collect(payload[key], out); break }+ }+ return [...out.entries()]+ .map(([id, name]) => ({ id, name }))+ .sort((a, b) => a.id.localeCompare(b.id))+ .slice(0, MAX_MODELS)+}++async function readBounded(response) {+ const declared = Number(response.headers.get('content-length') || 0)+ if (declared > MAX_BODY_BYTES) throw new Error('model list response exceeds size limit')+ if (!response.body) return ''+ const reader = response.body.getReader()+ const chunks = []+ let bytes = 0+ try {+ for (;;) {+ const { done, value } = await reader.read()+ if (done) break+ bytes += value.byteLength+ if (bytes > MAX_BODY_BYTES) {+ await reader.cancel('model list response exceeded size limit').catch(() => {})+ throw new Error('model list response exceeds size limit')+ }+ chunks.push(value)+ }+ } finally {+ reader.releaseLock()+ }+ return Buffer.concat(chunks.map((chunk) => Buffer.from(chunk)), bytes).toString('utf8')+}++/**+ * @param {{baseUrl:string, apiKey:string, protocol?:'openai'|'anthropic'}} conn+ * @param {{fetchImpl?:typeof fetch, timeoutMs?:number}} [options]+ * @returns {Promise<{id:string, name:string}[]>}+ */+export async function discoverEndpointModels({ baseUrl, apiKey, protocol = 'openai' }, { fetchImpl = fetch, timeoutMs = 15000 } = {}) {+ const signal = AbortSignal.timeout(timeoutMs)+ const response = await fetchImpl(modelsEndpoint(baseUrl, protocol), {+ method: 'GET',+ headers: modelDiscoveryHeaders(protocol, apiKey),+ redirect: 'error',+ signal,+ })+ if (!response.ok) {+ const detail = await readBounded(response).catch(() => '')+ throw new Error(`model discovery HTTP ${response.status}${detail ? `: ${detail.slice(0, 140)}` : ''}`)+ }+ const text = await readBounded(response)+ let payload+ try {+ payload = JSON.parse(text)+ } catch {+ throw new Error('model discovery returned invalid JSON')+ }+ return parseDiscoveredModels(payload)+}diff --git a/lib/models/discover.test.ts b/lib/models/discover.test.tsnew file mode 100644index 00000000..742f749d--- /dev/null+++ b/lib/models/discover.test.ts@@ -0,0 +1,75 @@+import { describe, expect, it, vi } from "vitest";+import {+ discoverEndpointModels,+ modelDiscoveryHeaders,+ modelsEndpoint,+ parseDiscoveredModels,+} from "./discover.js";++describe("endpoint model discovery", () => {+ it("builds the list URL per protocol and avoids a doubled /v1", () => {+ expect(modelsEndpoint("https://gateway.example/v1", "openai")).toBe("https://gateway.example/v1/models");+ expect(modelsEndpoint("https://gateway.example/v1/", "openai")).toBe("https://gateway.example/v1/models");+ expect(modelsEndpoint("https://api.anthropic.com", "anthropic")).toBe("https://api.anthropic.com/v1/models");+ expect(modelsEndpoint("https://proxy.example/v1", "anthropic")).toBe("https://proxy.example/v1/models");+ });++ it("sends each protocol's native auth header", () => {+ expect(modelDiscoveryHeaders("openai", "sk-secret")).toEqual({+ accept: "application/json",+ authorization: "Bearer sk-secret",+ });+ expect(modelDiscoveryHeaders("anthropic", "sk-secret")).toEqual({+ accept: "application/json",+ "x-api-key": "sk-secret",+ "anthropic-version": "2023-06-01",+ });+ });++ it("parses the common list shapes and prefers a display name", () => {+ expect(parseDiscoveredModels({ data: [{ id: "b" }, { id: "a", name: "Model A" }] }))+ .toEqual([{ id: "a", name: "Model A" }, { id: "b", name: "b" }]);+ expect(parseDiscoveredModels({ models: ["z", "a", "a"] }))+ .toEqual([{ id: "a", name: "a" }, { id: "z", name: "z" }]);+ expect(parseDiscoveredModels(["only"])).toEqual([{ id: "only", name: "only" }]);+ expect(parseDiscoveredModels({ unexpected: true })).toEqual([]);+ expect(parseDiscoveredModels(null)).toEqual([]);+ });++ it("discovers through the injected fetch, without leaking the key elsewhere", async () => {+ const fetchImpl = vi.fn(async (_url: string, _init?: RequestInit) =>+ new Response(JSON.stringify({ data: [{ id: "gpt-oss" }] }), { status: 200 }),+ );+ const models = await discoverEndpointModels(+ { baseUrl: "https://gateway.example/v1", apiKey: "sk-secret", protocol: "openai" },+ { fetchImpl: fetchImpl as unknown as typeof fetch },+ );+ expect(models).toEqual([{ id: "gpt-oss", name: "gpt-oss" }]);+ const [url, init] = fetchImpl.mock.calls[0];+ expect(url).toBe("https://gateway.example/v1/models");+ expect(init).toMatchObject({ method: "GET", redirect: "error" });+ expect((init?.headers as Record<string, string>).authorization).toBe("Bearer sk-secret");+ });++ it("surfaces a bounded provider error instead of the response body", async () => {+ const fetchImpl = vi.fn(async () =>+ new Response("denied ".repeat(1000), { status: 401 }),+ );+ await expect(+ discoverEndpointModels(+ { baseUrl: "https://gateway.example/v1", apiKey: "sk-secret" },+ { fetchImpl: fetchImpl as unknown as typeof fetch },+ ),+ ).rejects.toThrow(/model discovery HTTP 401/);+ });++ it("rejects a non-JSON success body", async () => {+ const fetchImpl = vi.fn(async () => new Response("<html>", { status: 200 }));+ await expect(+ discoverEndpointModels(+ { baseUrl: "https://gateway.example/v1", apiKey: "sk-secret" },+ { fetchImpl: fetchImpl as unknown as typeof fetch },+ ),+ ).rejects.toThrow(/invalid JSON/);+ });+});diff --git a/scripts/cli/ai-provider-auth.sh b/scripts/cli/ai-provider-auth.shindex 2dc304c0..6bbda276 100644--- a/scripts/cli/ai-provider-auth.sh+++ b/scripts/cli/ai-provider-auth.sh@@ -39,9 +39,25 @@ Options:--base-url <url> Custom OpenAI/Anthropic-compatible base URL--protocol <p> Custom endpoint protocol: openai (default) | anthropic--models <ids> Custom endpoint model ids, comma/newline separated+ (leave empty and the endpoint's own list API is queried)TXT}+# Ask a custom endpoint which model ids it actually serves. Populates+# DISCOVERED_MODELS (newline-separated) and returns 0 only on a usable answer,+# so a caller can fall back to manual ids. The key travels in the stdin-bodied+# secret_post body, never process argv, and is never echoed back.+discover_custom_models() {+ local base="$1" key="$2" protocol="$3" body response+ DISCOVERED_MODELS=""+ body=$(printf '%s\0%s\0%s' "$base" "$key" "$protocol" | discover_body)+ response=$(secret_post "/api/models/discover" "$body" 2>/dev/null) || { unset body; return 1; }+ unset body+ [ "$(jq -r '.ok // false' <<<"$response")" = true ] || return 1+ DISCOVERED_MODELS=$(jq -r '.models[]?.id // empty' <<<"$response")+ [ -n "$DISCOVERED_MODELS" ]+}+configure_ai_provider() {local provider="${1:?provider required}"; shift || truelocal body name base="" protocol="" models="" api_key="" cred_type="" opt_name=""@@ -88,9 +104,29 @@ configure_ai_provider() {openai|anthropic) ;;*) die "protocol must be openai or anthropic" ;;esac- if [ -z "$models" ] && tty_ok; then tty_line "Models (comma/newline IDs; optional): " ""; models="$REPLY"; fi+ # The key is needed to query what the endpoint serves, so it is collected+ # before models. An empty --models now asks the endpoint itself, instead of+ # leaving the picker for this custom provider empty.if [ -z "$api_key" ]; then tty_secret "API key: "; api_key="$REPLY"; fi[ -n "$api_key" ] || die "empty API key"+ if [ -z "$models" ] && discover_custom_models "$base" "$api_key" "$protocol"; then+ local discovered_count+ discovered_count=$(grep -c . <<<"$DISCOVERED_MODELS")+ if tty_ok; then+ echo " discovered $discovered_count model(s) at $base:"+ while IFS= read -r m; do [ -n "$m" ] && printf ' %s\n' "$m"; done <<<"$DISCOVERED_MODELS"+ tty_line "Use all $discovered_count discovered models? [Y/n]: " "y"+ case "${REPLY,,}" in+ n|no) models=""; tty_line "Models (comma/newline IDs; optional): " ""; models="$REPLY" ;;+ *) models="$DISCOVERED_MODELS" ;;+ esac+ else+ models="$DISCOVERED_MODELS"+ fi+ elif [ -z "$models" ] && tty_ok; then+ echo " · could not discover models automatically"+ tty_line "Models (comma/newline IDs; optional): " ""; models="$REPLY"+ fibody=$(printf '%s\0%s\0%s\0%s\0%s' "$name" "$base" "$protocol" "$api_key" "$models" | custom_provider_body_unselected)secret_post "/api/config" "$body" >/dev/nullunset api_key body REPLYdiff --git a/scripts/mso-cli-agent.sh b/scripts/mso-cli-agent.shindex 779f90de..c467d42f 100755--- a/scripts/mso-cli-agent.sh+++ b/scripts/mso-cli-agent.sh@@ -21,6 +21,12 @@ process.stdout.write(JSON.stringify({customProvider:{name:a[0]||"",baseURL:a[1]|'}+# Build a model-discovery request from stdin so the pasted API key never reaches+# node/curl argv. Fields: baseURL \0 apiKey \0 protocol.+discover_body() {+ node -e 'const fs=require("fs"); const a=fs.readFileSync(0).toString("utf8").split("\0"); process.stdout.write(JSON.stringify({baseURL:a[0]||"",apiKey:a[1]||"",protocol:a[2]||"openai"}));'+}+onboard_infra() {local yes="$1" choiceif [ "$yes" = 1 ]; then