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(infra): add bounded Dokploy public env rollout
Rahmane2b3e9e2046a
diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.mdindex 3552a959..821b43aa 100644--- a/docs/CHANGELOG.md+++ b/docs/CHANGELOG.md@@ -6,6 +6,10 @@ this is the *what*, and it is what Settings → About shows as “What's new”.## 2026-09-06+**Added**++- `infra` add bounded Dokploy public env rollout+**Fixed**- `infra` support modern pinned DNS lookupsdiff --git a/docs/PROGRESS.md b/docs/PROGRESS.mdindex 925eb42a..c14f71e0 100644--- a/docs/PROGRESS.md+++ b/docs/PROGRESS.md@@ -1,3 +1,7 @@+## 2026-09-06 — Dokploy public build env rollout is a bounded native integration operation++The verified native `rahmanfakhr / dokploy / default` connection can now resolve applications within one exact Dokploy project and update one browser-public build environment variable before queueing a redeploy. The mutation accepts only `NEXT_PUBLIC_`, `VITE_`, `PUBLIC_`, `REACT_APP_`, or `EXPO_PUBLIC_` keys, rejects multiline/oversized values and duplicate target keys, preserves existing server env/build args/build secrets privately, re-reads the application to verify the exact change, and redeploys only when the value changed. It does not expose environment contents or add a generic Dokploy request escape hatch. The mutation stays out of the compact ChatGPT global profile and is reached through the existing native `integration_execute` surface.+## 2026-09-06 — Pinned provider DNS supports modern Node all-address lookupDokploy credentials already used by Rahman Resources were valid, but MSO's SSRF-safe transport failed before opening the socket with `Invalid IP address: undefined`. Modern Node http/https may invoke a custom `lookup` with `options.all=true`; the pinned callback still returned the legacy `(address, family)` shape, so Node tried to consume a missing address from the wrong callback contract. The shared pinned lookup now returns a one-element `LookupAddress[]` in all-address mode and preserves the legacy shape otherwise. Dokploy's live `project.all` probe now succeeds through the DNS-pinned transport, and the same helper replaces the duplicate A2A loopback pinning callback. No SSRF policy, DNS-rebinding rejection, redirect rule, or credential boundary was weakened.diff --git a/docs/generated/MCP-CATALOG.md b/docs/generated/MCP-CATALOG.mdindex 44ac25bf..41cd37b2 100644--- a/docs/generated/MCP-CATALOG.md+++ b/docs/generated/MCP-CATALOG.md@@ -4,21 +4,21 @@## Full MSO catalog-<!-- mcp-toolset: server=1.12.1 version=2026.09.06.1 tools=95 read=46 write=29 exec=20 -->+<!-- mcp-toolset: server=1.12.1 version=2026.09.06.1 tools=97 read=47 write=30 exec=20 -->| Fact | Current source value ||---|---:|| MCP server | `1.12.1` || Toolset | `2026.09.06.1` || Toolset changed at | `2026-09-05T17:09:52Z` |-| Transport tools | **97** |-| Model/operator tools | **95** |-| Read | **46** |-| Write | **29** |+| Transport tools | **99** |+| Model/operator tools | **97** |+| Read | **47** |+| Write | **30** || Exec | **20** || App-only bridges | **2** |-### Read (46)+### Read (47)- `a2a_agent_discover`- `a2a_agents_list`@@ -33,6 +33,7 @@- `browser_status`- `cloudflare_zones_list`- `connections_list`+- `dokploy_applications_list`- `dokploy_projects_list`- `exec_job_status`- `fs_list`@@ -67,7 +68,7 @@- `tool_forge_candidates`- `vps_status`-### Write (29)+### Write (30)- `a2a_agent_register`- `a2a_agent_remove`@@ -77,6 +78,7 @@- `agent_session_rename`- `apps_power`- `cloudflare_dns_upsert`+- `dokploy_application_public_env_upsert`- `dokploy_project_ensure`- `fs_copy`- `fs_delete`diff --git a/lib/infra/clients.ts b/lib/infra/clients.tsindex 4d6b9bd1..69c98015 100644--- a/lib/infra/clients.ts+++ b/lib/infra/clients.ts@@ -9,7 +9,7 @@ import { doctorHostinger } from "./hostinger";import { doctorComposio } from "./composio";export { listCloudflareZones, upsertCloudflareDns } from "./cloudflare";-export { ensureDokployProject, listDokployProjects } from "./dokploy";+export { ensureDokployProject, listDokployProjects, listDokployApplications, upsertDokployPublicBuildEnv } from "./dokploy";export { upsertHostingerDns } from "./hostinger";export { listHostingerMailOrders, getHostingerMailPlan, listHostingerMail, listHostingerMailLogs, mutateHostingerMail } from "./hostinger-mail";diff --git a/lib/infra/connection-dispatch.ts b/lib/infra/connection-dispatch.tsindex 07d1a3bd..7f46c343 100644--- a/lib/infra/connection-dispatch.ts+++ b/lib/infra/connection-dispatch.ts@@ -2,7 +2,7 @@ import { integrationManage } from "./connection-manage";import { integrationQuery, withIntegrationSelection, resolveIntegration } from "./connection-service";import { authorizeIntegration, composioConnectionCall } from "./connection-external";import { IntegrationError, identity, metadataOnly, type ConnectionSelector } from "./identity";-import { doctorInfraProvider, ensureDokployProject, listDokployProjects, listCloudflareZones, upsertCloudflareDns, upsertHostingerDns, listHostingerMailOrders, getHostingerMailPlan, listHostingerMail, listHostingerMailLogs, mutateHostingerMail } from "./clients";+import { doctorInfraProvider, ensureDokployProject, listDokployApplications, listDokployProjects, listCloudflareZones, upsertCloudflareDns, upsertDokployPublicBuildEnv, upsertHostingerDns, listHostingerMailOrders, getHostingerMailPlan, listHostingerMail, listHostingerMailLogs, mutateHostingerMail } from "./clients";import { isInfraProviderId } from "./catalog";export const safeActionInput=(input:Record<string,unknown>)=>Object.fromEntries(Object.entries(input).filter(([key])=>key!=="workflow_id"));export const selectionFrom=(a:Record<string,unknown>):ConnectionSelector=>({user:typeof a.user==="string"?a.user:undefined,connection:typeof a.connection==="string"?a.connection:undefined,cwd:typeof a.cwd==="string"?a.cwd:undefined});@@ -25,6 +25,8 @@ export async function executeIntegrationAction(raw:Record<string,unknown>){if(operation==="composio.tool")return composioConnectionCall(provider,selection,String(a.tool),args as Record<string,unknown>);const verbs:Record<string,{provider:string;fields:string[];run:()=>Promise<unknown>}>= {"dokploy.projects.list":{provider:"dokploy",fields:[],run:()=>listDokployProjects()},+ "dokploy.applications.list":{provider:"dokploy",fields:["projectId"],run:()=>listDokployApplications(String((args as Record<string,unknown>).projectId))},+ "dokploy.application.publicEnv.upsert":{provider:"dokploy",fields:["applicationId","key","value"],run:()=>upsertDokployPublicBuildEnv(args as {applicationId:string;key:string;value:string})},"dokploy.project.ensure":{provider:"dokploy",fields:["name"],run:()=>ensureDokployProject(String((args as Record<string,unknown>).name))},"cloudflare.zones.list":{provider:"cloudflare",fields:[],run:()=>listCloudflareZones()},"cloudflare.dns.upsert":{provider:"cloudflare",fields:["name","type","content","ttl","proxied"],run:()=>upsertCloudflareDns(args as Parameters<typeof upsertCloudflareDns>[0])},diff --git a/lib/infra/connection-model.test.ts b/lib/infra/connection-model.test.tsindex c73e0f64..846120f3 100644--- a/lib/infra/connection-model.test.ts+++ b/lib/infra/connection-model.test.ts@@ -56,6 +56,21 @@ describe("native credential identity core",()=>{await Promise.all([f.withIntegrationSelection({user:"alice",connection:"work"},()=>listDokployProjects()),f.withIntegrationSelection({user:"bob",connection:"work"},()=>listDokployProjects())]);expect(calls).toContainEqual({url:"http://127.0.0.1:4123/api/project.all",key:KEY_A});expect(calls).toContainEqual({url:"http://127.0.0.1:4124/api/project.all",key:KEY_B});});+ it("updates one Dokploy public build env privately, preserves build settings, and redeploys once",async()=>{+ const f=await fixture();await f.add("alice","dokploy","work","direct",{apiUrl:"http://127.0.0.1:4123",apiKey:KEY_A});+ let env="PRIVATE_TOKEN=synthetic-private\nNEXT_PUBLIC_CONVEX_URL=https://old.example\n";let deploys=0;+ vi.stubGlobal("fetch",vi.fn(async(input:RequestInfo|URL,init?:RequestInit)=>{+ const req=new Request(input,init),url=new URL(req.url);+ if(url.pathname.endsWith("/application.one"))return new Response(JSON.stringify({applicationId:"application_123",env,buildArgs:"BUILD=1",buildSecrets:"SYNTHETIC_BUILD_SECRET",createEnvFile:true}),{status:200});+ if(url.pathname.endsWith("/application.saveEnvironment")){const body=JSON.parse(await req.text());expect(body).toMatchObject({applicationId:"application_123",buildArgs:"BUILD=1",buildSecrets:"SYNTHETIC_BUILD_SECRET",createEnvFile:true});env=body.env;return new Response("{}",{status:200});}+ if(url.pathname.endsWith("/application.deploy")){deploys+=1;return new Response("{}",{status:200});}+ return new Response("not found",{status:404});+ }));+ const {upsertDokployPublicBuildEnv}=await import("./dokploy");+ const result=await f.withIntegrationSelection({user:"alice",connection:"work"},()=>upsertDokployPublicBuildEnv({applicationId:"application_123",key:"NEXT_PUBLIC_CONVEX_URL",value:"https://api.example.com"}));+ expect(result).toEqual({applicationId:"application_123",key:"NEXT_PUBLIC_CONVEX_URL",changed:true,redeployQueued:true});expect(deploys).toBe(1);+ expect(env).toContain("PRIVATE_TOKEN=synthetic-private");expect(env).toContain("NEXT_PUBLIC_CONVEX_URL=https://api.example.com");expect(JSON.stringify(result)).not.toContain("api.example.com");+ });it("pins credentials for the duration of a compound operation and never changes defaults",async()=>{const f=await fixture();await f.add("alice","github","work","direct",{apiKey:KEY_A});await f.withIntegrationSelection({user:"alice",connection:"work"},async()=>{diff --git a/lib/infra/dokploy.test.ts b/lib/infra/dokploy.test.tsnew file mode 100644index 00000000..411ea6a1--- /dev/null+++ b/lib/infra/dokploy.test.ts@@ -0,0 +1,27 @@+import { describe, expect, it } from "vitest";+import { upsertPublicEnvText } from "./dokploy";++describe("Dokploy public build environment editing", () => {+ it("updates one public key without disturbing neighboring environment entries", () => {+ const source = "API_SECRET=keep-private\nNEXT_PUBLIC_CONVEX_URL=https://old.example\nOTHER=value\n";+ const result = upsertPublicEnvText(source, "NEXT_PUBLIC_CONVEX_URL", "https://api.example.com");+ expect(result).toEqual({+ changed: true,+ env: "API_SECRET=keep-private\nNEXT_PUBLIC_CONVEX_URL=https://api.example.com\nOTHER=value\n",+ });+ });++ it("is idempotent and appends a missing public build variable", () => {+ expect(upsertPublicEnvText("A=1\n", "VITE_CONVEX_URL", "https://api.example.com")).toEqual({+ changed: true,+ env: "A=1\nVITE_CONVEX_URL=https://api.example.com\n",+ });+ expect(upsertPublicEnvText("VITE_CONVEX_URL=https://api.example.com\n", "VITE_CONVEX_URL", "https://api.example.com").changed).toBe(false);+ });++ it("refuses secret/server keys, multiline values, and ambiguous duplicate keys", () => {+ expect(() => upsertPublicEnvText("", "DATABASE_URL", "postgres://example")).toThrow(/only public browser/i);+ expect(() => upsertPublicEnvText("", "NEXT_PUBLIC_VALUE", "one\ntwo")).toThrow(/invalid public environment value/i);+ expect(() => upsertPublicEnvText("VITE_X=1\nVITE_X=2\n", "VITE_X", "3")).toThrow(/duplicate VITE_X/i);+ });+});diff --git a/lib/infra/dokploy.ts b/lib/infra/dokploy.tsindex 8f8a3632..93dbb091 100644--- a/lib/infra/dokploy.ts+++ b/lib/infra/dokploy.ts@@ -63,3 +63,106 @@ export async function ensureDokployProject(name: string): Promise<{ projectId: sif (!created) throw new Error("Dokploy project create returned success but the project is still absent");return { ...created, created: true };}+++const DOKPLOY_ID = /^[A-Za-z0-9_-]{8,80}$/;+const PUBLIC_BUILD_ENV = /^(?:NEXT_PUBLIC_|VITE_|PUBLIC_|REACT_APP_|EXPO_PUBLIC_)[A-Z0-9_]+$/;++function dokployId(value: string, label: string): string {+ const clean = value.trim();+ if (!DOKPLOY_ID.test(clean)) throw new Error(`invalid Dokploy ${label}`);+ return clean;+}++export type DokployApplicationSummary = {+ projectId: string;+ environmentId: string;+ environment: string;+ applicationId: string;+ name: string;+ appName: string;+ status: string | null;+};++export async function listDokployApplications(projectId: string): Promise<DokployApplicationSummary[]> {+ const id = dokployId(projectId, "project id");+ const payload = await call(`/environment.byProjectId?projectId=${encodeURIComponent(id)}`);+ const environments = Array.isArray(payload) ? payload : [];+ const rows: DokployApplicationSummary[] = [];+ for (const item of environments) {+ const environment = obj(item);+ const environmentId = String(environment.environmentId ?? environment.id ?? "");+ const environmentName = String(environment.name ?? "");+ const applications = Array.isArray(environment.applications) ? environment.applications : [];+ for (const raw of applications) {+ const app = obj(raw);+ const applicationId = String(app.applicationId ?? app.id ?? "");+ if (!applicationId) continue;+ rows.push({+ projectId: id,+ environmentId,+ environment: environmentName,+ applicationId,+ name: String(app.name ?? ""),+ appName: String(app.appName ?? ""),+ status: typeof app.applicationStatus === "string" ? app.applicationStatus : null,+ });+ }+ }+ return rows;+}++function quotePublicEnvValue(value: string): string {+ if (value.includes("\n") || value.includes("\r") || value.length > 2048) throw new Error("invalid public environment value");+ return /^[A-Za-z0-9_./:@?&=%+,~-]*$/.test(value) ? value : JSON.stringify(value);+}++export function upsertPublicEnvText(source: string, key: string, value: string): { env: string; changed: boolean } {+ const cleanKey = key.trim();+ if (!PUBLIC_BUILD_ENV.test(cleanKey)) throw new Error("only public browser build environment variables may be changed through this operation");+ const encoded = quotePublicEnvValue(value);+ const lines = source.replace(/\r\n/g, "\n").split("\n");+ const escaped = cleanKey.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");+ const matcher = new RegExp(`^\\s*(?:export\\s+)?${escaped}\\s*=`);+ const matches = lines.flatMap((line, index) => matcher.test(line) ? [index] : []);+ if (matches.length > 1) throw new Error(`Dokploy environment contains duplicate ${cleanKey} entries`);+ const replacement = `${cleanKey}=${encoded}`;+ if (matches.length === 1) {+ const index = matches[0]!;+ if (lines[index] === replacement) return { env: source, changed: false };+ lines[index] = replacement;+ } else {+ while (lines.length && lines.at(-1) === "") lines.pop();+ lines.push(replacement, "");+ }+ return { env: lines.join("\n"), changed: true };+}++async function readDokployApplication(applicationId: string): Promise<Record<string, unknown>> {+ const id = dokployId(applicationId, "application id");+ return obj(await call(`/application.one?applicationId=${encodeURIComponent(id)}`));+}++export async function upsertDokployPublicBuildEnv(args: {+ applicationId: string;+ key: string;+ value: string;+}): Promise<{ applicationId: string; key: string; changed: boolean; redeployQueued: boolean }> {+ const applicationId = dokployId(args.applicationId, "application id");+ const before = await readDokployApplication(applicationId);+ const sourceEnv = typeof before.env === "string" ? before.env : "";+ const next = upsertPublicEnvText(sourceEnv, args.key, args.value);+ if (!next.changed) return { applicationId, key: args.key, changed: false, redeployQueued: false };+ await call("/application.saveEnvironment", "POST", {+ applicationId,+ env: next.env,+ buildArgs: typeof before.buildArgs === "string" ? before.buildArgs : null,+ buildSecrets: typeof before.buildSecrets === "string" ? before.buildSecrets : null,+ createEnvFile: before.createEnvFile === true,+ });+ const after = await readDokployApplication(applicationId);+ const verified = upsertPublicEnvText(typeof after.env === "string" ? after.env : "", args.key, args.value);+ if (verified.changed) throw new Error("Dokploy environment update could not be verified");+ await call("/application.deploy", "POST", { applicationId });+ return { applicationId, key: args.key, changed: true, redeployQueued: true };+}diff --git a/lib/mcp/parity.test.ts b/lib/mcp/parity.test.tsindex c072c352..57a8d1e8 100644--- a/lib/mcp/parity.test.ts+++ b/lib/mcp/parity.test.ts@@ -58,6 +58,8 @@ const MCP_ONLY: Record<string, string> = {"infra.providers.list": "MSO Agent and external connectors need a credential-free infrastructure capability inventory; in-shell Alfa has dedicated Dokploy/Cloudflare feature apps instead","infra.provider.doctor": "provider credentials stay server-side and the terminal/external agent needs a bounded live verification tool; Alfa has no reason to receive infrastructure secrets or duplicate these clients","dokploy.projects.list": "MSO Agent deploy workflows need a bounded Dokploy discovery seam; in-shell Alfa can delegate deployment through the dedicated infrastructure feature instead of duplicating this provider catalog",+ "dokploy.applications.list": "external deployment workflows need a secret-free project-to-application resolver; Alfa delegates infrastructure discovery to the native integrations surface instead of duplicating Dokploy application state",+ "dokploy.application.public.env.upsert": "public build-env mutation is intentionally external/terminal-agent-only: it is prefix-restricted, audited, rate-limited, and keeps server/secret env values out of Alfa's static host catalog","dokploy.project.ensure": "terminal/external deployment workflows need one idempotent Dokploy mutation with scope/approval; in-shell Alfa does not own infrastructure deployment credentials","cloudflare.zones.list": "terminal/external deployment workflows need bounded zone discovery while credentials stay server-side; in-shell Alfa has the Cloudflare feature app","cloudflare.dns.upsert": "DNS automation is intentionally MCP/terminal-agent-only so it inherits scope, approval, audit and workflow semantics without teaching generic in-shell Alfa to mutate public DNS",diff --git a/lib/mcp/tool-contract.ts b/lib/mcp/tool-contract.tsindex a5967c32..efa110fe 100644--- a/lib/mcp/tool-contract.ts+++ b/lib/mcp/tool-contract.ts@@ -86,14 +86,14 @@ const DESTRUCTIVE = new Set(["fs_write", "fs_upload_file", "fs_move", "fs_copy", "fs_delete","exec_run", "exec_job_start", "exec_job_cancel", "project_function_call", "project_mcp_call","local_agent_message_send", "local_agent_reply", "a2a_message_send", "a2a_task_cancel", "a2a_agent_remove",- "cloudflare_dns_upsert", "hostinger_dns_upsert", "apps_power", "browser_power", "tool_forge_promote",+ "dokploy_application_public_env_upsert", "cloudflare_dns_upsert", "hostinger_dns_upsert", "apps_power", "browser_power", "tool_forge_promote","agent_memory_forget", "project_memory_upsert", "workflow_cancel",]);const OPEN_WORLD = new Set(["exec_run", "exec_job_start", "project_function_call", "project_mcp_call", "fs_upload_file","a2a_agent_discover", "a2a_message_send", "a2a_task_get", "a2a_task_cancel", "a2a_handoff",- "infra_provider_doctor", "dokploy_projects_list", "dokploy_project_ensure", "cloudflare_zones_list",+ "infra_provider_doctor", "dokploy_projects_list", "dokploy_applications_list", "dokploy_application_public_env_upsert", "dokploy_project_ensure", "cloudflare_zones_list","cloudflare_dns_upsert", "hostinger_dns_upsert",]);diff --git a/lib/mcp/tools-infra.ts b/lib/mcp/tools-infra.tsindex e66a31f7..aadae0c3 100644--- a/lib/mcp/tools-infra.ts+++ b/lib/mcp/tools-infra.ts@@ -1,7 +1,7 @@import { withIntegrationSelection } from "@/lib/infra/connection-service";import { selectionFrom } from "@/lib/infra/connection-dispatch";import { INTEGRATION_SELECTOR_SCHEMA } from "./tools-integrations";-import { doctorInfraProvider, ensureDokployProject, INFRA_PROVIDER_IDS, isInfraProviderId, listCloudflareZones, listDokployProjects, readInfraProvider, summarizeInfraProvider, upsertCloudflareDns, upsertHostingerDns } from "@/lib/infra";+import { doctorInfraProvider, ensureDokployProject, INFRA_PROVIDER_IDS, isInfraProviderId, listCloudflareZones, listDokployApplications, listDokployProjects, readInfraProvider, summarizeInfraProvider, upsertCloudflareDns, upsertDokployPublicBuildEnv, upsertHostingerDns } from "@/lib/infra";import { type McpTool, S, str } from "./tool-kit";const dnsSchema = {@@ -40,6 +40,24 @@ const BASE_INFRA_TOOLS: McpTool[] = [inputSchema: S({}),run: async () => listDokployProjects(),},+ {+ name: "dokploy_applications_list",+ description: "List Dokploy applications inside one exact project without returning environment values or provider credentials.",+ scope: "read",+ annotations: { readOnlyHint: true, openWorldHint: true },+ inputSchema: S({ projectId: { type: "string", description: "Exact Dokploy project id from dokploy_projects_list" } }, ["projectId"]),+ run: async (a) => listDokployApplications(str(a, "projectId")),+ },+ {+ name: "dokploy_application_public_env_upsert",+ description: "Idempotently set one public browser build environment variable (NEXT_PUBLIC_/VITE_/PUBLIC_/REACT_APP_/EXPO_PUBLIC_) on one Dokploy application, verify it privately, and queue a redeploy only when the value changed. Secret/server-only variables are refused.",+ scope: "write",+ annotations: { idempotentHint: true, openWorldHint: true },+ audit: { action: "infra.write", targetArg: "applicationId" },+ limit: { key: "infra.dokploy", max: 20, windowMs: 60_000 },+ inputSchema: S({ applicationId: { type: "string", description: "Exact Dokploy application id" }, key: { type: "string", description: "Public browser build environment variable name" }, value: { type: "string", description: "Non-secret public build value" } }, ["applicationId", "key", "value"]),+ run: async (a) => upsertDokployPublicBuildEnv({ applicationId: str(a, "applicationId"), key: str(a, "key"), value: str(a, "value") }),+ },{name: "dokploy_project_ensure",description: "Idempotently ensure a Dokploy project exists by exact name. Creates it only when absent.",