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(jev): add policy-bound MCP actions
Rahman446860bf9238
diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.mdindex bfbb6c85..1ab332c1 100644--- a/docs/CHANGELOG.md+++ b/docs/CHANGELOG.md@@ -8,6 +8,7 @@ this is the *what*, and it is what Settings → About shows as “What's new”.**Added**+- `jev` add policy-bound MCP actions- `workflows` isolate source-changing agents- `agent` recover interrupted sessions automatically- connect OpenRouter for JEV without switching modeldiff --git a/docs/generated/MCP-CATALOG.md b/docs/generated/MCP-CATALOG.mdindex 0f2dab55..ff806024 100644--- a/docs/generated/MCP-CATALOG.md+++ b/docs/generated/MCP-CATALOG.md@@ -4,18 +4,18 @@## Full MSO catalog-<!-- mcp-toolset: server=1.16.0 version=2026.09.25.1 tools=114 read=57 write=34 exec=23 -->+<!-- mcp-toolset: server=1.16.0 version=2026.09.25.1 tools=115 read=57 write=34 exec=24 -->| Fact | Current source value ||---|---:|| MCP server | `1.16.0` || Toolset | `2026.09.25.1` || Toolset changed at | `2026-09-25T17:39:19+00:00` |-| Transport tools | **116** |-| Model/operator tools | **114** |+| Transport tools | **117** |+| Model/operator tools | **115** || Read | **57** || Write | **34** |-| Exec | **23** |+| Exec | **24** || App-only bridges | **2** |### Read (57)@@ -115,7 +115,7 @@- `workflow_finish`- `workflow_start`-### Exec (23)+### Exec (24)- `a2a_handoff`- `a2a_message_send`@@ -127,6 +127,7 @@- `exec_run`- `flow_run`- `integration_execute`+- `jev_action`- `local_agent_request`- `local_agent_standby`- `project_agent_run`@@ -148,17 +149,17 @@## ChatGPT model profile-<!-- mcp-chatgpt-profile: server=1.16.0 version=2026.09.25.1 tools=114 read=57 write=34 exec=23 app-only=2 total=116 -->+<!-- mcp-chatgpt-profile: server=1.16.0 version=2026.09.25.1 tools=115 read=57 write=34 exec=24 app-only=2 total=117 -->The ChatGPT profile automatically projects the complete MSO-owned generic model/operator catalog. OAuth scope is still enforced independently; app-only compatibility bridges stay app-only, and project-owned MCP tool names remain dynamic data behind the generic project bridge.| Fact | Current source value ||---|---:|-| ChatGPT transport tools | **116** |-| ChatGPT model/operator tools | **114** |+| ChatGPT transport tools | **117** |+| ChatGPT model/operator tools | **115** || Read | **57** || Write | **34** |-| Exec | **23** |+| Exec | **24** || App-only bridges | **2** |### ChatGPT read (57)@@ -258,7 +259,7 @@ The ChatGPT profile automatically projects the complete MSO-owned generic model/- `workflow_finish`- `workflow_start`-### ChatGPT exec (23)+### ChatGPT exec (24)- `a2a_handoff`- `a2a_message_send`@@ -270,6 +271,7 @@ The ChatGPT profile automatically projects the complete MSO-owned generic model/- `exec_run`- `flow_run`- `integration_execute`+- `jev_action`- `local_agent_request`- `local_agent_standby`- `project_agent_run`diff --git a/lib/mcp/parity.test.ts b/lib/mcp/parity.test.tsindex 47e89b73..b4c04fa8 100644--- a/lib/mcp/parity.test.ts+++ b/lib/mcp/parity.test.ts@@ -21,6 +21,7 @@ const ALFA_ONLY: Record<string, string> = {};const MCP_ONLY: Record<string, string> = {+ "jev.action": "JEV action arbitration belongs to the external/terminal capability authority so selected actions re-enter MCP scope, allowlist, workflow and audit enforcement instead of bypassing them through Alfa browser identity.","mso.native.ui.probe": "Static ChatGPT MCP Apps host-mount diagnostic; Alfa already runs inside the native MSO browser shell and has no equivalent external host-renderer boundary to probe.","workflow.graph": "Native Workflows UI has its own authenticated principal; external MCP graph CRUD/run/status must stay principal-scoped instead of inheriting an unrelated browser identity.","organization.chart": "MSO already exposes the owner-private Organization registry through Alfa’s dedicated Organization tab/API; external MCP needs a bounded programmatic read surface without duplicating that registry into conversational Alfa host tools.",diff --git a/lib/mcp/tool-contract.ts b/lib/mcp/tool-contract.tsindex aec4a16c..8aa8fd07 100644--- a/lib/mcp/tool-contract.ts+++ b/lib/mcp/tool-contract.ts@@ -115,7 +115,9 @@ function compactSchema(value: unknown): unknown {for (const [key, item] of Object.entries(value as Record<string, unknown>)) {if (key === "additionalProperties" && item === true || key === "required" && Array.isArray(item) && item.length === 0) continue;if (key === "workflow_id" && item && typeof item === "object") out[key] = { type:"string" };- else if (key === "description") continue;+ else if (key === "additionalProperties" && item && typeof item === "object") out[key] = true;+ else if (key === "items" && item && typeof item === "object" && (item as Record<string, unknown>).type === "object") { const row=compactSchema(item) as Record<string,unknown>; delete row.additionalProperties; out[key]=row; }+ else if (key === "description" || key === "title") continue;else out[key] = compactSchema(item);}return out;diff --git a/lib/mcp/tools-jev.ts b/lib/mcp/tools-jev.tsnew file mode 100644index 00000000..95a698b9--- /dev/null+++ b/lib/mcp/tools-jev.ts@@ -0,0 +1,7 @@+import { S, str, type McpTool } from "./tool-kit";+import { proposeJevActions, executeJevAction, type JevActionCandidate, type JevActionProposal } from "@/lib/workflow/jev-action-layer";++const candidateSchema={type:"array",maxItems:16,items:{type:"object",properties:{id:{type:"string",maxLength:80},tool:{type:"string",maxLength:96},arguments:{type:"object",additionalProperties:true},rationale:{type:"string",maxLength:1000},risk:{type:"string",enum:["safe","review","destructive"]}},required:["id","tool","arguments","rationale","risk"]}};+export const JEV_TOOLS:McpTool[]=[+ {name:"jev_action",title:"JEV Action Decision",scope:"exec",description:"Use JEV to score bounded structured MSO/MCP action candidates, or explicitly execute one previously selected safe action through the normal MSO capability authority. Proposal never executes tools. Execute re-applies scope, token allowlists, argument constraints, workflow correlation, rate limits and audit; destructive/review actions remain blocked for normal explicit tool confirmation.",chatgptDescription:"JEV-score actions; execute selected safe action.",annotations:{readOnlyHint:false,destructiveHint:false,openWorldHint:false},limit:{key:"workflow.graph",max:20,windowMs:60_000},audit:{action:"exec.run",targetArg:"action_id"},actionContract:{phase:"validate",target:"jev-action",sourceOfTruth:"live",validators:["tool-catalog","scope","token-allowlist","argument-constraints","workflow-policy"],confirmation:"contextual",concurrency:"contextual",presentation:"structured"},inputSchema:S({action:{type:"string",enum:["propose","execute"]},state:{type:"object",additionalProperties:true},candidates:candidateSchema,proposal:{type:"object",additionalProperties:true},action_id:{type:"string",maxLength:80},jev:{type:"object",additionalProperties:true}},["action"]),run:async(a,context)=>{const {TOOLS_BY_NAME}=await import("./tools");const resolve=(name:string)=>TOOLS_BY_NAME.get(name);if(a.action==="propose")return proposeJevActions((a.state&&typeof a.state==="object"&&!Array.isArray(a.state)?a.state:{}) as Record<string,unknown>,Array.isArray(a.candidates)?a.candidates as JevActionCandidate[]:[],resolve,(a.jev&&typeof a.jev==="object"&&!Array.isArray(a.jev)?a.jev:undefined));if(a.action==="execute")return executeJevAction(a.proposal as JevActionProposal,str(a,"action_id"),{scope:context.scope,actor:context.actor,context},resolve);throw new Error("action must be propose or execute");}}+];diff --git a/lib/mcp/tools.ts b/lib/mcp/tools.tsindex f9f31757..899cf466 100644--- a/lib/mcp/tools.ts+++ b/lib/mcp/tools.ts@@ -11,6 +11,7 @@ import { FORGE_TOOLS } from "./tools-forge";import { INFRA_TOOLS } from "./tools-infra";import { INTEGRATION_TOOLS } from "./tools-integrations";import { LEARNING_TOOLS } from "./tools-learning";+import { JEV_TOOLS } from "./tools-jev";import { LOCAL_AGENT_TOOLS } from "./tools-local-agents";import { OPERATOR_DASHBOARD_TOOLS } from "./tools-operator-dashboard";import { ORGANIZATION_TOOLS } from "./tools-organization";@@ -26,4 +27,4 @@ import { BLOCK_TOOLS, LIST_TOOLS, NATIVE_UI_PROBE_TOOLS, SURFACE_TOOLS } from ".import type { McpTool } from "./tool-kit";import { MUTATE_TOOLS } from "./tools-mutate";-export const TOOLS: McpTool[] = [...FLOW_TOOLS, ...AGENT_OPEN_TOOLS, ...PROJECT_ASSET_TOOLS, ...PROJECT_MCP_MANAGE_TOOLS, ...SESSION_ARTIFACT_TOOLS, ...READ_TOOLS, ...FILE_TRANSFER_READ_TOOLS, ...DISCOVERY_TOOLS, ...LEARNING_TOOLS, ...AGENT_TOOLS, ...LOCAL_AGENT_TOOLS, ...SUBAGENT_TOOLS, ...A2A_TOOLS, ...FORGE_TOOLS, ...READ_PIPELINE_TOOLS, ...PROJECT_MCP_TOOLS, ...PROJECT_EXPERIENCE_TOOLS, ...ORGANIZATION_TOOLS, ...OPERATOR_DASHBOARD_TOOLS, ...NATIVE_UI_PROBE_TOOLS, ...BLOCK_TOOLS, ...LIST_TOOLS, ...SURFACE_TOOLS, ...INFRA_TOOLS, ...INTEGRATION_TOOLS, ...MUTATE_TOOLS, ...POWER_TOOLS].map(withWorkflowContext); export const TOOLS_BY_NAME = new Map(TOOLS.map((t) => [t.name, t]));+export const TOOLS: McpTool[] = [...FLOW_TOOLS, ...AGENT_OPEN_TOOLS, ...PROJECT_ASSET_TOOLS, ...PROJECT_MCP_MANAGE_TOOLS, ...SESSION_ARTIFACT_TOOLS, ...READ_TOOLS, ...FILE_TRANSFER_READ_TOOLS, ...DISCOVERY_TOOLS, ...LEARNING_TOOLS, ...JEV_TOOLS, ...AGENT_TOOLS, ...LOCAL_AGENT_TOOLS, ...SUBAGENT_TOOLS, ...A2A_TOOLS, ...FORGE_TOOLS, ...READ_PIPELINE_TOOLS, ...PROJECT_MCP_TOOLS, ...PROJECT_EXPERIENCE_TOOLS, ...ORGANIZATION_TOOLS, ...OPERATOR_DASHBOARD_TOOLS, ...NATIVE_UI_PROBE_TOOLS, ...BLOCK_TOOLS, ...LIST_TOOLS, ...SURFACE_TOOLS, ...INFRA_TOOLS, ...INTEGRATION_TOOLS, ...MUTATE_TOOLS, ...POWER_TOOLS].map(withWorkflowContext); export const TOOLS_BY_NAME = new Map(TOOLS.map((t) => [t.name, t]));diff --git a/lib/workflow/jev-action-layer.test.ts b/lib/workflow/jev-action-layer.test.tsnew file mode 100644index 00000000..d1aaebe0--- /dev/null+++ b/lib/workflow/jev-action-layer.test.ts@@ -0,0 +1,13 @@+import { describe,it,expect,vi } from "vitest";+const evaluate=vi.fn();+vi.mock("./jev-evaluator",()=>({createResolvedJevWorkflowOptimizerEvaluator:()=>evaluate}));+vi.mock("./jev-integration",()=>({resolveJevIntegrationConfig:vi.fn(async()=>({transport:"openrouter",provider:"openrouter",model:"~typesafe/jev-latest"}))}));+vi.mock("@/lib/capabilities/execute",()=>({executeCapabilityCall:vi.fn(async(input)=>({kind:"success",result:{tool:input.tool.name,args:input.args}}))}));+import { proposeJevActions,executeJevAction } from "./jev-action-layer";+const tool=(name:string,scope:"read"|"write"|"exec"="read",destructive=false)=>({name,scope,description:name,inputSchema:{type:"object" as const,properties:{}},annotations:{destructiveHint:destructive},run:async()=>({})});+describe("JEV action layer",()=>{+ it("produces non-executable structured proposals and strips secret-shaped state/arguments",async()=>{evaluate.mockResolvedValue({provider:"jev",probabilities:{a:.91}});const p=await proposeJevActions({token:"hidden",ok:"yes"},[{id:"a",tool:"sys_stats",arguments:{apiKey:"hidden",x:"ok"},rationale:"inspect health",risk:"safe"}],n=>n==="sys_stats"?tool(n):undefined);expect(p.executable).toBe(false);expect(p.selected[0]).toMatchObject({id:"a",tool:"sys_stats",probability:.91,arguments:{x:"ok"}});expect(JSON.stringify(p)).not.toContain("hidden");});+ it("rejects arbitrary shell and destructive tools before JEV",async()=>{await expect(proposeJevActions({},[{id:"a",tool:"exec_run",arguments:{command:"id"},rationale:"x",risk:"safe"}],n=>tool(n,"exec",true))).rejects.toThrow("not eligible");});+ it("executes only selected safe actions through the capability authority",async()=>{const p={kind:"mso.jev-action-proposal.v1" as const,provider:"jev" as const,selected:[{id:"a",tool:"sys_stats",arguments:{},rationale:"health",risk:"safe" as const,probability:.9}],rejected:[],executable:false as const,instruction:"review"};const out=await executeJevAction(p,"a",{scope:"read",actor:"tester",context:{scope:"read"}},n=>n==="sys_stats"?tool(n):undefined);expect(out).toMatchObject({kind:"success",result:{tool:"sys_stats"}});});+ it("blocks review/destructive selections from proposal execution",async()=>{const p={kind:"mso.jev-action-proposal.v1" as const,provider:"jev" as const,selected:[{id:"a",tool:"project_mcp_call",arguments:{},rationale:"call",risk:"review" as const,probability:.9}],rejected:[],executable:false as const,instruction:"review"};await expect(executeJevAction(p,"a",{scope:"exec",context:{scope:"exec"}},n=>tool(n,"exec",true))).rejects.toThrow("explicit tool confirmation");});+});diff --git a/lib/workflow/jev-action-layer.ts b/lib/workflow/jev-action-layer.tsnew file mode 100644index 00000000..0e7453bd--- /dev/null+++ b/lib/workflow/jev-action-layer.ts@@ -0,0 +1,14 @@+import { createResolvedJevWorkflowOptimizerEvaluator } from "./jev-evaluator";+import { resolveJevIntegrationConfig, type JevIntegrationInput } from "./jev-integration";+import type { CapabilityTool, CapabilityRunContext } from "@/lib/capabilities/tool";+import { executeCapabilityCall } from "@/lib/capabilities/execute";++export type JevActionCandidate = { id:string; tool:string; arguments:Record<string,unknown>; rationale:string; risk:"safe"|"review"|"destructive" };+export type JevActionProposal = { kind:"mso.jev-action-proposal.v1"; provider:"jev"; selected:Array<JevActionCandidate & { probability:number }>; rejected:Array<{id:string;probability:number}>; executable:false; instruction:string };++const FORBIDDEN = new Set(["exec_run","exec_job_start","fs_delete","fs_write","fs_upload_file","fs_move","fs_copy","tool_forge_promote","agent_memory_forget","workflow_cancel"]);+const SECRET_KEY = /(?:secret|token|password|api[_-]?key|authorization|cookie)/i;+function clean(value:unknown, depth=0):unknown { if(depth>5)return "[bounded]"; if(Array.isArray(value))return value.slice(0,32).map(v=>clean(v,depth+1)); if(!value||typeof value!=="object")return typeof value==="string"?value.slice(0,4000):value; const out:Record<string,unknown>={}; for(const [k,v] of Object.entries(value as Record<string,unknown>)){ if(SECRET_KEY.test(k))continue; out[k]=clean(v,depth+1); } return out; }+export function validateJevActionCandidates(rows:JevActionCandidate[], resolveTool:(name:string)=>CapabilityTool|undefined){ return rows.slice(0,16).map(row=>{ const tool=resolveTool(row.tool); if(!tool) throw new Error(`JEV action references unknown tool: ${row.tool}`); if(FORBIDDEN.has(row.tool)) throw new Error(`JEV action tool is not eligible for autonomous proposal: ${row.tool}`); return {...row,arguments:clean(row.arguments) as Record<string,unknown>,risk:tool.annotations?.destructiveHint?"destructive":row.risk}; }); }+export async function proposeJevActions(state:Record<string,unknown>, rows:JevActionCandidate[], resolveTool:(name:string)=>CapabilityTool|undefined, jev?:JevIntegrationInput):Promise<JevActionProposal>{ const safe=validateJevActionCandidates(rows,resolveTool); const candidates=safe.map(row=>({id:row.id,kind:"presentation-group" as const,hostEligible:true as const,title:`Call ${row.tool}`,description:row.rationale,nodeIds:[],estimatedNodeDelta:0,risk:row.risk==="safe"?"safe" as const:"review" as const})); const evaluation=await createResolvedJevWorkflowOptimizerEvaluator(await resolveJevIntegrationConfig(jev))(clean(state) as Record<string,unknown>,candidates); const selected=safe.map(row=>({...row,probability:evaluation.probabilities[row.id]??0})).filter(row=>row.probability>=.5).sort((a,b)=>b.probability-a.probability); const chosen=new Set(selected.map(row=>row.id)); return {kind:"mso.jev-action-proposal.v1",provider:"jev",selected,rejected:safe.filter(row=>!chosen.has(row.id)).map(row=>({id:row.id,probability:evaluation.probabilities[row.id]??0})),executable:false,instruction:"JEV selected structured action candidates only. Re-check live state and use jev_action execute explicitly; MSO capability scope, workflow, token allowlists, argument constraints, rate limits and audit remain authoritative."}; }+export async function executeJevAction(proposal:JevActionProposal, actionId:string, input:{scope:CapabilityRunContext["scope"];actor?:string;context?:CapabilityRunContext}, resolveTool:(name:string)=>CapabilityTool|undefined){ const action=proposal.selected.find(row=>row.id===actionId); if(!action) throw new Error("JEV action was not selected in this proposal"); const tool=resolveTool(action.tool); if(!tool) throw new Error("JEV action tool is no longer available"); if(tool.annotations?.destructiveHint || action.risk!=="safe") throw new Error("JEV action requires normal explicit tool confirmation; proposal cannot auto-execute it"); return executeCapabilityCall({tool,args:action.arguments,scope:input.scope,actor:input.actor,context:input.context}); }