π OpenHands: AI-Driven Development
feat: add VITE_LOAD_PUBLIC_SKILLS config to optionally disable public skills (#204)
Rohit Malhotra0fd9800e7484
diff --git a/.env.sample b/.env.sampleindex 6a79ee6509..8bcea86c04 100644--- a/.env.sample+++ b/.env.sample@@ -9,6 +9,7 @@ VITE_BACKEND_BASE_URL="http://127.0.0.1:8000" # Base URL used by browser-side di# VITE_WORKING_DIR="/workspace/project/agent-canvas" # Base dir for per-conversation working_dirs. Each conversation's working_dir is <VITE_WORKING_DIR>/<id_hex>. Defaults to <OH_CANVAS_SAFE_STATE_DIR>/workspaces, which is the sibling of the agent server's <state_dir>/conversations/ persistence dir β both share the same <id_hex> per conversation.# VITE_WORKER_URLS="" # Optional comma-separated worker URLs for the Browser tab# VITE_ENABLE_BROWSER_TOOLS="true" # Set to false to omit BrowserToolSet from new conversations+# VITE_LOAD_PUBLIC_SKILLS="true" # Set to false to disable loading public skills from https://github.com/OpenHands/extensions# Frontend dev serverVITE_FRONTEND_PORT="3001" # Port to run the frontend applicationdiff --git a/AGENTS.md b/AGENTS.mdindex 3f41c41c89..ccdfa079f1 100644--- a/AGENTS.md+++ b/AGENTS.md@@ -12,6 +12,7 @@- `VITE_WORKING_DIR` for the default workspace path sent when starting conversations.- `VITE_WORKER_URLS` as a comma-separated list of browser worker URLs if you want the Browser tab to probe exposed app hosts.- `VITE_ENABLE_BROWSER_TOOLS=false` to omit `BrowserToolSet` from new conversation payloads.+ - `VITE_LOAD_PUBLIC_SKILLS=false` to disable loading public skills from the OpenHands extensions marketplace (https://github.com/OpenHands/extensions). Defaults to true.- Default working-dir fallback is now the relative path `workspace/project` (exported as `DEFAULT_WORKING_DIR` from `src/api/agent-server-config.ts`); git-path heuristics and the default PLAN preview path should reuse that constant instead of hardcoding `/workspace/project`.- The UI keeps most OpenHands routes/layout intact, but hosted-only behavior (org, account management, integrations) has been removed via the fabricated OSS config because there is no separate app backend.- Verification command: `npm run typecheck && npm run build`.diff --git a/__tests__/api/agent-server-adapter.test.ts b/__tests__/api/agent-server-adapter.test.tsindex 28da05b8b4..e14f14682b 100644--- a/__tests__/api/agent-server-adapter.test.ts+++ b/__tests__/api/agent-server-adapter.test.ts@@ -21,6 +21,7 @@ vi.mock("#/api/agent-server-config", () => ({getAgentServerSessionApiKey: vi.fn(() => null),getAgentServerWorkingDir: mockGetAgentServerWorkingDir,getConfiguredWorkerUrls: vi.fn(() => []),+ shouldLoadPublicSkills: vi.fn(() => true),}));vi.mock("#/api/agent-server-compatibility", () => ({@@ -88,6 +89,10 @@ describe("buildStartConversationRequest", () => {{ name: "task_tracker", params: {} },{ name: "browser_tool_set", params: {} },]);+ expect(payload.agent.agent_context).toEqual({+ load_public_skills: true,+ load_user_skills: true,+ });expect(payload.agent.agent).toBeUndefined();expect(payload.workspace.working_dir).toBe("/workspace/project/agent-canvas",diff --git a/__tests__/api/agent-server-conversation-service.test.ts b/__tests__/api/agent-server-conversation-service.test.tsindex 4903f1e798..573c2eb578 100644--- a/__tests__/api/agent-server-conversation-service.test.ts+++ b/__tests__/api/agent-server-conversation-service.test.ts@@ -45,6 +45,7 @@ vi.mock("#/api/agent-server-config", () => ({(id: string) => `/state/workspaces/${id.replace(/-/g, "")}`,),getConfiguredWorkerUrls: vi.fn(() => []),+ shouldLoadPublicSkills: vi.fn(() => true),}));vi.mock("#/api/settings-service/settings-service.api", () => ({diff --git a/__tests__/api/use-create-conversation-metadata.test.ts b/__tests__/api/use-create-conversation-metadata.test.tsindex 70c9ff28e9..a78892ff2a 100644--- a/__tests__/api/use-create-conversation-metadata.test.ts+++ b/__tests__/api/use-create-conversation-metadata.test.ts@@ -32,6 +32,7 @@ vi.mock("#/api/agent-server-config", () => ({(id: string) => `/state/workspaces/${id.replace(/-/g, "")}`,),getConfiguredWorkerUrls: vi.fn(() => []),+ shouldLoadPublicSkills: vi.fn(() => true),}));vi.mock("#/api/settings-service/settings-service.api", () => ({diff --git a/scripts/dev-with-automation.mjs b/scripts/dev-with-automation.mjsindex c1238f320d..ef0c2727b4 100644--- a/scripts/dev-with-automation.mjs+++ b/scripts/dev-with-automation.mjs@@ -536,6 +536,8 @@ function startVite(config) {VITE_SESSION_API_KEY: config.sessionApiKey,// Automation API key for frontend to authenticate with automation backendVITE_AUTOMATION_API_KEY: config.localApiKey,+ // Session API key for agent-server auth (when SESSION_API_KEY is set)+ ...(config.sessionApiKey && { VITE_SESSION_API_KEY: config.sessionApiKey }),},color: c.magenta,});diff --git a/src/api/agent-server-adapter.ts b/src/api/agent-server-adapter.tsindex 5ad52abac1..c4122cbb7d 100644--- a/src/api/agent-server-adapter.ts+++ b/src/api/agent-server-adapter.ts@@ -2,7 +2,10 @@ import { DEFAULT_SETTINGS } from "#/services/settings";import { ExecutionStatus } from "#/types/agent-server/core";import { Settings, SettingsValue } from "#/types/settings";import { isAgentServerToolAvailable } from "./agent-server-compatibility";-import { getAgentServerWorkingDir } from "./agent-server-config";+import {+ getAgentServerWorkingDir,+ shouldLoadPublicSkills,+} from "./agent-server-config";import { getEffectiveLocalBackend } from "./backend-registry/active-store";import {GetHooksResponse,@@ -291,6 +294,10 @@ function createAgentFromSettings(agentSettings: SettingsRecord) {return {kind: "Agent",...agentSettings,+ agent_context: {+ load_public_skills: shouldLoadPublicSkills(),+ load_user_skills: true,+ },};}@@ -533,7 +540,7 @@ export async function loadSkillsForConversation(conversation?.workspace?.working_dir ?? getAgentServerWorkingDir();const response = await createSkillsClient().getSkills({- load_public: true,+ load_public: shouldLoadPublicSkills(),load_user: true,load_project: true,load_org: false,diff --git a/src/api/agent-server-config.ts b/src/api/agent-server-config.tsindex ef4e6944eb..c31e4e2780 100644--- a/src/api/agent-server-config.ts+++ b/src/api/agent-server-config.ts@@ -177,3 +177,13 @@ export function getAgentServerHeaders(): Record<string, string> {const sessionApiKey = getAgentServerSessionApiKey();return sessionApiKey ? { "X-Session-API-Key": sessionApiKey } : {};}++/**+ * Returns whether public skills from the OpenHands extensions marketplace+ * (https://github.com/OpenHands/extensions) should be loaded.+ *+ * Defaults to true. Set VITE_LOAD_PUBLIC_SKILLS=false to disable.+ */+export function shouldLoadPublicSkills(): boolean {+ return import.meta.env.VITE_LOAD_PUBLIC_SKILLS !== "false";+}diff --git a/src/api/skills-service.ts b/src/api/skills-service.tsindex 5f16902ccd..c7d2c13b47 100644--- a/src/api/skills-service.ts+++ b/src/api/skills-service.ts@@ -1,5 +1,8 @@import { SkillInfo } from "#/types/settings";-import { getAgentServerWorkingDir } from "./agent-server-config";+import {+ getAgentServerWorkingDir,+ shouldLoadPublicSkills,+} from "./agent-server-config";import { getActiveBackend } from "./backend-registry/active-store";import { fetchCloudSkills } from "./cloud/skills-service.api";import { createSkillsClient } from "./typescript-client";@@ -11,7 +14,7 @@ class SkillsService {}const response = await createSkillsClient().getSkills({- load_public: true,+ load_public: shouldLoadPublicSkills(),load_user: true,load_project: true,load_org: false,