🙌 OpenHands: AI-Driven Development
feat(agent-profiles): choose skills per profile from the server catalog (#18686)
simonrosenberg52a17b840a76
diff --git a/.pr/profile-skills-default-note.png b/.pr/profile-skills-default-note.pngnew file mode 100644index 0000000000..a66e8d7f22Binary files /dev/null and b/.pr/profile-skills-default-note.png differdiff --git a/.pr/profile-skills.png b/.pr/profile-skills.pngnew file mode 100644index 0000000000..54fe2f1ee8Binary files /dev/null and b/.pr/profile-skills.png differdiff --git a/__tests__/api/agent-profiles-service/profile-field-support.test.ts b/__tests__/api/agent-profiles-service/profile-field-support.test.tsindex 329bb2198c..21f23a18b5 100644--- a/__tests__/api/agent-profiles-service/profile-field-support.test.ts+++ b/__tests__/api/agent-profiles-service/profile-field-support.test.ts@@ -2,6 +2,7 @@ import { describe, expect, it, vi } from "vitest";import {agentProfileSupportsInstructions,agentProfileSupportsSecretRefs,+ agentProfileSupportsSkills,agentProfileSupportsTools,} from "#/api/agent-profiles-service/profile-field-support";@@ -15,6 +16,7 @@ describe.each([["agentProfileSupportsSecretRefs", agentProfileSupportsSecretRefs],["agentProfileSupportsInstructions", agentProfileSupportsInstructions],["agentProfileSupportsTools", agentProfileSupportsTools],+ ["agentProfileSupportsSkills", agentProfileSupportsSkills],])("%s", (_name, supports) => {it("is offered on a local backend", () => {mockBackendKind.mockReturnValue("local");diff --git a/__tests__/api/skills-service.test.ts b/__tests__/api/skills-service.test.tsindex 644b0ea640..e9298f7e92 100644--- a/__tests__/api/skills-service.test.ts+++ b/__tests__/api/skills-service.test.ts@@ -7,8 +7,9 @@ import {} from "#/api/backend-registry/active-store";import type { Backend } from "#/api/backend-registry/types";-const { mockGetSkills, MOCK_PUBLIC_CATALOG } = vi.hoisted(() => ({+const { mockGetSkills, mockGet, MOCK_PUBLIC_CATALOG } = vi.hoisted(() => ({mockGetSkills: vi.fn(),+ mockGet: vi.fn(),MOCK_PUBLIC_CATALOG: [{name: "mock-public-skill",@@ -22,6 +23,7 @@ const { mockGetSkills, MOCK_PUBLIC_CATALOG } = vi.hoisted(() => ({triggers: [],content: "more content",license: "MIT",+ category: "productivity",},],}));@@ -30,6 +32,9 @@ vi.mock("@openhands/typescript-client/clients", () => ({SkillsClient: vi.fn(function SkillsClientMock() {return { getSkills: mockGetSkills };}),+ AgentServerClient: vi.fn(function AgentServerClientMock() {+ return { get: mockGet };+ }),}));vi.mock("@openhands/extensions/skills", () => ({@@ -52,6 +57,7 @@ beforeEach(() => {setRegisteredBackends([localBackend]);setActiveSelection({ backendId: localBackend.id });mockGetSkills.mockReset();+ mockGet.mockReset();vi.mocked(SkillsClient).mockClear();});@@ -107,3 +113,67 @@ describe("SkillsService.getSkills against the agent-server backend", () => {expect(skills.every((s) => s.source === "public")).toBe(true);});});++describe("SkillsService.getSkillCatalog", () => {+ it("lists the server's catalog with the bundled display metadata", async () => {+ mockGet.mockResolvedValue({+ skills: [+ { name: "another-public-skill", type: "knowledge", origin: "public" },+ { name: "mine", type: "knowledge", origin: "user" },+ ],+ });++ const skills = await SkillsService.getSkillCatalog();++ expect(mockGet).toHaveBeenCalledWith(+ "/api/skills/catalog",+ expect.anything(),+ );+ expect(skills).toEqual([+ expect.objectContaining({+ name: "another-public-skill",+ origin: "public",+ source: "public",+ category: "productivity",+ license: "MIT",+ }),+ expect.objectContaining({ name: "mine", origin: "user" }),+ ]);+ expect(skills[1]).not.toHaveProperty("category");+ });++ it("falls back to the bundled catalog and user skills on an older server", async () => {+ mockGet.mockRejectedValue(+ Object.assign(new Error("Not Found"), { status: 404 }),+ );+ mockGetSkills.mockResolvedValue({+ skills: [+ { name: "mine", type: "knowledge", source: "user" },+ { name: "mock-public-skill", type: "knowledge", source: "user" },+ ],+ });++ const skills = await SkillsService.getSkillCatalog();++ expect(mockGetSkills.mock.calls[0]?.[0]).toMatchObject({+ load_public: false,+ load_user: true,+ load_project: false,+ });+ // A user skill shadows the public skill of the same name.+ expect(skills.map((s) => [s.name, s.origin])).toEqual([+ ["another-public-skill", "public"],+ ["mine", "user"],+ ["mock-public-skill", "user"],+ ]);+ });++ it("surfaces other failures instead of guessing", async () => {+ mockGet.mockRejectedValue(+ Object.assign(new Error("boom"), { status: 500 }),+ );++ await expect(SkillsService.getSkillCatalog()).rejects.toThrow("boom");+ expect(mockGetSkills).not.toHaveBeenCalled();+ });+});diff --git a/__tests__/components/backends/add-backend-modal.test.tsx b/__tests__/components/backends/add-backend-modal.test.tsxindex 50fd4f6cc8..64f5eb8e65 100644--- a/__tests__/components/backends/add-backend-modal.test.tsx+++ b/__tests__/components/backends/add-backend-modal.test.tsx@@ -83,7 +83,7 @@ beforeEach(() => {captureMock = vi.spyOn(telemetry, "trackEvent").mockResolvedValue(undefined);window.localStorage.clear();getServerInfoMock.mockReset();- getServerInfoMock.mockResolvedValue({ version: "1.52.0" });+ getServerInfoMock.mockResolvedValue({ version: "1.56.0" });deviceFlowMocks.startDeviceFlow.mockReset();deviceFlowMocks.startDeviceFlow.mockResolvedValue({device_code: "device-code",@@ -415,7 +415,7 @@ describe("AddBackendModal – connection chooser", () => {await user.click(screen.getByTestId("add-backend-submit"));expect(await screen.findByTestId("add-backend-error")).toHaveTextContent(- "Agent Canvas requires agent-server 1.51.0 or newer",+ "Agent Canvas requires agent-server 1.55.0 or newer",);expect(onClose).not.toHaveBeenCalled();});diff --git a/__tests__/components/backends/backend-form-modal.test.tsx b/__tests__/components/backends/backend-form-modal.test.tsxindex ca1a0e711c..1aeabc73c1 100644--- a/__tests__/components/backends/backend-form-modal.test.tsx+++ b/__tests__/components/backends/backend-form-modal.test.tsx@@ -73,7 +73,7 @@ function TestSeed({beforeEach(() => {window.localStorage.clear();getServerInfoMock.mockReset();- getServerInfoMock.mockResolvedValue({ version: "1.52.0" });+ getServerInfoMock.mockResolvedValue({ version: "1.56.0" });__resetActiveStoreForTests();});diff --git a/__tests__/components/backends/backend-selector.test.tsx b/__tests__/components/backends/backend-selector.test.tsxindex a9fd35839a..818d2e8bb6 100644--- a/__tests__/components/backends/backend-selector.test.tsx+++ b/__tests__/components/backends/backend-selector.test.tsx@@ -151,7 +151,7 @@ beforeEach(() => {vi.mocked(ServerClient).mockReset();vi.mocked(ServerClient).mockImplementation(function ServerClientMock() {return {- getServerInfo: vi.fn().mockResolvedValue({ version: "1.52.0" }),+ getServerInfo: vi.fn().mockResolvedValue({ version: "1.56.0" }),} as unknown as ServerClient;});vi.mocked(SettingsClient).mockReset();diff --git a/__tests__/components/backends/manage-backends-modal.test.tsx b/__tests__/components/backends/manage-backends-modal.test.tsxindex a981af831d..743d4cfbbc 100644--- a/__tests__/components/backends/manage-backends-modal.test.tsx+++ b/__tests__/components/backends/manage-backends-modal.test.tsx@@ -36,7 +36,7 @@ const deviceFlowMocks = vi.hoisted(() => ({pollForToken: vi.fn(),}));-const getServerInfoMock = vi.fn().mockResolvedValue({ version: "1.52.0" });+const getServerInfoMock = vi.fn().mockResolvedValue({ version: "1.56.0" });const getSettingsMock = vi.fn().mockResolvedValue({});vi.mock("@openhands/typescript-client/clients", () => ({@@ -164,7 +164,7 @@ beforeEach(() => {vi.spyOn(telemetry, "isTelemetryEnabled").mockReturnValue(true);window.localStorage.clear();getServerInfoMock.mockReset();- getServerInfoMock.mockResolvedValue({ version: "1.52.0" });+ getServerInfoMock.mockResolvedValue({ version: "1.56.0" });getSettingsMock.mockReset();getSettingsMock.mockResolvedValue({});vi.mocked(getCloudOrganizations).mockReset();@@ -260,7 +260,7 @@ describe("ManageBackendsModal", () => {);expect(screen.getByTestId("manage-backends-status-detail-Local"),- ).toHaveTextContent("Agent Canvas requires agent-server 1.51.0 or newer");+ ).toHaveTextContent("Agent Canvas requires agent-server 1.55.0 or newer");});// @spec BM-002 — Switching backends from Manage backends redirects adiff --git a/__tests__/components/onboarding/onboarding-modal.test.tsx b/__tests__/components/onboarding/onboarding-modal.test.tsxindex 00e292092e..fe3435269c 100644--- a/__tests__/components/onboarding/onboarding-modal.test.tsx+++ b/__tests__/components/onboarding/onboarding-modal.test.tsx@@ -280,7 +280,7 @@ beforeEach(() => {if (options?.host?.startsWith("https://127.0.0.1:8000")) {return Promise.reject(new Error("Failed to fetch"));}- return Promise.resolve({ version: "1.52.0" });+ return Promise.resolve({ version: "1.56.0" });});// ChooseAgentStep's Next button now persists the selection via// saveSettings before advancing. Stub it so the rest of the flowdiff --git a/__tests__/components/settings/agent-profiles/agent-profiles-local-view.test.tsx b/__tests__/components/settings/agent-profiles/agent-profiles-local-view.test.tsxindex acfe439605..b1252a1de0 100644--- a/__tests__/components/settings/agent-profiles/agent-profiles-local-view.test.tsx+++ b/__tests__/components/settings/agent-profiles/agent-profiles-local-view.test.tsx@@ -109,12 +109,22 @@ vi.mock("#/hooks/query/use-llm-profiles", () => ({useLlmProfiles: () => ({ data: llmProfilesData }),}));+let settingsData: { enabled_skills?: string[]; disabled_skills?: string[] };+vi.mock("#/hooks/query/use-settings", () => ({+ useSettings: () => ({ data: settingsData }),+}));+vi.mock("#/contexts/settings-section-header-context", () => ({useSettingsSectionHeader: () => ({ setHideSectionHeader: vi.fn() }),}));vi.mock("#/utils/custom-toast-handlers");+const profileSupportsSkillsMock = vi.hoisted(() => vi.fn(() => true));+vi.mock("#/api/agent-profiles-service/profile-field-support", () => ({+ agentProfileSupportsSkills: () => profileSupportsSkillsMock(),+}));+vi.mock("#/api/agent-profiles-service/agent-profiles-service.api", () => ({__esModule: true,default: { getProfile: vi.fn(), renameProfile: vi.fn() },@@ -140,6 +150,42 @@ describe("AgentProfilesLocalView save mapping", () => {profiles: [{ name: "default", model: "gpt-5" }],active_profile: "default",};+ settingsData = {};+ profileSupportsSkillsMock.mockReturnValue(true);+ });++ it("opens a new profile on the skills selected on the Skills page", async () => {+ settingsData = { enabled_skills: ["add-skill"], disabled_skills: ["mine"] };++ render(<AgentProfilesLocalView />);+ await openCreateAndName("my-agent");++ const override = JSON.parse(+ screen+ .getByTestId("mock-agent-settings")+ .getAttribute("data-override") as string,+ );+ expect(override).toMatchObject({+ agent_kind: "openhands",+ public_skills: ["add-skill"],+ disabled_skills: ["mine"],+ });+ });++ it("opens a new profile without a skill list on a cloud backend", async () => {+ profileSupportsSkillsMock.mockReturnValue(false);+ settingsData = { enabled_skills: ["add-skill"], disabled_skills: ["mine"] };++ render(<AgentProfilesLocalView />);+ await openCreateAndName("my-agent");++ expect(+ JSON.parse(+ screen+ .getByTestId("mock-agent-settings")+ .getAttribute("data-override") as string,+ ),+ ).toEqual({ agent_kind: "openhands" });});it("describes the add editor with agent copy, not the LLM-profile hint", async () => {diff --git a/__tests__/hooks/query/use-backends-health.test.tsx b/__tests__/hooks/query/use-backends-health.test.tsxindex 095327efea..2541b3af82 100644--- a/__tests__/hooks/query/use-backends-health.test.tsx+++ b/__tests__/hooks/query/use-backends-health.test.tsx@@ -68,7 +68,7 @@ function wrapper({ children }: { children: React.ReactNode }) {beforeEach(() => {getSettingsMock.mockReset();getServerInfoMock.mockReset();- getServerInfoMock.mockResolvedValue({ version: "1.52.0" });+ getServerInfoMock.mockResolvedValue({ version: "1.56.0" });getCurrentCloudApiKeyMock.mockReset();getCloudOrganizationsMock.mockReset();vi.mocked(ServerClient).mockClear();@@ -112,7 +112,7 @@ describe("useBackendsHealth", () => {expect(result.current[localBackend.id]).toMatchObject({isConnected: false,lastError:- "Agent Canvas requires agent-server 1.51.0 or newer; this backend is running 1.27.1. Please upgrade the agent-server backend.",+ "Agent Canvas requires agent-server 1.55.0 or newer; this backend is running 1.27.1. Please upgrade the agent-server backend.",}),// Failing probes now retry a couple of times before settling.{ timeout: 3000 },diff --git a/__tests__/root.test.tsx b/__tests__/root.test.tsxindex 3e3451c37f..1924ee5d63 100644--- a/__tests__/root.test.tsx+++ b/__tests__/root.test.tsx@@ -210,7 +210,7 @@ describe("App root agent-server availability guard", () => {it("lets root-level onboarding navigate to the launched conversation before closing", async () => {server.use(http.get("*/server_info", () =>- HttpResponse.json({ uptime: 0, idle_time: 0, version: "1.52.0" }),+ HttpResponse.json({ uptime: 0, idle_time: 0, version: "1.56.0" }),),);@@ -359,7 +359,7 @@ describe("App root agent-server availability guard", () => {}),),http.get("*/server_info", () =>- HttpResponse.json({ uptime: 0, idle_time: 0, version: "1.52.0" }),+ HttpResponse.json({ uptime: 0, idle_time: 0, version: "1.56.0" }),),);@@ -415,7 +415,7 @@ describe("App root agent-server availability guard", () => {}),),http.get("*/server_info", () =>- HttpResponse.json({ uptime: 0, idle_time: 0, version: "1.52.0" }),+ HttpResponse.json({ uptime: 0, idle_time: 0, version: "1.56.0" }),),);@@ -681,7 +681,7 @@ describe("App root agent-server availability guard", () => {}),),http.get("*/server_info", () =>- HttpResponse.json({ uptime: 0, idle_time: 0, version: "1.52.0" }),+ HttpResponse.json({ uptime: 0, idle_time: 0, version: "1.56.0" }),),);diff --git a/__tests__/routes/agent-settings.test.tsx b/__tests__/routes/agent-settings.test.tsxindex 81dce758f4..267a484cb9 100644--- a/__tests__/routes/agent-settings.test.tsx+++ b/__tests__/routes/agent-settings.test.tsx@@ -10,8 +10,9 @@ import {} from "#/routes/agent-settings";import SettingsService from "#/api/settings-service/settings-service.api";import { SecretsService } from "#/api/secrets-service";+import SkillsService from "#/api/skills-service";import { MOCK_DEFAULT_USER_SETTINGS } from "#/mocks/handlers";-import { Settings } from "#/types/settings";+import { Settings, SkillInfo } from "#/types/settings";import {ACP_PROVIDERS,ACP_VERTEX_SAFE_MODEL,@@ -53,9 +54,11 @@ const CLAUDE_MODELS = [const profileSupportsSecretRefsMock = vi.hoisted(() => vi.fn(() => true));const profileSupportsInstructionsMock = vi.hoisted(() => vi.fn(() => false));+const profileSupportsSkillsMock = vi.hoisted(() => vi.fn(() => true));vi.mock("#/api/agent-profiles-service/profile-field-support", () => ({agentProfileSupportsSecretRefs: () => profileSupportsSecretRefsMock(),agentProfileSupportsInstructions: () => profileSupportsInstructionsMock(),+ agentProfileSupportsSkills: () => profileSupportsSkillsMock(),agentProfileSupportsTools: () => true,}));@@ -1411,6 +1414,129 @@ describe("AgentSettingsScreen — MCP scope dirty tracking", () => {});});+describe("AgentSettingsScreen — skills", () => {+ const CATALOG: SkillInfo[] = [+ { name: "alpha", type: "knowledge", source: null, origin: "public" },+ { name: "beta", type: "knowledge", source: null, origin: "public" },+ { name: "mine", type: "knowledge", source: null, origin: "user" },+ ];++ beforeEach(() => {+ vi.restoreAllMocks();+ vi.spyOn(SettingsService, "getSettings").mockResolvedValue(buildSettings());+ vi.spyOn(SecretsService, "getSecrets").mockResolvedValue([]);+ vi.spyOn(SkillsService, "getSkillCatalog").mockResolvedValue(CATALOG);+ profileSupportsSkillsMock.mockReturnValue(true);+ acpAuthStatusMock.mockReturnValue({+ status: "unknown",+ isChecking: false,+ isSupported: true,+ });+ acpModelDiscoveryMock.mockReturnValue(NO_DISCOVERY);+ });++ it("opens on the stored list and saves an edit to it", async () => {+ let control: AgentSettingsSaveControl | null = null;+ renderAgentSettingsScreen({+ agentSettingsOverride: {+ agent_kind: "openhands",+ public_skills: ["alpha"],+ disabled_skills: [],+ },+ onSaveControlChange: (next) => {+ control = next;+ },+ });+ const beta = await screen.findByTestId("agent-settings-skills-beta");+ expect(screen.getByTestId("agent-settings-skills-alpha")).toBeChecked();+ expect(beta).not.toBeChecked();+ expect(screen.getByTestId("agent-settings-skills-mine")).toBeChecked();++ const user = userEvent.setup();+ await user.click(beta);+ await user.click(screen.getByTestId("agent-settings-skills-mine"));++ await waitFor(() => expect(control!.isDirty).toBe(true));+ expect(control!.buildAgentProfileFields()).toMatchObject({+ public_skills: ["alpha", "beta"],+ disabled_skills: ["mine"],+ });+ });++ it("keeps a profile without a list unset until the user edits it", async () => {+ let control: AgentSettingsSaveControl | null = null;+ renderAgentSettingsScreen({+ agentSettingsOverride: {+ agent_kind: "openhands",+ public_skills: null,+ disabled_skills: [],+ },+ onSaveControlChange: (next) => {+ control = next;+ },+ });++ // No stored list loads every catalog skill.+ expect(+ await screen.findByTestId("agent-settings-skills-beta"),+ ).toBeChecked();+ expect(control!.isDirty).toBe(false);+ expect(control!.buildAgentProfileFields()).not.toHaveProperty(+ "public_skills",+ );+ });++ it("hides skills and leaves them out of the save on a cloud backend", async () => {+ profileSupportsSkillsMock.mockReturnValue(false);+ let control: AgentSettingsSaveControl | null = null;+ renderAgentSettingsScreen({+ agentSettingsOverride: {+ agent_kind: "openhands",+ public_skills: ["alpha"],+ disabled_skills: [],+ },+ onSaveControlChange: (next) => {+ control = next;+ },+ });++ await screen.findByTestId("agent-settings-screen");+ await waitFor(() => expect(control).not.toBeNull());+ expect(+ screen.queryByTestId("agent-settings-skills-section"),+ ).not.toBeInTheDocument();+ expect(SkillsService.getSkillCatalog).not.toHaveBeenCalled();+ expect(control!.buildAgentProfileFields()).not.toHaveProperty(+ "public_skills",+ );+ });++ it("points the default profile to the Skills page", async () => {+ let control: AgentSettingsSaveControl | null = null;+ renderAgentSettingsScreen({+ agentSettingsOverride: {+ agent_kind: "openhands",+ public_skills: ["alpha"],+ disabled_skills: [],+ },+ isDefaultProfile: true,+ onSaveControlChange: (next) => {+ control = next;+ },+ });++ expect(+ await screen.findByTestId("agent-settings-skills-default-profile"),+ ).toHaveTextContent("SETTINGS$AGENT_PROFILE_SKILLS_DEFAULT_PROFILE");+ expect(+ screen.queryByTestId("agent-settings-skills-list"),+ ).not.toBeInTheDocument();+ expect(control!.buildAgentProfileFields()).not.toHaveProperty(+ "public_skills",+ );+ });+});+describe("AgentSettingsScreen — system prompt", () => {beforeEach(() => {vi.restoreAllMocks();diff --git a/__tests__/utils/skill-enablement.test.ts b/__tests__/utils/skill-enablement.test.tsindex 93e7821018..194ec1597f 100644--- a/__tests__/utils/skill-enablement.test.ts+++ b/__tests__/utils/skill-enablement.test.ts@@ -9,7 +9,9 @@ import {isCatalogSkill,isRecommendedSkill,migrateSkillEnablement,+ publicSkillTest,resolveEnabledCatalogSkills,+ toggleSkill,toSkillEnablement,} from "#/utils/skill-enablement";@@ -159,3 +161,44 @@ describe("findInvokedCatalogSkill", () => {expect(findInvokedCatalogSkill("/not-a-real-skill")).toBeUndefined();});});++describe("toggleSkill", () => {+ const isPublic = (name: string) => name !== LOCAL;++ it("moves a catalog skill in the allow-list and any other in the deny-list", () => {+ const start = { enabledSkills: [RECOMMENDED], disabledSkills: [] };++ expect(toggleSkill(start, OPTIONAL, true, isPublic)).toEqual({+ enabledSkills: [RECOMMENDED, OPTIONAL],+ disabledSkills: [],+ });+ expect(toggleSkill(start, LOCAL, false, isPublic)).toEqual({+ enabledSkills: [RECOMMENDED],+ disabledSkills: [LOCAL],+ });+ });++ it("drops a re-enabled catalog skill from the deny-list", () => {+ expect(+ toggleSkill(+ { enabledSkills: [], disabledSkills: [OPTIONAL] },+ OPTIONAL,+ true,+ isPublic,+ ),+ ).toEqual({ enabledSkills: [OPTIONAL], disabledSkills: [] });+ });+});++describe("publicSkillTest", () => {+ it("follows the server's origins, falling back to the bundled catalog", () => {+ const fromServer = publicSkillTest([+ { name: LOCAL, type: "knowledge", source: null, origin: "public" },+ { name: OPTIONAL, type: "knowledge", source: null, origin: "user" },+ ]);++ expect(fromServer(LOCAL)).toBe(true);+ expect(fromServer(OPTIONAL)).toBe(false);+ expect(publicSkillTest(undefined)(OPTIONAL)).toBe(true);+ });+});diff --git a/config/defaults.json b/config/defaults.jsonindex 58b3dda713..86bab4889d 100644--- a/config/defaults.json+++ b/config/defaults.json@@ -6,7 +6,7 @@"automation": "1.22.0"},"compatibility": {- "minimumAgentServer": "1.51.0"+ "minimumAgentServer": "1.55.0"},"images": {"agentServer": "ghcr.io/openhands/agent-server",diff --git a/docs/ACP_AGENTS.md b/docs/ACP_AGENTS.mdindex aed79f6ba6..f4b9eb668d 100644--- a/docs/ACP_AGENTS.md+++ b/docs/ACP_AGENTS.md@@ -176,11 +176,11 @@ point Canvas at it). In short:# canvas_ui_control calls use client_tools; the Python mount keeps# pre-migration conversations loadable when persisted metadata imports# canvas_ui_tool.-# Minimum image: 1.51.0-python (Canvas's minimumAgentServer, including the+# Minimum image: 1.55.0-python (Canvas's minimumAgentServer, including the# managed Canvas App backend bridge). Override SHA with a newer build.docker run -d --name oh-acp -p 8010:8000 -v acp-data:/workspace \-v "$(pwd)/tools:/canvas-tools:ro" -e OH_EXTRA_PYTHON_PATH=/canvas-tools \- ghcr.io/openhands/agent-server:1.51.0-python+ ghcr.io/openhands/agent-server:1.55.0-python# 2. Canvas pointed at the container.VITE_BACKEND_BASE_URL=http://localhost:8010 npm run dev:frontenddiff --git a/src/api/agent-profiles-service/profile-field-support.ts b/src/api/agent-profiles-service/profile-field-support.tsindex 16b6b5d31b..939830accb 100644--- a/src/api/agent-profiles-service/profile-field-support.ts+++ b/src/api/agent-profiles-service/profile-field-support.ts@@ -14,3 +14,8 @@ export function agentProfileSupportsInstructions(): boolean {export function agentProfileSupportsTools(): boolean {return getActiveBackend().backend.kind !== "cloud";}++/** Local only: cloud loads skills from its own catalog. */+export function agentProfileSupportsSkills(): boolean {+ return getActiveBackend().backend.kind !== "cloud";+}diff --git a/src/api/agent-server-compatibility.test.ts b/src/api/agent-server-compatibility.test.tsindex 7685e7e0b7..44199df1ec 100644--- a/src/api/agent-server-compatibility.test.ts+++ b/src/api/agent-server-compatibility.test.ts@@ -81,7 +81,7 @@ describe("agent-server version compatibility", () => {});});- it.each(["0.99.99", "1.27.999", "1.50.1", "1.51.0-rc.1"])(+ it.each(["0.99.99", "1.27.999", "1.54.0", "1.55.0-rc.1"])("rejects older version %s",(version) => {const error = getThrownError(() =>@@ -99,10 +99,10 @@ describe("agent-server version compatibility", () => {it.each([MINIMUM_COMPATIBLE_AGENT_SERVER_VERSION,- "1.51.1",- "1.52.0",+ "1.55.1",+ "1.56.0","2.0.0",- " v1.51.0+build.7 ",+ " v1.55.0+build.7 ",])("accepts compatible version %s", (version) => {expect(() =>assertAgentServerVersionIsSupported(serverInfo(version)),diff --git a/src/api/skills-service.ts b/src/api/skills-service.tsindex 496ac4d19a..c6c7b8d2bc 100644--- a/src/api/skills-service.ts+++ b/src/api/skills-service.ts@@ -1,9 +1,12 @@-import { SkillsClient } from "@openhands/typescript-client/clients";+import {+ AgentServerClient,+ SkillsClient,+} from "@openhands/typescript-client/clients";import {SKILLS_CATALOG,type SkillCatalogEntry,} from "@openhands/extensions/skills";-import { SkillInfo } from "#/types/settings";+import { SkillInfo, SkillOrigin } from "#/types/settings";import { getAgentServerWorkingDir } from "./agent-server-config";import { getActiveBackend } from "./backend-registry/active-store";import {@@ -36,6 +39,45 @@ function catalogEntryToSkillInfo(entry: SkillCatalogEntry): SkillInfo {*/const PUBLIC_SKILLS: SkillInfo[] = SKILLS_CATALOG.map(catalogEntryToSkillInfo);+const BUNDLED_BY_NAME = new Map(SKILLS_CATALOG.map((e) => [e.name, e]));++export const SKILL_CATALOG_PATH = "/api/skills/catalog";++function isRecord(value: unknown): value is Record<string, unknown> {+ return typeof value === "object" && value !== null && !Array.isArray(value);+}++function isOrigin(value: unknown): value is SkillOrigin {+ return value === "public" || value === "user";+}++/** A server entry, with the bundled catalog's display metadata for public skills. */+function toCatalogSkill(entry: unknown): SkillInfo {+ if (+ !isRecord(entry) ||+ typeof entry.name !== "string" ||+ !isOrigin(entry.origin)+ ) {+ throw new Error("The agent server returned a malformed skill catalog.");+ }+ const skill = entry as unknown as SkillInfo;+ if (skill.origin !== "public") return skill;+ // Shown as the catalog, as the bundled entries are, rather than a server path.+ const listed = { ...skill, source: "public" };+ const bundled = BUNDLED_BY_NAME.get(skill.name);+ if (!bundled) return listed;+ return {+ ...listed,+ category: bundled.category,+ license: skill.license ?? bundled.license ?? null,+ compatibility: skill.compatibility ?? bundled.compatibility ?? null,+ };+}++function hasStatus(error: unknown, status: number): boolean {+ return isRecord(error) && error.status === status;+}+class SkillsService {static async getSkills(projectDir?: string): Promise<SkillInfo[]> {if (getActiveBackend().backend.kind === "cloud") {@@ -66,6 +108,46 @@ class SkillsService {return [...localSkills, ...PUBLIC_SKILLS];}+ /**+ * Skills an agent profile can select on this server. Repo skills load only+ * when a conversation opens its workspace, so they are not listed.+ */+ static async getSkillCatalog(): Promise<SkillInfo[]> {+ const { host, apiKey } = getAgentServerClientOptions();+ try {+ const data = await new AgentServerClient({ host, apiKey }).get<unknown>(+ SKILL_CATALOG_PATH,+ { acceptableStatusCodes: new Set([200]), responseType: "json" },+ );+ const skills = isRecord(data) ? data.skills : undefined;+ if (!Array.isArray(skills)) {+ throw new Error("The agent server returned a malformed skill catalog.");+ }+ return skills.map(toCatalogSkill);+ } catch (error) {+ if (!hasStatus(error, 404)) throw error;+ }+ // Servers before the catalog endpoint: the bundled catalog plus user skills.+ const response = await new SkillsClient(+ getAgentServerClientOptions(),+ ).getSkills({+ load_public: false,+ load_user: true,+ load_project: false,+ load_org: false,+ });+ const userSkills = ((response.skills ?? []) as SkillInfo[]).map(+ (skill) => ({ ...skill, origin: "user" as const }),+ );+ const userNames = new Set(userSkills.map((skill) => skill.name));+ return [+ ...PUBLIC_SKILLS.filter((skill) => !userNames.has(skill.name)).map(+ (skill) => ({ ...skill, origin: "public" as const }),+ ),+ ...userSkills,+ ];+ }+/*** Skills loaded into a running cloud conversation (see* `fetchCloudConversationSkills`). Cloud-only: local conversations keepdiff --git a/src/components/features/settings/agent-profiles/agent-profiles-local-view.tsx b/src/components/features/settings/agent-profiles/agent-profiles-local-view.tsxindex de4276692f..2aa98d38ee 100644--- a/src/components/features/settings/agent-profiles/agent-profiles-local-view.tsx+++ b/src/components/features/settings/agent-profiles/agent-profiles-local-view.tsx@@ -20,6 +20,7 @@ import { useSaveAgentProfile } from "#/hooks/mutation/use-save-agent-profile";import { useRenameAgentProfile } from "#/hooks/mutation/use-rename-agent-profile";import { useAgentProfiles } from "#/hooks/query/use-agent-profiles";import { useLlmProfiles } from "#/hooks/query/use-llm-profiles";+import { useSettings } from "#/hooks/query/use-settings";import {displayErrorToast,displaySuccessToast,@@ -32,6 +33,11 @@ import { BackNavButton } from "#/components/shared/buttons/back-nav-button";import { Typography } from "#/ui/typography";import { useSettingsSectionHeader } from "#/contexts/settings-section-header-context";import { parseCommand } from "#/utils/acp-command";+import { agentProfileSupportsSkills } from "#/api/agent-profiles-service/profile-field-support";+import {+ defaultSkillEnablement,+ toProfileSkillFields,+} from "#/utils/skill-enablement";type ViewMode = "list" | "create" | "edit";@@ -61,6 +67,10 @@ function toAgentSettingsOverride(tools: (profile.tools as SettingsValue) ?? null,tool_concurrency_limit: profile.tool_concurrency_limit,secret_refs: secretRefs,+ public_skills:+ (profile as { public_skills?: string[] | null }).public_skills ?? null,+ disabled_skills:+ (profile as { disabled_skills?: string[] }).disabled_skills ?? [],persona: profile.persona ?? null,system_message_suffix: profile.system_message_suffix ?? null,};@@ -80,6 +90,7 @@ export function AgentProfilesLocalView() {const { data: profilesData } = useAgentProfiles();const { data: llmProfilesData, isLoading: isLlmProfilesLoading } =useLlmProfiles();+ const { data: settings } = useSettings();const [viewMode, setViewMode] = useState<ViewMode>("list");const [profileName, setProfileName] = useState("");@@ -123,11 +134,17 @@ export function AgentProfilesLocalView() {const handleAddProfile = useCallback(() => {setProfileName("");setEditingProfile(null);- setOverride({ agent_kind: "openhands" });+ // A new profile starts from the skills selected on the Skills page.+ setOverride({+ agent_kind: "openhands",+ ...(agentProfileSupportsSkills()+ ? toProfileSkillFields(defaultSkillEnablement(settings ?? {}))+ : {}),+ });setLlmProfileRef(defaultLlmProfileRef);setSaveControl(null);setViewMode("create");- }, [defaultLlmProfileRef]);+ }, [defaultLlmProfileRef, settings]);const handleEditProfile = useCallback(async (summary: AgentProfileSummary) => {diff --git a/src/hooks/query/query-keys.ts b/src/hooks/query/query-keys.tsindex 375e05c1b4..5738716b1d 100644--- a/src/hooks/query/query-keys.ts+++ b/src/hooks/query/query-keys.ts@@ -41,6 +41,10 @@ export const TOOL_CATALOG_QUERY_KEYS = {all: ["tool-catalog"] as const,} as const;+export const SKILL_CATALOG_QUERY_KEYS = {+ all: ["skill-catalog"] as const,+} as const;+export const PROVIDER_CONNECTIONS_QUERY_KEYS = {all: ["provider-connections"] as const,} as const;diff --git a/src/hooks/query/use-skill-catalog.ts b/src/hooks/query/use-skill-catalog.tsnew file mode 100644index 0000000000..34ff50737e--- /dev/null+++ b/src/hooks/query/use-skill-catalog.ts@@ -0,0 +1,27 @@+import { useQuery } from "@tanstack/react-query";++import SkillsService from "#/api/skills-service";+import { useActiveBackend } from "#/contexts/active-backend-context";+import {+ AGENT_PROFILES_RETRY_OPTIONS,+ CONFIG_CACHE_OPTIONS,+ SKILL_CATALOG_QUERY_KEYS,+} from "#/hooks/query/query-keys";++interface UseSkillCatalogOptions {+ enabled?: boolean;+}++/** Skills a local backend's agent profiles can select. */+export function useSkillCatalog(options: UseSkillCatalogOptions = {}) {+ const { backend } = useActiveBackend();++ return useQuery({+ queryKey: [...SKILL_CATALOG_QUERY_KEYS.all, backend.id, backend.host],+ queryFn: SkillsService.getSkillCatalog,+ enabled: (options.enabled ?? true) && backend.kind !== "cloud",+ ...CONFIG_CACHE_OPTIONS,+ ...AGENT_PROFILES_RETRY_OPTIONS,+ meta: { disableToast: true },+ });+}diff --git a/src/i18n/translation.json b/src/i18n/translation.jsonindex d9c05f45b1..6aef32fb6c 100644--- a/src/i18n/translation.json+++ b/src/i18n/translation.json@@ -52234,5 +52234,113 @@"tr": "Bu yerel arka uç eklenti parametrelerini desteklemiyor. Sohbet başlatmadan önce parametreleri başlatma bağlantısından kaldırın.","uk": "Цей локальний сервер не підтримує параметри плагінів. Видаліть параметри з посилання запуску перед початком розмови.","id": "Backend lokal ini tidak mendukung parameter plugin. Hapus parameter dari tautan peluncuran sebelum memulai percakapan."+ },+ "SETTINGS$AGENT_PROFILE_SKILLS": {+ "en": "Skills",+ "ja": "スキル",+ "zh-CN": "技能",+ "zh-TW": "技能",+ "ko-KR": "스킬",+ "no": "Ferdigheter",+ "ar": "المهارات",+ "de": "Fähigkeiten",+ "fr": "Compétences",+ "it": "Competenze",+ "pt": "Habilidades",+ "es": "Habilidades",+ "tr": "Yetenekler",+ "uk": "Навички",+ "ca": "Habilitats",+ "id": "Skill"+ },+ "SETTINGS$AGENT_PROFILE_SKILLS_LOAD_FAILED": {+ "en": "Could not load the server's skills.",+ "ja": "サーバーのスキルを読み込めませんでした。",+ "zh-CN": "无法加载服务器的技能。",+ "zh-TW": "無法載入伺服器的技能。",+ "ko-KR": "서버의 스킬을 불러올 수 없습니다.",+ "no": "Kunne ikke laste inn serverens ferdigheter.",+ "ar": "تعذّر تحميل مهارات الخادم.",+ "de": "Die Fähigkeiten des Servers konnten nicht geladen werden.",+ "fr": "Impossible de charger les compétences du serveur.",+ "it": "Impossibile caricare le competenze del server.",+ "pt": "Não foi possível carregar as habilidades do servidor.",+ "es": "No se pudieron cargar las habilidades del servidor.",+ "tr": "Sunucunun yetenekleri yüklenemedi.",+ "uk": "Не вдалося завантажити навички сервера.",+ "ca": "No s'han pogut carregar les habilitats del servidor.",+ "id": "Tidak dapat memuat skill dari server."+ },+ "SETTINGS$SKILL_ORIGIN_PUBLIC": {+ "en": "Catalog",+ "ja": "カタログ",+ "zh-CN": "目录",+ "zh-TW": "目錄",+ "ko-KR": "카탈로그",+ "no": "Katalog",+ "ar": "الكتالوج",+ "de": "Katalog",+ "fr": "Catalogue",+ "it": "Catalogo",+ "pt": "Catálogo",+ "es": "Catálogo",+ "tr": "Katalog",+ "uk": "Каталог",+ "ca": "Catàleg",+ "id": "Katalog"+ },+ "SETTINGS$SKILL_ORIGIN_USER": {+ "en": "Your skill",+ "ja": "あなたのスキル",+ "zh-CN": "你的技能",+ "zh-TW": "你的技能",+ "ko-KR": "내 스킬",+ "no": "Din ferdighet",+ "ar": "مهارتك",+ "de": "Deine Fähigkeit",+ "fr": "Votre compétence",+ "it": "La tua competenza",+ "pt": "Sua habilidade",+ "es": "Tu habilidad",+ "tr": "Senin yeteneğin",+ "uk": "Ваша навичка",+ "ca": "La teva habilitat",+ "id": "Skill Anda"+ },+ "SETTINGS$AGENT_PROFILE_SKILLS_HINT": {+ "en": "This agent loads the skills switched on here. New profiles start from the skills selected on the Skills page. Skills from a repository always load.",+ "ja": "このエージェントは、ここでオンにしたスキルを読み込みます。新しいプロファイルはスキルページで選択したスキルから始まります。リポジトリのスキルは常に読み込まれます。",+ "zh-CN": "此代理会加载此处开启的技能。新配置文件从技能页面上选择的技能开始。仓库中的技能始终会加载。",+ "zh-TW": "此代理會載入此處開啟的技能。新設定檔從技能頁面上選取的技能開始。存放庫中的技能一律會載入。",+ "ko-KR": "이 에이전트는 여기에서 켠 스킬을 불러옵니다. 새 프로필은 스킬 페이지에서 선택한 스킬로 시작합니다. 저장소의 스킬은 항상 불러옵니다.",+ "no": "Denne agenten laster inn ferdighetene som er slått på her. Nye profiler starter med ferdighetene som er valgt på Ferdigheter-siden. Ferdigheter fra et repository lastes alltid inn.",+ "it": "Questo agente carica le competenze attivate qui. I nuovi profili partono dalle competenze selezionate nella pagina Competenze. Le competenze di un repository vengono sempre caricate.",+ "pt": "Este agente carrega as habilidades ativadas aqui. Novos perfis começam com as habilidades selecionadas na página Habilidades. As habilidades de um repositório são sempre carregadas.",+ "es": "Este agente carga las habilidades activadas aquí. Los perfiles nuevos parten de las habilidades seleccionadas en la página Habilidades. Las habilidades de un repositorio siempre se cargan.",+ "ar": "يحمّل هذا الوكيل المهارات المفعّلة هنا. تبدأ ملفات التعريف الجديدة من المهارات المحددة في صفحة المهارات. تُحمَّل مهارات المستودع دائمًا.",+ "fr": "Cet agent charge les compétences activées ici. Les nouveaux profils partent des compétences sélectionnées sur la page Compétences. Les compétences d'un dépôt sont toujours chargées.",+ "tr": "Bu ajan, burada açılan yetenekleri yükler. Yeni profiller Yetenekler sayfasında seçilen yeteneklerle başlar. Bir depodaki yetenekler her zaman yüklenir.",+ "de": "Dieser Agent lädt die hier aktivierten Fähigkeiten. Neue Profile beginnen mit den auf der Seite „Fähigkeiten“ ausgewählten Fähigkeiten. Fähigkeiten aus einem Repository werden immer geladen.",+ "uk": "Цей агент завантажує ввімкнені тут навички. Нові профілі починаються з навичок, вибраних на сторінці «Навички». Навички з репозиторію завантажуються завжди.",+ "ca": "Aquest agent carrega les habilitats activades aquí. Els perfils nous parteixen de les habilitats seleccionades a la pàgina Habilitats. Les habilitats d'un repositori sempre es carreguen.",+ "id": "Agen ini memuat skill yang diaktifkan di sini. Profil baru dimulai dari skill yang dipilih di halaman Skill. Skill dari repositori selalu dimuat."+ },+ "SETTINGS$AGENT_PROFILE_SKILLS_DEFAULT_PROFILE": {+ "en": "The default profile always launches with the skills selected on the Skills page. Create a named profile to choose its own.",+ "ja": "デフォルトのプロファイルは常にスキルページで選択したスキルで起動します。独自に選ぶには、名前付きのプロファイルを作成してください。",+ "zh-CN": "默认配置文件始终使用技能页面上选择的技能启动。如需单独选择,请创建一个命名配置文件。",+ "zh-TW": "預設設定檔一律以技能頁面上選取的技能啟動。若要單獨選擇,請建立具名設定檔。",+ "ko-KR": "기본 프로필은 항상 스킬 페이지에서 선택한 스킬로 시작됩니다. 따로 선택하려면 이름이 있는 프로필을 만드세요.",+ "no": "Standardprofilen starter alltid med ferdighetene som er valgt på Ferdigheter-siden. Opprett en navngitt profil for å velge egne.",+ "it": "Il profilo predefinito si avvia sempre con le competenze selezionate nella pagina Competenze. Crea un profilo con nome per sceglierne di proprie.",+ "pt": "O perfil padrão sempre inicia com as habilidades selecionadas na página Habilidades. Crie um perfil com nome para escolher as suas.",+ "es": "El perfil predeterminado siempre se inicia con las habilidades seleccionadas en la página Habilidades. Crea un perfil con nombre para elegir las suyas.",+ "ar": "يبدأ الملف الشخصي الافتراضي دائمًا بالمهارات المحددة في صفحة المهارات. أنشئ ملفًا شخصيًا باسم لاختيار مهاراته الخاصة.",+ "fr": "Le profil par défaut démarre toujours avec les compétences sélectionnées sur la page Compétences. Créez un profil nommé pour choisir les siennes.",+ "tr": "Varsayılan profil her zaman Yetenekler sayfasında seçilen yeteneklerle başlar. Kendi yeteneklerini seçmek için adlandırılmış bir profil oluşturun.",+ "de": "Das Standardprofil startet immer mit den auf der Seite „Fähigkeiten“ ausgewählten Fähigkeiten. Erstellen Sie ein benanntes Profil, um eigene auszuwählen.",+ "uk": "Типовий профіль завжди запускається з навичками, вибраними на сторінці «Навички». Щоб вибрати власні, створіть іменований профіль.",+ "ca": "El perfil predeterminat sempre s'inicia amb les habilitats seleccionades a la pàgina Habilitats. Crea un perfil amb nom per triar-ne les seves.",+ "id": "Profil default selalu diluncurkan dengan skill yang dipilih di halaman Skill. Buat profil bernama untuk memilih skill-nya sendiri."}}diff --git a/src/mocks/conversation-handlers.ts b/src/mocks/conversation-handlers.tsindex 5e5e3def1b..b77bce1adf 100644--- a/src/mocks/conversation-handlers.ts+++ b/src/mocks/conversation-handlers.ts@@ -1,4 +1,5 @@import { http, delay, HttpResponse, passthrough } from "msw";+import { SKILLS_CATALOG } from "@openhands/extensions/skills";import type { DirectConversationInfo } from "#/api/agent-server-adapter";import type { AppConversation } from "#/api/conversation-service/agent-server-conversation-service.types";import {@@ -481,6 +482,20 @@ export const CONVERSATION_HANDLERS = [http.post("*/api/skills", async () => HttpResponse.json({ skills: [] })),+ http.get("*/api/skills/catalog", async () =>+ HttpResponse.json({+ skills: SKILLS_CATALOG.map((entry) => ({+ name: entry.name,+ type: "knowledge",+ content: entry.content,+ triggers: entry.triggers ?? [],+ source: null,+ description: entry.description,+ origin: "public",+ })),+ }),+ ),+http.post("/api/v1/conversations/:conversationId/pending-messages",async () => HttpResponse.json({ id: "mock-pending-id", position: 0 }),diff --git a/src/routes/agent-settings.tsx b/src/routes/agent-settings.tsxindex 6682a5cd9c..61c3210ab2 100644--- a/src/routes/agent-settings.tsx+++ b/src/routes/agent-settings.tsx@@ -43,11 +43,22 @@ import {type ProfileScopeMode,} from "#/constants/profile-scope";import { useToolCatalog } from "#/hooks/query/use-tool-catalog";+import { useSkillCatalog } from "#/hooks/query/use-skill-catalog";+import {+ buildSkillEnablementFilter,+ profileSkillEnablement,+ publicSkillTest,+ sameSkillSelection,+ toggleSkill,+ toProfileSkillFields,+ type SkillEnablement,+} from "#/utils/skill-enablement";import { flattenMcpConfig } from "#/utils/mcp-installed-servers";import { parseMcpConfig } from "#/utils/mcp-config";import {agentProfileSupportsSecretRefs,agentProfileSupportsInstructions,+ agentProfileSupportsSkills,agentProfileSupportsTools,} from "#/api/agent-profiles-service/profile-field-support";import { useSearchSecrets } from "#/hooks/query/use-get-secrets";@@ -134,6 +145,8 @@ export type AgentProfileFieldsDraft =mcp_server_refs: string[] | null;tool_concurrency_limit?: number;secret_refs?: string[] | null;+ public_skills?: string[];+ disabled_skills?: string[];tools?: ProfileToolSpec[] | null;persona?: string | null;system_message_suffix?: string | null;@@ -165,6 +178,8 @@ export interface AgentProfileFieldsInput {selectedSecrets: string[];/** Whether the backend's *profile* model accepts `secret_refs`. */secretRefsSupportedOnProfile: boolean;+ /** The skill selection to store; undefined keeps the stored one. */+ skillEnablement?: SkillEnablement;toolsMode?: ProfileScopeMode;selectedTools?: string[];/** Stored params per tool, kept so the editor cannot drop what it ignores. */@@ -211,6 +226,7 @@ export function buildAgentProfileFields(secretsMode,selectedSecrets,secretRefsSupportedOnProfile,+ skillEnablement,toolsMode = "standard",selectedTools = [],toolParams = {},@@ -249,6 +265,8 @@ export function buildAgentProfileFields(...mcpRefs,...secretRefs,};+ if (skillEnablement)+ Object.assign(fields, toProfileSkillFields(skillEnablement));if (systemPromptEditable) {const text = systemPromptText.trim() ? systemPromptText : null;fields.system_message_suffix = systemPromptMode === "append" ? text : null;@@ -319,9 +337,8 @@ export function AgentSettingsScreen({const { data: schema } = useAgentSettingsSchema(settings?.agent_settings_schema,);- const acpProviders = getAcpProvidersForBackend(- useActiveBackend().backend.kind,- );+ const backendKind = useActiveBackend().backend.kind;+ const acpProviders = getAcpProvidersForBackend(backendKind);const fields = React.useMemo(() => schema?.sections.flatMap((section) => section.fields),@@ -456,6 +473,74 @@ export function AgentSettingsScreen({.filter((name) => selectedMcpServers.includes(name)),[mcpCatalog, selectedMcpServers],);+ // --- Skills (OpenHands; the selection a profile launch loads) ---+ // `default` launches with the Skills page selection instead.+ const skillsSupported = agentProfileSupportsSkills();+ const skillsEditable = skillsSupported && !isDefaultProfile;+ const {+ data: skillCatalog,+ isError: skillCatalogFailed,+ refetch: refetchSkillCatalog,+ } = useSkillCatalog({ enabled: skillsEditable });+ const isPublicSkill = React.useMemo(+ () => publicSkillTest(skillCatalog),+ [skillCatalog],+ );+ const storedPublicSkills = agentSettingsOverride?.public_skills;+ const hasStoredSkillList = Array.isArray(storedPublicSkills);+ const initialSkills = React.useMemo<SkillEnablement | undefined>(() => {+ const disabled = agentSettingsOverride?.disabled_skills;+ const stored = {+ public_skills: hasStoredSkillList+ ? (storedPublicSkills as string[])+ : null,+ disabled_skills: Array.isArray(disabled) ? (disabled as string[]) : [],+ };+ if (hasStoredSkillList) return profileSkillEnablement(stored);+ // No stored list means every catalog skill, which only the catalog can name.+ if (!skillCatalog) return undefined;+ return profileSkillEnablement(+ stored,+ skillCatalog+ .filter((skill) => skill.origin === "public")+ .map((skill) => skill.name),+ );+ }, [+ agentSettingsOverride,+ hasStoredSkillList,+ storedPublicSkills,+ skillCatalog,+ ]);+ const [editedSkills, setEditedSkills] = useState<SkillEnablement | null>(+ null,+ );+ const currentSkills = editedSkills ?? initialSkills;+ const enabledSkillNames = React.useMemo(() => {+ if (!skillCatalog || !currentSkills) return [];+ const isEnabled = buildSkillEnablementFilter(currentSkills, isPublicSkill);+ return skillCatalog+ .map((skill) => skill.name)+ .filter((name) => isEnabled(name));+ }, [skillCatalog, currentSkills, isPublicSkill]);+ const toggleProfileSkill = useCallback(+ (name: string, enabled: boolean) =>+ setEditedSkills((previous) => {+ const base = previous ?? initialSkills;+ return base+ ? toggleSkill(base, name, enabled, isPublicSkill)+ : previous;+ }),+ [initialSkills, isPublicSkill],+ );+ // A seeded or stored list is written back; an unset one only once edited.+ const skillsToSave = skillsEditable+ ? (editedSkills ?? (hasStoredSkillList ? initialSkills : undefined))+ : undefined;+ const skillsDirty =+ editedSkills !== null &&+ initialSkills !== undefined &&+ !sameSkillSelection(editedSkills, initialSkills);+// --- Secret scope (both variants; a base-model field) ---const secretRefsSupportedOnProfile = agentProfileSupportsSecretRefs();const { data: savedSecrets } = useSearchSecrets({@@ -695,7 +780,10 @@ export function AgentSettingsScreen({isCustomAcpModel !== loadedSnapshot.isCustomAcpModel: toolConcurrency !== initialToolConcurrency || systemPromptDirty);const credentialsDirty = acpCredentialForm.isDirty;- const isAnyDirty = settingsDirty || credentialsDirty;+ const isAnyDirty =+ settingsDirty ||+ credentialsDirty ||+ (agentType === "openhands" && skillsDirty);const customToolsUninitialized =toolCatalogLoaded &&agentType === "openhands" &&@@ -805,6 +893,7 @@ export function AgentSettingsScreen({secretsMode,selectedSecrets: orderedSelectedSecrets,secretRefsSupportedOnProfile,+ skillEnablement: skillsToSave,toolsMode,selectedTools: orderedSelectedTools,toolParams: initialTools.params,@@ -1186,6 +1275,67 @@ export function AgentSettingsScreen({</div>) : null}+ {agentType === "openhands" && skillsSupported ? (+ <div+ className="flex flex-col gap-2.5"+ data-testid="agent-settings-skills-section"+ >+ <Typography.Text className="text-sm">+ {t(I18nKey.SETTINGS$AGENT_PROFILE_SKILLS)}+ </Typography.Text>+ {!skillsEditable ? (+ <Typography.Text+ testId="agent-settings-skills-default-profile"+ className="text-xs text-tertiary-alt"+ >+ {t(I18nKey.SETTINGS$AGENT_PROFILE_SKILLS_DEFAULT_PROFILE)}+ </Typography.Text>+ ) : (+ <>+ {skillCatalog && currentSkills ? (+ <div className="max-h-80 overflow-y-auto pr-1">+ <ProfileScopeList+ testId="agent-settings-skills"+ items={skillCatalog.map((skill) => ({+ name: skill.name,+ description: t(+ skill.origin === "public"+ ? I18nKey.SETTINGS$SKILL_ORIGIN_PUBLIC+ : I18nKey.SETTINGS$SKILL_ORIGIN_USER,+ ),+ }))}+ selected={enabledSkillNames}+ isDisabled={isSaving}+ onToggle={toggleProfileSkill}+ />+ </div>+ ) : null}+ {skillCatalogFailed ? (+ <div+ className="flex items-center gap-2"+ data-testid="agent-settings-skills-load-failed"+ >+ <Typography.Text className="text-xs text-feedback-error">+ {t(I18nKey.SETTINGS$AGENT_PROFILE_SKILLS_LOAD_FAILED)}+ </Typography.Text>+ <BrandButton+ testId="agent-settings-skills-retry"+ type="button"+ variant="secondary"+ onClick={() => refetchSkillCatalog()}+ >+ {t(I18nKey.SETTINGS$AGENT_PROFILE_TOOLS_RETRY)}+ </BrandButton>+ </div>+ ) : null}+ <Typography.Text className="text-xs text-tertiary-alt">+ {t(I18nKey.SETTINGS$AGENT_PROFILE_SKILLS_HINT)}+ </Typography.Text>+ </>+ )}+ </div>+ ) : null}+{isAcp && (<><SettingsDropdownInputdiff --git a/src/types/settings.ts b/src/types/settings.tsindex d2128a5656..419626d126 100644--- a/src/types/settings.ts+++ b/src/types/settings.ts@@ -67,10 +67,14 @@ export type SettingsSchema = {export type SkillType = "repo" | "knowledge" | "agentskills";+/** Where a server-listed skill comes from: the public catalog or the user's own skills. */+export type SkillOrigin = "public" | "user";+export type SkillInfo = {name: string;type: SkillType;source: string | null;+ origin?: SkillOrigin;description?: string | null;triggers?: string[];/**diff --git a/src/utils/skill-enablement.ts b/src/utils/skill-enablement.tsindex 22f9c54411..09407d74a3 100644--- a/src/utils/skill-enablement.ts+++ b/src/utils/skill-enablement.ts@@ -2,6 +2,7 @@ import {DEFAULT_ENABLED_SKILL_NAMES,SKILLS_CATALOG,} from "@openhands/extensions/skills";+import type { SkillInfo } from "#/types/settings";/** Every skill bundled from `@openhands/extensions`, in catalog order. */export const CATALOG_SKILL_NAMES: readonly string[] = SKILLS_CATALOG.map(@@ -15,6 +16,22 @@ export function isCatalogSkill(name: string): boolean {return CATALOG_SKILL_NAME_SET.has(name);}+/**+ * Whether a skill belongs to the public catalog, as the server reports it.+ * Without a server listing, the bundled catalog stands in.+ */+export function publicSkillTest(+ catalog: readonly SkillInfo[] | undefined,+): (name: string) => boolean {+ if (!catalog) return isCatalogSkill;+ const publicNames = new Set(+ catalog+ .filter((skill) => skill.origin === "public")+ .map((skill) => skill.name),+ );+ return (name) => publicNames.has(name);+}+export function isRecommendedSkill(name: string): boolean {return RECOMMENDED_SKILL_NAME_SET.has(name);}@@ -48,13 +65,64 @@ export function resolveEnabledCatalogSkills(*/export function buildSkillEnablementFilter(enablement: SkillEnablement,+ isPublic: (name: string) => boolean = isCatalogSkill,): (skillName: string) => boolean {const enabled = new Set(resolveEnabledCatalogSkills(enablement));const disabled = new Set(enablement.disabledSkills ?? []);return (skillName) => {if (disabled.has(skillName)) return false;- return !isCatalogSkill(skillName) || enabled.has(skillName);+ return !isPublic(skillName) || enabled.has(skillName);+ };+}++/** Same array reference when the membership already matches, to skip a save. */+function withMembership(+ list: string[],+ name: string,+ present: boolean,+): string[] {+ if (list.includes(name) === present) return list;+ return present ? [...list, name] : list.filter((entry) => entry !== name);+}++/**+ * Switch one skill on or off. A catalog skill moves in the allow-list, any+ * other skill in the deny-list.+ */+export function toggleSkill(+ enablement: SkillEnablement,+ skillName: string,+ enabled: boolean,+ isPublic: (name: string) => boolean = isCatalogSkill,+): SkillEnablement {+ const allowListed = isPublic(skillName);+ return {+ enabledSkills: allowListed+ ? withMembership(+ resolveEnabledCatalogSkills(enablement),+ skillName,+ enabled,+ )+ : enablement.enabledSkills,+ // A catalog skill switched back on also leaves the deny-list, where an+ // older selection may still hold it.+ disabledSkills: withMembership(+ enablement.disabledSkills ?? [],+ skillName,+ !enabled && !allowListed,+ ),+ };+}++/** The profile fields that store a selection. */+export function toProfileSkillFields(enablement: SkillEnablement): {+ public_skills: string[];+ disabled_skills: string[];+} {+ return {+ public_skills: resolveEnabledCatalogSkills(enablement),+ disabled_skills: enablement.disabledSkills ?? [],};}@@ -87,6 +155,20 @@ export function migrateSkillEnablement(};}+/** A profile's skill selection; a profile without `public_skills` loads the whole catalog. */+export function profileSkillEnablement(+ profile: {+ public_skills?: string[] | null;+ disabled_skills?: string[];+ },+ publicNames: readonly string[] = CATALOG_SKILL_NAMES,+): SkillEnablement {+ return {+ enabledSkills: profile.public_skills ?? [...publicNames],+ disabledSkills: profile.disabled_skills ?? [],+ };+}+export function toSkillEnablement(settings: {enabled_skills?: string[];disabled_skills?: string[];@@ -97,6 +179,34 @@ export function toSkillEnablement(settings: {};}+/** The default list new agent profiles start from, read as a pre-allow-list workspace migrates. */+export function defaultSkillEnablement(settings: {+ enabled_skills?: string[];+ disabled_skills?: string[];+}): SkillEnablement {+ const stored = toSkillEnablement(settings);+ const migrated = migrateSkillEnablement(stored);+ return migrated+ ? {+ enabledSkills: migrated.enabled_skills,+ disabledSkills: migrated.disabled_skills,+ }+ : stored;+}++/** Whether two selections store the same lists, ignoring order. */+export function sameSkillSelection(+ a: SkillEnablement,+ b: SkillEnablement,+): boolean {+ const key = (enablement: SkillEnablement) =>+ JSON.stringify([+ [...resolveEnabledCatalogSkills(enablement)].sort(),+ [...(enablement.disabledSkills ?? [])].sort(),+ ]);+ return key(a) === key(b);+}+// Both forms a user can send: the commands a skill declares in its own// `triggers` (what an automation card fills in — see `findAutomationCommand`),// and `/<skill-name>`, which the detail modal's "Use skill" button inserts.diff --git a/tests/e2e/live-acp/README.md b/tests/e2e/live-acp/README.mdindex e959a99749..a7ecd58b80 100644--- a/tests/e2e/live-acp/README.md+++ b/tests/e2e/live-acp/README.md@@ -24,7 +24,7 @@ and needs a running container + real host credentials).docker run -d --name oh-acp -p 8010:8000 \-v oh-acp-data:/workspace \-v "$(pwd)/tools:/canvas-tools:ro" -e OH_EXTRA_PYTHON_PATH=/canvas-tools \- ghcr.io/openhands/agent-server:1.53.0-python+ ghcr.io/openhands/agent-server:1.56.0-python# 2. Run the e2e (all providers, or a subset).npx vite-node -c tests/e2e/live-acp/vite-node.config.mts \