Skip to content

🙌 OpenHands: AI-Driven Development

feat(agent-profiles): pick every tool from the server's catalog; pin SDK 1.53.0 (#17516)

simonrosenberg821f5b2f5f3c
diff --git a/.agents/skills/frontend-api-contracts/references/guide.md b/.agents/skills/frontend-api-contracts/references/guide.md
index 3a8b2a1826..6aca25957e 100644
--- a/.agents/skills/frontend-api-contracts/references/guide.md
+++ b/.agents/skills/frontend-api-contracts/references/guide.md
@@ -190,7 +190,7 @@ return new ConversationClient(getAgentServerClientOptions()).someMethod(...);
- Collapsible thinking: `ThinkAction` events and LLM extended reasoning (`reasoning_content` / `thinking_blocks` on `ActionEvent`) are rendered as collapsible sections via `CollapsibleThinking` (`src/components/conversation-events/chat/event-message-components/collapsible-thinking.tsx`). Collapsed by default to keep the chat compact — the thinking is often in English regardless of the user's conversation language. The `getReasoningContent()` helper in `event-thought-helpers.ts` extracts the content, preferring `reasoning_content` (plain string) and falling back to Anthropic `thinking_blocks`. i18n keys: `THINKING$TITLE`, `THINKING$EXPAND`, `THINKING$COLLAPSE`. Tests: `__tests__/components/conversation-events/chat/event-message-think-action.test.tsx`.
-- Agent delegation settings: the `Settings > Agent` page (`src/routes/agent-settings.tsx`) is intentionally NOT a `SdkSectionPage` wrapper. It mirrors upstream OpenHands#14418 — it flatMaps every section of `agent_settings_schema` and finds the `enable_sub_agents` field by key, so it works regardless of which section the real backend exposes the field in. Don't refactor it back to `SdkSectionPage` unless you also know the real backend's section name and add a fallback for the live "SDK schema unavailable" path. The toggle persists via `agent_settings_diff`. Nav item lives in `OSS_NAV_ITEMS` (settings-nav.tsx) with the robot icon (`SETTINGS$NAV_AGENT`). The mock schema in `settings-handlers.ts` puts the field in a `general` section. **Client-side gate**: `getAgentTools()` in `agent-server-adapter.ts` only attaches `task_tool_set` to new conversations when `agent_settings.enable_sub_agents === true`. Without that gate the agent server would still receive the tool whenever it advertised it in `/api/server_info`, so the toggle had no effect on running conversations.
+- Global tool selection: `getAgentTools()` in `agent-server-adapter.ts` sends `agent_settings.tools` exactly as stored (`[]` included) and omits it when unset/`null`, so the agent server resolves its standard set. There are no global tool toggles; tools are chosen per agent profile from the server's catalog. `GlobalToolsNotice` (`agent-profiles/global-tools-notice.tsx`) surfaces a custom global list and resets it with `agent_settings_diff: { tools: null }`.
- Settings naming is backend-aware today: local `/settings` is profile-oriented (`use-settings-nav-items.ts` renames the first settings item/title/subtitle to `LLM Profiles` and `chat-input-model.tsx` / `chat-input-actions.tsx` link there as `LLM Profiles`), while cloud keeps the generic `LLM Settings` copy because cloud still edits raw settings rather than saved profiles. The local profile editor (`llm-settings-local-view.tsx`) should keep explicit create/edit profile headings plus helper text so users know they are saving a profile, not mutating the current conversation directly.
diff --git a/.agents/skills/local-stack-runtime/references/guide.md b/.agents/skills/local-stack-runtime/references/guide.md
index 3c817fc3fb..44b495ae92 100644
--- a/.agents/skills/local-stack-runtime/references/guide.md
+++ b/.agents/skills/local-stack-runtime/references/guide.md
@@ -5,7 +5,7 @@ Supported deployment environment variables:
- `VITE_BACKEND_BASE_URL` — Agent Server base URL.
- `VITE_SESSION_API_KEY` — optional session authentication.
- `VITE_WORKING_DIR` — default workspace path sent when starting conversations.
-- `VITE_ENABLE_BROWSER_TOOLS=false` — omit `browser_tool_set` from new conversation payloads.
+- `VITE_ENABLE_BROWSER_TOOLS=false` — start the agent-server with the browser tool set off (`OH_ENABLE_BROWSER=false`).
- `VITE_BASE_PATH` — serve the SPA under a subpath such as `/canvas`; pair it with `scripts/static-server.mjs --base-path` at runtime.
GitHub automation includes `.github/workflows/ci.yml` for `npm ci`, `npm test`, and `npm run build`, plus `.github/dependabot.yml` with weekly npm and GitHub Actions updates gated by a seven-day cooldown.
@@ -92,10 +92,10 @@ you are running inside of — NOT the automation backend.
- `scripts/dev-safe.mjs` uses `uvx` for temporary agent-server installation — no permanent `uv tool install` needed. Environment variables (highest precedence first):
- `OH_AGENT_SERVER_LOCAL_PATH` — absolute path to a local `software-agent-sdk` checkout. Runs the local checkout via `uvx` with `--with-editable` for `openhands-sdk`/`openhands-tools`/`openhands-workspace` and `--reinstall` for `openhands-agent-server`, so SDK edits are picked up on restart. Highest precedence.
- `OH_AGENT_SERVER_GIT_REF` — git commit SHA or branch name (takes precedence over version)
- - `OH_AGENT_SERVER_VERSION` — specific PyPI version (e.g., "1.50.1")
+ - `OH_AGENT_SERVER_VERSION` — specific PyPI version (e.g., "1.53.0")
- `OH_SECRET_KEY` — secret key for settings encryption; auto-generated and persisted to `~/.openhands/agent-canvas/secret-key.txt` on first run (same file Docker uses), ensuring dev mode and Docker share the same key when both mount the same `~/.openhands` directory. Override with the env var to pin a specific key.
- `SESSION_API_KEY` / `OH_SESSION_API_KEYS_0` / `VITE_SESSION_API_KEY` — session API key for agent-server authentication; auto-generated using `crypto.randomBytes(32)` if not set, passed to both agent-server (`OH_SESSION_API_KEYS_0`) and frontend (`VITE_SESSION_API_KEY`)
- - Default: released PyPI version `1.50.1` for agent-server SDK libraries
+ - Default: released PyPI version `1.53.0` for agent-server SDK libraries
- Security: launchers generate and persist a 64-character session API key at `~/.openhands/agent-canvas/session-api-key.txt` unless overridden. The agent-server and automation backend share that session key. `OH_SECRET_KEY` protects settings encryption and is persisted separately at `~/.openhands/agent-canvas/secret-key.txt`.
- `scripts/dev-safe.mjs` should fail fast if `uvx` cannot be spawned (for example missing PATH entries).
diff --git a/.env.sample b/.env.sample
index 0ad49b9057..1d67deead8 100644
--- a/.env.sample
+++ b/.env.sample
@@ -10,7 +10,7 @@ VITE_BACKEND_BASE_URL="http://127.0.0.1:8000" # Base URL used by browser-side di
# and docs/ACP_AGENTS.md → "Running ACP agents in a Docker container".
# VITE_SESSION_API_KEY="" # Set to the same value as backend SESSION_API_KEY or OH_SESSION_API_KEYS_0 when auth is enabled
# 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_ENABLE_BROWSER_TOOLS="true" # Set to false to omit BrowserToolSet from new conversations
+# VITE_ENABLE_BROWSER_TOOLS="true" # Set to false to start the agent-server with the browser tool set off
# Frontend dev server
VITE_FRONTEND_PORT="3001" # Port to run the frontend application
diff --git a/.github/workflows/mock-llm-docker-e2e.yml b/.github/workflows/mock-llm-docker-e2e.yml
index 6533a1d699..0902694bb5 100644
--- a/.github/workflows/mock-llm-docker-e2e.yml
+++ b/.github/workflows/mock-llm-docker-e2e.yml
@@ -174,10 +174,6 @@ jobs:
# Docker) and require build/index.html to exist locally. The regular
# mock-llm-e2e workflow builds before running; we do the same here.
- name: Build frontend (for partial-stack tests)
- env:
- # Partial-stack tests use the local static build, so keep its tool
- # payload consistent with the mock-LLM stack runtime settings.
- VITE_ENABLE_BROWSER_TOOLS: "false"
run: npm run build:app
# ── Run tests ──────────────────────────────────────────────────────
diff --git a/.github/workflows/mock-llm-e2e.yml b/.github/workflows/mock-llm-e2e.yml
index 41e117e149..24059d5dd7 100644
--- a/.github/workflows/mock-llm-e2e.yml
+++ b/.github/workflows/mock-llm-e2e.yml
@@ -107,10 +107,6 @@ jobs:
kill $SERVER_PID
- name: Build frontend (for agent-canvas binary)
- env:
- # VITE_ENABLE_BROWSER_TOOLS is evaluated at Vite build time;
- # setting it only when the static stack starts is too late.
- VITE_ENABLE_BROWSER_TOOLS: "false"
run: npm run build:app
- name: Run mock-LLM E2E tests
diff --git a/__tests__/api/agent-profiles-service/profile-field-support.test.ts b/__tests__/api/agent-profiles-service/profile-field-support.test.ts
index 10c6d86d32..d20e159b88 100644
--- a/__tests__/api/agent-profiles-service/profile-field-support.test.ts
+++ b/__tests__/api/agent-profiles-service/profile-field-support.test.ts
@@ -1,96 +1,26 @@
-import { beforeEach, describe, expect, it, vi } from "vitest";
+import { describe, expect, it, vi } from "vitest";
import {
- MIN_AGENT_SERVER_VERSION_FOR_PROFILE_SWITCH_LLM_TOOL,
agentProfileSupportsSecretRefs,
- agentProfileSupportsSwitchLlmTool,
+ agentProfileSupportsTools,
} from "#/api/agent-profiles-service/profile-field-support";
-const mockGetCachedAgentServerVersion = vi.fn<() => string | null>();
-const mockServerInfo = vi.fn<() => { capabilities?: string[] } | null>();
const mockBackendKind = vi.fn<() => string>(() => "local");
vi.mock("#/api/backend-registry/active-store", () => ({
getActiveBackend: () => ({ backend: { kind: mockBackendKind() } }),
}));
-// Only the version *lookup* is mocked — the comparison stays the real one so
-// these cases exercise the same parser the boot-time compatibility check uses.
-vi.mock("#/api/agent-server-compatibility", async (importOriginal) => {
- const actual =
- await importOriginal<typeof import("#/api/agent-server-compatibility")>();
- return {
- ...actual,
- getCachedAgentServerVersion: () => mockGetCachedAgentServerVersion(),
- getCachedAgentServerInfo: () => mockServerInfo(),
- };
-});
-
-describe("agentProfileSupportsSwitchLlmTool", () => {
- beforeEach(() => {
- mockGetCachedAgentServerVersion.mockReset();
- });
-
- it("pins the gate to the release that added the profile field", () => {
- expect(MIN_AGENT_SERVER_VERSION_FOR_PROFILE_SWITCH_LLM_TOOL).toBe("1.31.0");
- });
-
- it.each(["1.29.0", "1.29.3", "1.30.0"])(
- "reports no support on %s, where agent profiles exist but the field does not",
- (version) => {
- mockGetCachedAgentServerVersion.mockReturnValue(version);
- expect(agentProfileSupportsSwitchLlmTool()).toBe(false);
- },
- );
-
- it.each(["1.31.0", "1.31.2", "1.36.1", "2.0.0"])(
- "reports support on %s",
- (version) => {
- mockGetCachedAgentServerVersion.mockReturnValue(version);
- expect(agentProfileSupportsSwitchLlmTool()).toBe(true);
- },
- );
-
- it("treats a prerelease of the gating version as older", () => {
- mockGetCachedAgentServerVersion.mockReturnValue("1.31.0-rc.1");
- expect(agentProfileSupportsSwitchLlmTool()).toBe(false);
- });
-
- it("assumes support when no version is cached (cloud backends)", () => {
- mockGetCachedAgentServerVersion.mockReturnValue(null);
- expect(agentProfileSupportsSwitchLlmTool()).toBe(true);
- });
-
- it("assumes support when the reported version does not parse", () => {
- mockGetCachedAgentServerVersion.mockReturnValue("main");
- expect(agentProfileSupportsSwitchLlmTool()).toBe(true);
- });
-});
-
-describe("agentProfileSupportsSecretRefs", () => {
- beforeEach(() => {
+describe.each([
+ ["agentProfileSupportsSecretRefs", agentProfileSupportsSecretRefs],
+ ["agentProfileSupportsTools", agentProfileSupportsTools],
+])("%s", (_name, supports) => {
+ it("is offered on a local backend", () => {
mockBackendKind.mockReturnValue("local");
+ expect(supports()).toBe(true);
});
- it.each([null, {}, { capabilities: [] }])(
- "hides an unadvertised scope: %j",
- (info) => {
- mockServerInfo.mockReturnValue(info);
- expect(agentProfileSupportsSecretRefs()).toBe(false);
- },
- );
-
- it("accepts enforcement advertised by a local development build", () => {
- mockServerInfo.mockReturnValue({
- capabilities: ["profile_secret_scope_v1"],
- });
- expect(agentProfileSupportsSecretRefs()).toBe(true);
- });
-
- it("does not promise enforcement through the Cloud profile launch path", () => {
+ it("stays off on Cloud, whose launches do not apply it yet", () => {
mockBackendKind.mockReturnValue("cloud");
- mockServerInfo.mockReturnValue({
- capabilities: ["profile_secret_scope_v1"],
- });
- expect(agentProfileSupportsSecretRefs()).toBe(false);
+ expect(supports()).toBe(false);
});
});
diff --git a/__tests__/api/agent-server-adapter.test.ts b/__tests__/api/agent-server-adapter.test.ts
index 3b279204ac..6a14177c0a 100644
--- a/__tests__/api/agent-server-adapter.test.ts
+++ b/__tests__/api/agent-server-adapter.test.ts
@@ -35,7 +35,6 @@ import {
const {
mockGetAgentServerWorkingDir,
- mockIsAgentServerToolAvailable,
mockGetEffectiveLocalBackend,
mockGetCachedAgentServerInfo,
mockGetServerInfo,
@@ -44,7 +43,6 @@ const {
mockListMetaProfiles,
} = vi.hoisted(() => ({
mockGetAgentServerWorkingDir: vi.fn(() => "/workspace/project/agent-canvas"),
- mockIsAgentServerToolAvailable: vi.fn((_toolName: string) => true),
mockGetEffectiveLocalBackend: vi.fn(() => ({
id: "default-local",
name: "Local backend",
@@ -90,7 +88,6 @@ vi.mock("#/api/agent-server-config", () => ({
}));
vi.mock("#/api/agent-server-compatibility", () => ({
- isAgentServerToolAvailable: mockIsAgentServerToolAvailable,
getCachedAgentServerInfo: mockGetCachedAgentServerInfo,
}));
@@ -130,7 +127,6 @@ const EXPLICIT_HOOK_CONFIG = makeHookConfig({
});
beforeEach(() => {
- mockIsAgentServerToolAvailable.mockReturnValue(true);
mockGetCachedAgentServerInfo.mockReturnValue(null);
mockGetServerInfo.mockReset();
mockGetEffectiveLocalBackend.mockReturnValue({
@@ -168,7 +164,6 @@ describe("buildStartConversationRequest", () => {
agent_settings: {
...DEFAULT_SETTINGS.agent_settings,
agent: "CodeActAgent",
- enable_sub_agents: true,
llm: {
model: "nested-model",
api_key: " nested-key ",
@@ -178,7 +173,6 @@ describe("buildStartConversationRequest", () => {
enabled: true,
max_size: 120,
},
- enable_switch_llm_tool: true,
},
conversation_settings: {
...DEFAULT_SETTINGS.conversation_settings,
@@ -210,13 +204,9 @@ describe("buildStartConversationRequest", () => {
enabled: true,
max_size: 120,
});
- expect(payload.agent_settings.tools).toEqual([
- { name: "terminal", params: {} },
- { name: "file_editor", params: {} },
- { name: "task_tracker", params: {} },
- { name: "browser_tool_set", params: {} },
- { name: "task_tool_set", params: {} },
- ]);
+ expect(
+ JSON.parse(JSON.stringify(payload.agent_settings)),
+ ).not.toHaveProperty("tools");
expect(payload.agent_settings.agent_context).toMatchObject({
load_public_skills: false,
load_user_skills: true,
@@ -259,7 +249,6 @@ describe("buildStartConversationRequest", () => {
}
}
expect(payload.agent_settings.agent).toBe("CodeActAgent");
- expect(payload.agent_settings.enable_switch_llm_tool).toBe(true);
expect(payload.workspace.working_dir).toBe(
"/workspace/project/agent-canvas",
);
@@ -311,37 +300,16 @@ describe("buildStartConversationRequest", () => {
expect(payload.agent_settings.llm.model).toBe("openai/gpt-4o");
});
- it("forwards the switch-LLM setting to SDK agent settings", () => {
- const payload = buildStartConversationRequest({
- settings: {
- ...DEFAULT_SETTINGS,
- agent_settings: {
- ...DEFAULT_SETTINGS.agent_settings,
- enable_switch_llm_tool: true,
- llm: { model: "nested-model" },
- },
- },
- }) as {
- agent?: unknown;
- agent_settings: {
- enable_switch_llm_tool?: boolean;
- include_default_tools?: unknown;
- };
- };
-
- expect(payload.agent).toBeUndefined();
- expect(payload.agent_settings.enable_switch_llm_tool).toBe(true);
- expect(payload.agent_settings.include_default_tools).toBeUndefined();
- });
-
- it("omits browser_tool_set and task_tool_set when the server does not advertise them", () => {
- mockIsAgentServerToolAvailable.mockReturnValue(false);
-
+ it("sends configured tools as given", () => {
const payload = buildStartConversationRequest({
settings: {
...DEFAULT_SETTINGS,
agent_settings: {
...DEFAULT_SETTINGS.agent_settings,
+ tools: [
+ { name: "glob", params: {} },
+ { name: "task_tool_set", params: { x: 1 } },
+ ],
llm: { model: "nested-model" },
},
},
@@ -352,58 +320,41 @@ describe("buildStartConversationRequest", () => {
};
expect(payload.agent_settings.tools).toEqual([
- { name: "terminal", params: {} },
- { name: "file_editor", params: {} },
- { name: "task_tracker", params: {} },
+ { name: "glob", params: {} },
+ { name: "task_tool_set", params: { x: 1 } },
]);
});
- it("includes task_tool_set when sub-agents are enabled and the server advertises it but not browser tools", () => {
- mockIsAgentServerToolAvailable.mockImplementation(
- (toolName: string) => toolName === "task_tool_set",
- );
-
+ it("leaves a null tool list to the server", () => {
const payload = buildStartConversationRequest({
settings: {
...DEFAULT_SETTINGS,
agent_settings: {
...DEFAULT_SETTINGS.agent_settings,
- enable_sub_agents: true,
+ tools: null,
llm: { model: "nested-model" },
},
},
- }) as {
- agent_settings: {
- tools: Array<{ name: string; params: Record<string, unknown> }>;
- };
- };
+ }) as { agent_settings: Record<string, unknown> };
- expect(payload.agent_settings.tools).toEqual([
- { name: "terminal", params: {} },
- { name: "file_editor", params: {} },
- { name: "task_tracker", params: {} },
- { name: "task_tool_set", params: {} },
- ]);
+ expect(
+ JSON.parse(JSON.stringify(payload.agent_settings)),
+ ).not.toHaveProperty("tools");
});
- it("omits task_tool_set when sub-agents are disabled even if the server advertises it", () => {
+ it("keeps an explicitly empty tool list bare", () => {
const payload = buildStartConversationRequest({
settings: {
...DEFAULT_SETTINGS,
agent_settings: {
...DEFAULT_SETTINGS.agent_settings,
- enable_sub_agents: false,
+ tools: [],
llm: { model: "nested-model" },
},
},
- }) as {
- agent_settings: {
- tools: Array<{ name: string; params: Record<string, unknown> }>;
- };
- };
+ }) as { agent_settings: { tools: unknown[] } };
- const toolNames = payload.agent_settings.tools.map((t) => t.name);
- expect(toolNames).not.toContain("task_tool_set");
+ expect(payload.agent_settings.tools).toEqual([]);
});
it("derives confirmation and security settings the same way as OpenHands", () => {
@@ -865,24 +816,6 @@ describe("buildStartConversationRequest", () => {
expect(payload.tool_module_qualnames).toBeUndefined();
});
- it("omits canvas_ui and its module qualname when the backend does not advertise canvas_ui", () => {
- mockIsAgentServerToolAvailable.mockImplementation(
- (toolName: string) => toolName !== "canvas_ui",
- );
-
- const payload = buildStartConversationRequest({
- settings: DEFAULT_SETTINGS,
- }) as {
- agent_settings: { tools: Array<{ name: string }> };
- tool_module_qualnames?: Record<string, string>;
- };
-
- expect(
- payload.agent_settings.tools.map((tool) => tool.name),
- ).not.toContain("canvas_ui");
- expect(payload.tool_module_qualnames).toBeUndefined();
- });
-
it("omits the client tool for an inline ACP agent", () => {
const payload = buildStartConversationRequest({
settings: {
diff --git a/__tests__/api/agent-server-compatibility-bundled-pin.test.ts b/__tests__/api/agent-server-compatibility-bundled-pin.test.ts
index 6a49764095..65f7cfb35f 100644
--- a/__tests__/api/agent-server-compatibility-bundled-pin.test.ts
+++ b/__tests__/api/agent-server-compatibility-bundled-pin.test.ts
@@ -22,7 +22,6 @@ import {
validateLocalBackend,
INVALID_BACKEND_API_KEY_ERROR,
isAgentServerAuthError,
- isAgentServerToolAvailable,
isAgentServerUnavailableError,
isAgentServerUnknownVersionError,
isAgentServerUnsupportedVersionError,
@@ -294,54 +293,6 @@ describe("loadAgentServerInfo", () => {
warning.mockRestore();
});
- it("uses advertised tools after a successful probe", async () => {
- setRegisteredBackends([localBackend]);
- setActiveSelection({ backendId: localBackend.id });
- getServerInfoMock.mockResolvedValue({
- version: MINIMUM_COMPATIBLE_AGENT_SERVER_VERSION,
- usable_tools: ["terminal"],
- });
-
- await loadAgentServerInfo();
-
- expect(isAgentServerToolAvailable("terminal")).toBe(true);
- expect(isAgentServerToolAvailable("browser_tool_set")).toBe(false);
- clearCachedAgentServerInfo();
- expect(isAgentServerToolAvailable("browser_tool_set")).toBe(true);
- });
-
- it("clears advertised tools when a later server-info probe fails", async () => {
- setRegisteredBackends([localBackend]);
- setActiveSelection({ backendId: localBackend.id });
- getServerInfoMock.mockResolvedValue({
- version: MINIMUM_COMPATIBLE_AGENT_SERVER_VERSION,
- usable_tools: ["terminal"],
- });
- await loadAgentServerInfo();
- expect(isAgentServerToolAvailable("browser_tool_set")).toBe(false);
-
- getServerInfoMock.mockRejectedValue(new Error("connection closed"));
-
- await expect(loadAgentServerInfo()).rejects.toBeInstanceOf(
- AgentServerUnavailableError,
- );
- expect(isAgentServerToolAvailable("browser_tool_set")).toBe(true);
- });
-
- it("allows tools when the server does not advertise a tool list", async () => {
- setRegisteredBackends([localBackend]);
- setActiveSelection({ backendId: localBackend.id });
- getServerInfoMock.mockResolvedValue({
- version: MINIMUM_COMPATIBLE_AGENT_SERVER_VERSION,
- usable_tools: null,
- });
-
- await loadAgentServerInfo();
-
- expect(isAgentServerToolAvailable("browser_tool_set")).toBe(true);
- clearCachedAgentServerInfo();
- expect(isAgentServerToolAvailable("browser_tool_set")).toBe(true);
- });
it("returns cached server info only for the probed backend host", async () => {
expect(getCachedAgentServerInfo()).toBeNull();
setRegisteredBackends([localBackend]);
diff --git a/__tests__/api/mock-settings-catalog.test.ts b/__tests__/api/mock-settings-catalog.test.ts
index e0e1a95edc..0a3543e0a8 100644
--- a/__tests__/api/mock-settings-catalog.test.ts
+++ b/__tests__/api/mock-settings-catalog.test.ts
@@ -72,7 +72,7 @@ describe("mock agent-server discovery", () => {
security_analyzers: string[];
}>("/server_info");
expect(serverInfo).toMatchObject({
- version: "1.48.0",
+ version: "1.53.0",
usable_tools: [
"terminal",
"file_editor",
diff --git a/__tests__/api/mock-settings-persistence.test.ts b/__tests__/api/mock-settings-persistence.test.ts
index 98fa8e3603..22ec7c00a5 100644
--- a/__tests__/api/mock-settings-persistence.test.ts
+++ b/__tests__/api/mock-settings-persistence.test.ts
@@ -130,8 +130,6 @@ describe("mock settings schemas and state", () => {
],
};
const expectedAgent = {
- enable_sub_agents: contract("general", "boolean", false, "major"),
- enable_switch_llm_tool: contract("general", "boolean", true, "major"),
tool_concurrency_limit: contract("general", "integer", 1, "major"),
"llm.model": contract("llm", "string", "openai/gpt-5.6-sol", "critical", {
required: true,
@@ -324,7 +322,6 @@ describe("mock settings schemas and state", () => {
agent_settings: {
llm: { model: "openai/gpt-5.6-sol" },
condenser: { enable_default_condenser: true, condenser_max_size: null },
- enable_sub_agents: false,
tool_concurrency_limit: 1,
},
conversation_settings: { confirmation_mode: false },
diff --git a/__tests__/api/option-service.test.ts b/__tests__/api/option-service.test.ts
index b45d2a6a2d..df77b20f13 100644
--- a/__tests__/api/option-service.test.ts
+++ b/__tests__/api/option-service.test.ts
@@ -1,11 +1,10 @@
-import { beforeEach, describe, expect, it, vi } from "vitest";
+import { beforeEach, describe, expect, it } from "vitest";
import { http, HttpResponse } from "msw";
import {
AgentServerUnavailableError,
AgentServerUnknownVersionError,
AgentServerUnsupportedVersionError,
clearCachedAgentServerInfo,
- isAgentServerToolAvailable,
MINIMUM_COMPATIBLE_AGENT_SERVER_VERSION,
} from "#/api/agent-server-compatibility";
import OptionService from "#/api/option-service/option-service.api";
@@ -79,41 +78,6 @@ describe("OptionService", () => {
});
});
- it("caches usable_tools from server_info for later tool gating", async () => {
- server.use(
- http.get("*/server_info", () =>
- HttpResponse.json({
- uptime: 0,
- idle_time: 0,
- version: MINIMUM_COMPATIBLE_AGENT_SERVER_VERSION,
- usable_tools: ["terminal", "file_editor", "task_tracker"],
- }),
- ),
- );
-
- await OptionService.getConfig();
-
- expect(isAgentServerToolAvailable("browser_tool_set")).toBe(false);
- expect(isAgentServerToolAvailable("terminal")).toBe(true);
- });
-
- it("allows all tools when the server does not advertise tool metadata", async () => {
- server.use(
- http.get("*/server_info", () =>
- HttpResponse.json({
- uptime: 0,
- idle_time: 0,
- version: MINIMUM_COMPATIBLE_AGENT_SERVER_VERSION,
- }),
- ),
- );
-
- await OptionService.getConfig();
-
- expect(isAgentServerToolAvailable("browser_tool_set")).toBe(true);
- expect(isAgentServerToolAvailable("terminal")).toBe(true);
- });
-
it("returns models from mocked LLM endpoints", async () => {
const models = await OptionService.getModels();
diff --git a/__tests__/components/backends/add-backend-modal.test.tsx b/__tests__/components/backends/add-backend-modal.test.tsx
index af6fdc98b2..dc903f4d6c 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.48.0" });
+ getServerInfoMock.mockResolvedValue({ version: "1.52.0" });
deviceFlowMocks.startDeviceFlow.mockReset();
deviceFlowMocks.startDeviceFlow.mockResolvedValue({
device_code: "device-code",
@@ -413,7 +413,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.47.0 or newer",
+ "Agent Canvas requires agent-server 1.51.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.tsx
index 5e72d244c3..f2ee4c46bd 100644
--- a/__tests__/components/backends/backend-form-modal.test.tsx
+++ b/__tests__/components/backends/backend-form-modal.test.tsx
@@ -69,7 +69,7 @@ function TestSeed({
beforeEach(() => {
window.localStorage.clear();
getServerInfoMock.mockReset();
- getServerInfoMock.mockResolvedValue({ version: "1.48.0" });
+ getServerInfoMock.mockResolvedValue({ version: "1.52.0" });
__resetActiveStoreForTests();
});
diff --git a/__tests__/components/backends/backend-selector.test.tsx b/__tests__/components/backends/backend-selector.test.tsx
index aa1976d9a8..f4150ab9b3 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.48.0" }),
+ getServerInfo: vi.fn().mockResolvedValue({ version: "1.52.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.tsx
index 34b9033316..8afb314441 100644
--- a/__tests__/components/backends/manage-backends-modal.test.tsx
+++ b/__tests__/components/backends/manage-backends-modal.test.tsx
@@ -32,7 +32,7 @@ const deviceFlowMocks = vi.hoisted(() => ({
pollForToken: vi.fn(),
}));
-const getServerInfoMock = vi.fn().mockResolvedValue({ version: "1.48.0" });
+const getServerInfoMock = vi.fn().mockResolvedValue({ version: "1.52.0" });
const getSettingsMock = vi.fn().mockResolvedValue({});
vi.mock("@openhands/typescript-client/clients", () => ({
@@ -102,7 +102,7 @@ beforeEach(() => {
vi.spyOn(telemetry, "isTelemetryEnabled").mockReturnValue(true);
window.localStorage.clear();
getServerInfoMock.mockReset();
- getServerInfoMock.mockResolvedValue({ version: "1.48.0" });
+ getServerInfoMock.mockResolvedValue({ version: "1.52.0" });
getSettingsMock.mockReset();
getSettingsMock.mockResolvedValue({});
vi.mocked(getCloudOrganizations).mockReset();
@@ -198,7 +198,7 @@ describe("ManageBackendsModal", () => {
);
expect(
screen.getByTestId("manage-backends-status-detail-Local"),
- ).toHaveTextContent("Agent Canvas requires agent-server 1.47.0 or newer");
+ ).toHaveTextContent("Agent Canvas requires agent-server 1.51.0 or newer");
});
it("closes when the header close button is clicked", async () => {
diff --git a/__tests__/components/onboarding/onboarding-modal.test.tsx b/__tests__/components/onboarding/onboarding-modal.test.tsx
index 6ced238f38..74d3f9b454 100644
--- a/__tests__/components/onboarding/onboarding-modal.test.tsx
+++ b/__tests__/components/onboarding/onboarding-modal.test.tsx
@@ -233,7 +233,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.48.0" });
+ return Promise.resolve({ version: "1.52.0" });
});
// ChooseAgentStep's Next button now persists the selection via
// saveSettings before advancing. Stub it so the rest of the flow
diff --git a/__tests__/components/settings/agent-profiles/agent-profiles-local-view.test.tsx b/__tests__/components/settings/agent-profiles/agent-profiles-local-view.test.tsx
index 1e281053ca..680d6dd7a3 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
@@ -75,6 +75,11 @@ vi.mock(
}),
);
+vi.mock(
+ "#/components/features/settings/agent-profiles/global-tools-notice",
+ () => ({ GlobalToolsNotice: () => null }),
+);
+
const saveMutate = vi.fn().mockResolvedValue({ name: "x", message: "ok" });
vi.mock("#/hooks/mutation/use-save-agent-profile", () => ({
useSaveAgentProfile: () => ({ mutateAsync: saveMutate }),
@@ -107,6 +112,7 @@ vi.mock("#/utils/custom-toast-handlers");
vi.mock("#/api/agent-profiles-service/agent-profiles-service.api", () => ({
__esModule: true,
default: { getProfile: vi.fn(), renameProfile: vi.fn() },
+ WELL_KNOWN_DEFAULT_AGENT_PROFILE_NAME: "default",
}));
async function openCreateAndName(name: string) {
@@ -137,7 +143,6 @@ describe("AgentProfilesLocalView save mapping", () => {
buildAgentProfileFields: () => ({
agent_kind: "openhands",
mcp_server_refs: null,
- enable_sub_agents: true,
}),
credentials: { isDirty: false, save: vi.fn(), reset: vi.fn() },
};
@@ -152,7 +157,6 @@ describe("AgentProfilesLocalView save mapping", () => {
profile: {
agent_kind: "openhands",
mcp_server_refs: null,
- enable_sub_agents: true,
llm_profile_ref: "default",
},
});
@@ -207,8 +211,7 @@ describe("AgentProfilesLocalView save mapping", () => {
system_message_suffix: "Be terse.",
condenser: { kind: "NoOpCondenserSettings" },
verification: { critic_enabled: true },
- enable_sub_agents: false,
- enable_switch_llm_tool: false,
+ tools: [{ name: "terminal", params: {} }],
tool_concurrency_limit: 4,
mcp_server_refs: ["github"],
disabled_skills: ["deploy-checklist"],
@@ -226,7 +229,7 @@ describe("AgentProfilesLocalView save mapping", () => {
buildAgentProfileFields: () => ({
agent_kind: "openhands",
mcp_server_refs: ["github"],
- enable_sub_agents: true,
+ tools: [{ name: "grep", params: {} }],
}),
credentials: { isDirty: false, save: vi.fn(), reset: vi.fn() },
};
@@ -236,9 +239,8 @@ describe("AgentProfilesLocalView save mapping", () => {
await user.click(screen.getByTestId("edit-agent-profile"));
await screen.findByTestId("mock-agent-settings");
- // The embedded form is seeded from the stored profile — including
- // `enable_switch_llm_tool`, which the editor now models. (Asserted before
- // the save: a successful save returns to the list and unmounts the form.)
+ // Asserted before the save: a successful save returns to the list and
+ // unmounts the form.
const seededOverride = JSON.parse(
screen
.getByTestId("mock-agent-settings")
@@ -246,8 +248,7 @@ describe("AgentProfilesLocalView save mapping", () => {
);
expect(seededOverride).toMatchObject({
agent_kind: "openhands",
- enable_sub_agents: false,
- enable_switch_llm_tool: false,
+ tools: [{ name: "terminal", params: {} }],
tool_concurrency_limit: 4,
// Without this the picker opens on "all servers" and the save widens the
// profile's scope back to every configured server.
@@ -267,12 +268,11 @@ describe("AgentProfilesLocalView save mapping", () => {
const { profile } = saveMutate.mock.calls[0][0];
expect(profile).toMatchObject({
agent_kind: "openhands",
- enable_sub_agents: true,
+ tools: [{ name: "grep", params: {} }],
llm_profile_ref: "default",
system_message_suffix: "Be terse.",
condenser: { kind: "NoOpCondenserSettings" },
verification: { critic_enabled: true },
- enable_switch_llm_tool: false,
tool_concurrency_limit: 4,
mcp_server_refs: ["github"],
disabled_skills: ["deploy-checklist"],
@@ -282,28 +282,26 @@ describe("AgentProfilesLocalView save mapping", () => {
expect(profile).not.toHaveProperty("revision");
});
- it("seeds the editor with a stored secret scope", async () => {
+ it("seeds tools from a stored profile", async () => {
vi.mocked(AgentProfilesService.getProfile).mockResolvedValue({
name: "default",
profile: {
- schema_version: 2,
+ schema_version: 3,
id: "p-1",
name: "default",
revision: 3,
agent_kind: "openhands",
llm_profile_ref: "default",
- enable_sub_agents: false,
- secret_refs: ["DATADOG_API_KEY"],
+ tools: [{ name: "terminal" }, { name: "task_tool_set" }],
},
} as never);
emitControl = {
agentType: "openhands",
isValid: true,
- isDirty: true,
+ isDirty: false,
buildAgentProfileFields: () => ({
agent_kind: "openhands",
mcp_server_refs: null,
- enable_sub_agents: false,
}),
credentials: { isDirty: false, save: vi.fn(), reset: vi.fn() },
};
@@ -318,10 +316,12 @@ describe("AgentProfilesLocalView save mapping", () => {
.getByTestId("mock-agent-settings")
.getAttribute("data-override") as string,
);
- expect(seededOverride.secret_refs).toEqual(["DATADOG_API_KEY"]);
+ expect(seededOverride).toMatchObject({
+ tools: [{ name: "terminal" }, { name: "task_tool_set" }],
+ });
});
- it("edit-save persists an edited secret scope over the stored value", async () => {
+ it("seeds the editor with a stored secret scope", async () => {
vi.mocked(AgentProfilesService.getProfile).mockResolvedValue({
name: "default",
profile: {
@@ -331,8 +331,7 @@ describe("AgentProfilesLocalView save mapping", () => {
revision: 3,
agent_kind: "openhands",
llm_profile_ref: "default",
- enable_sub_agents: false,
- secret_refs: null,
+ secret_refs: ["DATADOG_API_KEY"],
},
} as never);
emitControl = {
@@ -342,8 +341,6 @@ describe("AgentProfilesLocalView save mapping", () => {
buildAgentProfileFields: () => ({
agent_kind: "openhands",
mcp_server_refs: null,
- enable_sub_agents: false,
- secret_refs: ["DATADOG_API_KEY"],
}),
credentials: { isDirty: false, save: vi.fn(), reset: vi.fn() },
};
@@ -352,28 +349,26 @@ describe("AgentProfilesLocalView save mapping", () => {
const user = userEvent.setup();
await user.click(screen.getByTestId("edit-agent-profile"));
await screen.findByTestId("mock-agent-settings");
- await user.click(screen.getByTestId("save-agent-profile-btn"));
- await waitFor(() => expect(saveMutate).toHaveBeenCalledTimes(1));
- const { profile } = saveMutate.mock.calls[0][0];
- expect(profile.secret_refs).toEqual(["DATADOG_API_KEY"]);
+ const seededOverride = JSON.parse(
+ screen
+ .getByTestId("mock-agent-settings")
+ .getAttribute("data-override") as string,
+ );
+ expect(seededOverride.secret_refs).toEqual(["DATADOG_API_KEY"]);
});
- it("edit-save persists an edited enable_switch_llm_tool over the stored value", async () => {
- // The stored profile has the tool disabled; the embedded form's builder
- // emits the edited value, which must win over the stored one in the
- // whole-profile overwrite.
+ it("edit-save persists an edited secret scope over the stored value", async () => {
vi.mocked(AgentProfilesService.getProfile).mockResolvedValue({
name: "default",
profile: {
- schema_version: 1,
+ schema_version: 2,
id: "p-1",
name: "default",
revision: 3,
agent_kind: "openhands",
llm_profile_ref: "default",
- enable_sub_agents: false,
- enable_switch_llm_tool: false,
+ secret_refs: null,
},
} as never);
emitControl = {
@@ -383,8 +378,7 @@ describe("AgentProfilesLocalView save mapping", () => {
buildAgentProfileFields: () => ({
agent_kind: "openhands",
mcp_server_refs: null,
- enable_sub_agents: false,
- enable_switch_llm_tool: true,
+ secret_refs: ["DATADOG_API_KEY"],
}),
credentials: { isDirty: false, save: vi.fn(), reset: vi.fn() },
};
@@ -397,7 +391,7 @@ describe("AgentProfilesLocalView save mapping", () => {
await waitFor(() => expect(saveMutate).toHaveBeenCalledTimes(1));
const { profile } = saveMutate.mock.calls[0][0];
- expect(profile.enable_switch_llm_tool).toBe(true);
+ expect(profile.secret_refs).toEqual(["DATADOG_API_KEY"]);
});
it("kind-switch edit-save sends a clean variant payload", async () => {
@@ -464,7 +458,6 @@ describe("AgentProfilesLocalView save mapping", () => {
revision: 3,
agent_kind: "openhands",
llm_profile_ref: "deleted-profile",
- enable_sub_agents: false,
},
} as never);
emitControl = {
@@ -474,7 +467,6 @@ describe("AgentProfilesLocalView save mapping", () => {
buildAgentProfileFields: () => ({
agent_kind: "openhands",
mcp_server_refs: null,
- enable_sub_agents: false,
}),
credentials: { isDirty: false, save: vi.fn(), reset: vi.fn() },
};
@@ -503,7 +495,6 @@ describe("AgentProfilesLocalView save mapping", () => {
revision: 1,
agent_kind: "openhands",
llm_profile_ref: "default",
- enable_sub_agents: false,
},
} as never);
emitControl = {
@@ -513,7 +504,6 @@ describe("AgentProfilesLocalView save mapping", () => {
buildAgentProfileFields: () => ({
agent_kind: "openhands",
mcp_server_refs: null,
- enable_sub_agents: false,
}),
credentials: { isDirty: false, save: vi.fn(), reset: vi.fn() },
};
@@ -534,7 +524,6 @@ describe("AgentProfilesLocalView save mapping", () => {
buildAgentProfileFields: () => ({
agent_kind: "openhands",
mcp_server_refs: null,
- enable_sub_agents: false,
}),
credentials: { isDirty: false, save: vi.fn(), reset: vi.fn() },
};
diff --git a/__tests__/components/settings/agent-profiles/global-tools-notice.test.tsx b/__tests__/components/settings/agent-profiles/global-tools-notice.test.tsx
new file mode 100644
index 0000000000..7fa87721e1
--- /dev/null
+++ b/__tests__/components/settings/agent-profiles/global-tools-notice.test.tsx
@@ -0,0 +1,66 @@
+import { render, screen } from "@testing-library/react";
+import userEvent from "@testing-library/user-event";
+import { beforeEach, describe, expect, it, vi } from "vitest";
+import { GlobalToolsNotice } from "#/components/features/settings/agent-profiles/global-tools-notice";
+
+vi.mock("react-i18next", () => ({
+ useTranslation: () => ({
+ t: (key: string, options?: { names?: string }) =>
+ options?.names ? `${key}:${options.names}` : key,
+ }),
+}));
+
+let agentSettings: Record<string, unknown> | undefined;
+vi.mock("#/hooks/query/use-settings", () => ({
+ useSettings: () => ({ data: { agent_settings: agentSettings } }),
+}));
+
+const saveSettings = vi.fn();
+vi.mock("#/hooks/mutation/use-save-settings", () => ({
+ useSaveSettings: () => ({ mutate: saveSettings, isPending: false }),
+}));
+
+vi.mock("#/utils/custom-toast-handlers");
+
+describe("GlobalToolsNotice", () => {
+ beforeEach(() => {
+ saveSettings.mockReset();
+ });
+
+ it.each([
+ ["unset", { agent_kind: "openhands" }],
+ ["null", { agent_kind: "openhands", tools: null }],
+ ["an ACP agent", { agent_kind: "acp", tools: [{ name: "terminal" }] }],
+ ])("stays hidden when global tools are %s", (_label, settings) => {
+ agentSettings = settings;
+ render(<GlobalToolsNotice />);
+ expect(screen.queryByTestId("global-tools-notice")).toBeNull();
+ });
+
+ it("lists a custom global tool list and resets it to the standard set", async () => {
+ agentSettings = {
+ agent_kind: "openhands",
+ tools: [
+ { name: "terminal", params: {} },
+ { name: "task_tool_set", params: {} },
+ ],
+ };
+ render(<GlobalToolsNotice />);
+
+ expect(screen.getByTestId("global-tools-notice")).toHaveTextContent(
+ "terminal, task_tool_set",
+ );
+ await userEvent.setup().click(screen.getByTestId("global-tools-reset"));
+
+ expect(saveSettings).toHaveBeenCalledWith(
+ { agent_settings_diff: { tools: null } },
+ expect.any(Object),
+ );
+ });
+
+ it("shows an explicitly bare global tool list", () => {
+ agentSettings = { agent_kind: "openhands", tools: [] };
+ render(<GlobalToolsNotice />);
+ expect(screen.getByTestId("global-tools-notice")).toBeInTheDocument();
+ });
+});
diff --git a/__tests__/components/settings/agent-profiles/merge-agent-profile-save-input.test.ts b/__tests__/components/settings/agent-profiles/merge-agent-profile-save-input.test.ts
index 0c889b9289..da0a57a4e9 100644
--- a/__tests__/components/settings/agent-profiles/merge-agent-profile-save-input.test.ts
+++ b/__tests__/components/settings/agent-profiles/merge-agent-profile-save-input.test.ts
@@ -29,8 +29,7 @@ const storedOpenHands = {
critic_server_url: null,
critic_model_name: null,
},
- enable_sub_agents: false,
- enable_switch_llm_tool: false,
+ tools: [{ name: "terminal", params: {} }],
tool_concurrency_limit: 4,
mcp_server_refs: ["github"],
disabled_skills: ["deploy-checklist"],
@@ -53,18 +52,18 @@ const storedAcp = {
describe("mergeAgentProfileSaveInput", () => {
it("preserves unmodeled OpenHands fields under the edited ones", () => {
- const edited: AgentProfileSaveInput = {
+ const edited = {
agent_kind: "openhands",
- enable_sub_agents: true,
+ tools: [{ name: "grep", params: {} }],
llm_profile_ref: "new-llm",
- };
+ } as unknown as AgentProfileSaveInput;
const merged = mergeAgentProfileSaveInput(storedOpenHands, edited);
// Edited fields win.
expect(merged).toMatchObject({
agent_kind: "openhands",
- enable_sub_agents: true,
+ tools: [{ name: "grep", params: {} }],
llm_profile_ref: "new-llm",
});
// Fields the editor doesn't model survive the whole-profile overwrite.
@@ -74,27 +73,10 @@ describe("mergeAgentProfileSaveInput", () => {
system_message_suffix: "Be terse.",
mcp_server_refs: ["github"],
disabled_skills: ["deploy-checklist"],
- enable_switch_llm_tool: false,
tool_concurrency_limit: 4,
});
});
- it("lets an edited enable_switch_llm_tool win over the stored value", () => {
- // The editor now models the field, so an edited value must override the
- // stored one rather than being carried under it. The field rides untyped
- // (the pinned ts-client predates it), hence the cast.
- const edited = {
- agent_kind: "openhands",
- enable_sub_agents: false,
- enable_switch_llm_tool: true,
- llm_profile_ref: "new-llm",
- } as unknown as AgentProfileSaveInput;
-
- const merged = mergeAgentProfileSaveInput(storedOpenHands, edited);
-
- expect(merged).toMatchObject({ enable_switch_llm_tool: true });
- });
-
it("preserves unmodeled ACP fields under the edited ones", () => {
const edited: AgentProfileSaveInput = {
agent_kind: "acp",
@@ -118,7 +100,6 @@ describe("mergeAgentProfileSaveInput", () => {
it("strips server-managed identity from the merge", () => {
const merged = mergeAgentProfileSaveInput(storedOpenHands, {
agent_kind: "openhands",
- enable_sub_agents: true,
llm_profile_ref: "new-llm",
});
@@ -146,10 +127,51 @@ describe("mergeAgentProfileSaveInput", () => {
it("passes the edited fields through on create (no stored profile)", () => {
const edited: AgentProfileSaveInput = {
agent_kind: "openhands",
- enable_sub_agents: false,
llm_profile_ref: "default",
};
expect(mergeAgentProfileSaveInput(null, edited)).toEqual(edited);
});
});
+
+describe("mergeAgentProfileSaveInput tools", () => {
+ it("round-trips stored tools the draft leaves out", () => {
+ const stored = {
+ ...storedOpenHands,
+ tools: [{ name: "switch_llm", params: { x: 1 } }],
+ } as unknown as AgentProfile;
+ const edited = {
+ agent_kind: "openhands",
+ mcp_server_refs: null,
+ tool_concurrency_limit: 2,
+ } as AgentProfileSaveInput;
+
+ expect(mergeAgentProfileSaveInput(stored, edited)).toMatchObject({
+ tools: [{ name: "switch_llm", params: { x: 1 } }],
+ tool_concurrency_limit: 2,
+ });
+ });
+
+ it.each([[[{ name: "terminal", params: {} }]], [null]])(
+ "replaces the stored tools with the draft's %j",
+ (tools) => {
+ const stored = {
+ ...storedOpenHands,
+ tools: [
+ { name: "terminal", params: {} },
+ { name: "switch_llm", params: {} },
+ ],
+ } as unknown as AgentProfile;
+ const edited = {
+ agent_kind: "openhands",
+ mcp_server_refs: null,
+ tools,
+ } as unknown as AgentProfileSaveInput;
+
+ expect(mergeAgentProfileSaveInput(stored, edited)).toMatchObject({
+ tools,
+ system_message_suffix: "Be terse.",
+ });
+ },
+ );
+});
diff --git a/__tests__/constants/profile-tools.test.ts b/__tests__/constants/profile-tools.test.ts
new file mode 100644
index 0000000000..2ea658b6b0
--- /dev/null
+++ b/__tests__/constants/profile-tools.test.ts
@@ -0,0 +1,90 @@
+import { describe, expect, it } from "vitest";
+
+import {
+ buildProfileToolsValue,
+ readProfileTools,
+} from "#/constants/profile-tools";
+
+describe("readProfileTools", () => {
+ it.each([[null], [undefined], ["terminal"], [{}]])(
+ "reads %s as the server's standard set",
+ (value) => {
+ expect(readProfileTools(value)).toEqual({
+ mode: "standard",
+ selected: [],
+ params: {},
+ });
+ },
+ );
+
+ it("reads an explicit list, keeping params the editor does not model", () => {
+ expect(
+ readProfileTools([
+ { name: "terminal", params: { username: "dev" } },
+ { name: "glob" },
+ ]),
+ ).toEqual({
+ mode: "custom",
+ selected: ["terminal", "glob"],
+ params: { terminal: { username: "dev" }, glob: {} },
+ });
+ });
+
+ it("keeps the first entry of a repeated tool", () => {
+ expect(
+ readProfileTools([
+ { name: "switch_llm", params: { a: 1 } },
+ { name: "switch_llm" },
+ ]),
+ ).toEqual({
+ mode: "custom",
+ selected: ["switch_llm"],
+ params: { switch_llm: { a: 1 } },
+ });
+ });
+
+ it.each(["constructor", "toString", "__proto__"])(
+ "keeps a tool named %s",
+ (name) => {
+ const read = readProfileTools([{ name, params: { x: 1 } }]);
+ expect(read.selected).toEqual([name]);
+ expect(buildProfileToolsValue({ ...read, mode: "custom" })).toEqual([
+ { name, params: { x: 1 } },
+ ]);
+ },
+ );
+
+ it("reads an empty list as a deliberately bare agent, not as standard", () => {
+ expect(readProfileTools([])).toMatchObject({
+ mode: "custom",
+ selected: [],
+ });
+ });
+});
+
+describe("buildProfileToolsValue", () => {
+ it("saves null for standard so the server keeps deciding", () => {
+ expect(
+ buildProfileToolsValue({ mode: "standard", selected: ["terminal"] }),
+ ).toBeNull();
+ });
+
+ it("saves the selection with its stored params", () => {
+ expect(
+ buildProfileToolsValue({
+ mode: "custom",
+ selected: ["terminal", "glob"],
+ params: { terminal: { username: "dev" } },
+ }),
+ ).toEqual([
+ { name: "terminal", params: { username: "dev" } },
+ { name: "glob", params: {} },
+ ]);
+ });
+
+ it("round-trips an explicit selection", () => {
+ const stored = [{ name: "glob", params: {} }];
+ const { mode, selected, params } = readProfileTools(stored);
+ expect(buildProfileToolsValue({ mode, selected, params })).toEqual(stored);
+ });
+});
diff --git a/__tests__/hooks/query/use-backends-health.test.tsx b/__tests__/hooks/query/use-backends-health.test.tsx
index 0794b670e0..f323c64a87 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.48.0" });
+ getServerInfoMock.mockResolvedValue({ version: "1.52.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.47.0 or newer; this backend is running 1.27.1. Please upgrade the agent-server backend.",
+ "Agent Canvas requires agent-server 1.51.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__/hooks/query/use-tool-catalog.test.tsx b/__tests__/hooks/query/use-tool-catalog.test.tsx
new file mode 100644
index 0000000000..98f6ffa341
--- /dev/null
+++ b/__tests__/hooks/query/use-tool-catalog.test.tsx
@@ -0,0 +1,60 @@
+import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
+import { renderHook, waitFor } from "@testing-library/react";
+import type { ReactNode } from "react";
+import { beforeEach, expect, it, vi } from "vitest";
+import ToolCatalogService from "#/api/tool-catalog-service/tool-catalog-service.api";
+import type { Backend } from "#/api/backend-registry/types";
+import { useToolCatalog } from "#/hooks/query/use-tool-catalog";
+
+const activeBackend = vi.hoisted(() => ({ current: null as Backend | null }));
+vi.mock("#/contexts/active-backend-context", () => ({
+ useActiveBackend: () => ({ backend: activeBackend.current, orgId: null }),
+}));
+
+const local = (host: string): Backend => ({
+ id: "local",
+ name: "local",
+ host,
+ apiKey: "",
+ kind: "local",
+});
+
+function wrapper({ children }: { children: ReactNode }) {
+ return (
+ <QueryClientProvider
+ client={
+ new QueryClient({ defaultOptions: { queries: { retry: false } } })
+ }
+ >
+ {children}
+ </QueryClientProvider>
+ );
+}
+
+beforeEach(() => {
+ vi.restoreAllMocks();
+ activeBackend.current = local("http://a.test");
+});
+
+it("asks the backend for its catalog without a capability check", async () => {
+ vi.spyOn(ToolCatalogService, "getCatalog").mockResolvedValue([]);
+ const { result } = renderHook(() => useToolCatalog(), { wrapper });
+
+ await waitFor(() => expect(result.current.data).toEqual([]));
+ expect(ToolCatalogService.getCatalog).toHaveBeenCalledTimes(1);
+});
+
+it("refetches when the backend's host changes", async () => {
+ vi.spyOn(ToolCatalogService, "getCatalog").mockResolvedValue([]);
+ const { result, rerender } = renderHook(() => useToolCatalog(), {
+ wrapper,
+ });
+ await waitFor(() => expect(result.current.data).toEqual([]));
+
+ activeBackend.current = local("http://b.test");
+ rerender();
+
+ await waitFor(() =>
+ expect(ToolCatalogService.getCatalog).toHaveBeenCalledTimes(2),
+ );
+});
diff --git a/__tests__/root.test.tsx b/__tests__/root.test.tsx
index 8f2d7585a7..3e3451c37f 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.48.0" }),
+ HttpResponse.json({ uptime: 0, idle_time: 0, version: "1.52.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.48.0" }),
+ HttpResponse.json({ uptime: 0, idle_time: 0, version: "1.52.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.48.0" }),
+ HttpResponse.json({ uptime: 0, idle_time: 0, version: "1.52.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.48.0" }),
+ HttpResponse.json({ uptime: 0, idle_time: 0, version: "1.52.0" }),
),
);
diff --git a/__tests__/routes/agent-settings-tool-selection.test.tsx b/__tests__/routes/agent-settings-tool-selection.test.tsx
new file mode 100644
index 0000000000..4dbfd97bf0
--- /dev/null
+++ b/__tests__/routes/agent-settings-tool-selection.test.tsx
@@ -0,0 +1,314 @@
+import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
+import { act, render, screen, waitFor } from "@testing-library/react";
+import userEvent from "@testing-library/user-event";
+import { MemoryRouter } from "react-router";
+import { afterEach, beforeEach, expect, it, vi } from "vitest";
+import ToolCatalogService from "#/api/tool-catalog-service/tool-catalog-service.api";
+import {
+ __resetActiveStoreForTests,
+ setActiveSelection,
+ setRegisteredBackends,
+} from "#/api/backend-registry/active-store";
+import {
+ AgentSettingsScreen,
+ type AgentSettingsSaveControl,
+} from "#/routes/agent-settings";
+
+const CATALOG = [
+ {
+ name: "terminal",
+ user_selectable: true,
+ usable: true,
+ in_default_set: true,
+ description: "Run shell commands",
+ },
+];
+
+beforeEach(() => {
+ vi.restoreAllMocks();
+ vi.spyOn(ToolCatalogService, "getCatalog").mockResolvedValue(CATALOG);
+});
+
+afterEach(() => {
+ setActiveSelection(null);
+ setRegisteredBackends([]);
+ __resetActiveStoreForTests();
+});
+
+it.each([false, true])(
+ "initializes a custom selection once the catalog arrives (explicitly cleared: %s)",
+ async (clearWhilePending) => {
+ const user = userEvent.setup();
+ let resolveCatalog!: (catalog: typeof CATALOG) => void;
+ vi.mocked(ToolCatalogService.getCatalog).mockReturnValue(
+ new Promise((resolve) => {
+ resolveCatalog = resolve;
+ }),
+ );
+ let control: AgentSettingsSaveControl | null = null;
+ render(
+ <MemoryRouter>
+ <QueryClientProvider
+ client={
+ new QueryClient({ defaultOptions: { queries: { retry: false } } })
+ }
+ >
+ <AgentSettingsScreen
+ agentSettingsOverride={{
+ agent_kind: "openhands",
+ tools: clearWhilePending ? [] : null,
+ }}
+ onSaveControlChange={(next) => {
+ control = next;
+ }}
+ />
+ </QueryClientProvider>
+ </MemoryRouter>,
+ );
+ if (!clearWhilePending) {
+ expect(
+ await screen.findByTestId("agent-settings-tools-mode"),
+ ).toBeDisabled();
+ }
+ await act(async () => resolveCatalog(CATALOG));
+ if (!clearWhilePending) {
+ await user.click(screen.getByTestId("agent-settings-tools-mode"));
+ await user.click(
+ await screen.findByRole("option", {
+ name: "SETTINGS$AGENT_PROFILE_TOOLS_CHOOSE",
+ }),
+ );
+ }
+ await waitFor(() =>
+ expect(control!.buildAgentProfileFields()).toMatchObject({
+ tools: clearWhilePending ? [] : [{ name: "terminal", params: {} }],
+ }),
+ );
+ expect(control!.isValid).toBe(true);
+ },
+);
+
+it.each(["saved", "cleared"] as const)(
+ "preserves a %s empty tool selection across mode changes",
+ async (selection) => {
+ const user = userEvent.setup();
+ let control: AgentSettingsSaveControl | null = null;
+ render(
+ <MemoryRouter>
+ <QueryClientProvider
+ client={
+ new QueryClient({
+ defaultOptions: { queries: { retry: false } },
+ })
+ }
+ >
+ <AgentSettingsScreen
+ agentSettingsOverride={{
+ agent_kind: "openhands",
+ tools: selection === "saved" ? [] : null,
+ }}
+ onSaveControlChange={(next) => {
+ control = next;
+ }}
+ />
+ </QueryClientProvider>
+ </MemoryRouter>,
+ );
+ const setMode = async (mode: "STANDARD" | "CHOOSE") => {
+ await user.click(screen.getByTestId("agent-settings-tools-mode"));
+ await user.click(
+ await screen.findByRole("option", {
+ name: `SETTINGS$AGENT_PROFILE_TOOLS_${mode}`,
+ }),
+ );
+ };
+ await waitFor(() =>
+ expect(
+ screen.getByTestId("agent-settings-tools-mode"),
+ ).not.toBeDisabled(),
+ );
+ if (selection === "cleared") {
+ await setMode("CHOOSE");
+ await user.click(
+ await screen.findByTestId("agent-settings-tool-terminal"),
+ );
+ }
+
+ await setMode("STANDARD");
+ await setMode("CHOOSE");
+
+ expect(
+ screen.getByTestId("agent-settings-tool-terminal"),
+ ).not.toBeChecked();
+ expect(control!.buildAgentProfileFields()).toMatchObject({ tools: [] });
+ },
+);
+
+it("reports a failed catalog load and recovers on retry", async () => {
+ const user = userEvent.setup();
+ vi.mocked(ToolCatalogService.getCatalog)
+ .mockRejectedValueOnce(new Error("proxy 502"))
+ .mockResolvedValue(CATALOG);
+ render(
+ <MemoryRouter>
+ <QueryClientProvider
+ client={
+ new QueryClient({ defaultOptions: { queries: { retry: false } } })
+ }
+ >
+ <AgentSettingsScreen
+ agentSettingsOverride={{ agent_kind: "openhands", tools: null }}
+ onSaveControlChange={() => {}}
+ />
+ </QueryClientProvider>
+ </MemoryRouter>,
+ );
+
+ expect(
+ await screen.findByTestId("agent-settings-tools-load-failed"),
+ ).toHaveTextContent("SETTINGS$AGENT_PROFILE_TOOLS_LOAD_FAILED");
+
+ await user.click(screen.getByTestId("agent-settings-tools-retry"));
+
+ expect(
+ await screen.findByTestId("agent-settings-tool-terminal"),
+ ).toBeChecked();
+ expect(
+ screen.queryByTestId("agent-settings-tools-load-failed"),
+ ).not.toBeInTheDocument();
+ expect(screen.getByTestId("agent-settings-tools-mode")).not.toBeDisabled();
+});
+
+it("locks a custom selection until the catalog loads", async () => {
+ vi.mocked(ToolCatalogService.getCatalog).mockReturnValue(
+ new Promise(() => {}),
+ );
+ render(
+ <MemoryRouter>
+ <QueryClientProvider
+ client={
+ new QueryClient({ defaultOptions: { queries: { retry: false } } })
+ }
+ >
+ <AgentSettingsScreen
+ agentSettingsOverride={{
+ agent_kind: "openhands",
+ tools: [{ name: "terminal", params: {} }],
+ }}
+ onSaveControlChange={() => {}}
+ />
+ </QueryClientProvider>
+ </MemoryRouter>,
+ );
+
+ expect(
+ await screen.findByTestId("agent-settings-tool-terminal"),
+ ).toBeDisabled();
+});
+
+it("describes a stored tool the picker would otherwise filter out", async () => {
+ vi.mocked(ToolCatalogService.getCatalog).mockResolvedValue([
+ ...CATALOG,
+ {
+ name: "browser_tool_set",
+ user_selectable: true,
+ usable: false,
+ in_default_set: true,
+ description: "Browse the web",
+ },
+ ]);
+ render(
+ <MemoryRouter>
+ <QueryClientProvider
+ client={
+ new QueryClient({ defaultOptions: { queries: { retry: false } } })
+ }
+ >
+ <AgentSettingsScreen
+ agentSettingsOverride={{
+ agent_kind: "openhands",
+ tools: [{ name: "browser_tool_set", params: {} }],
+ }}
+ onSaveControlChange={() => {}}
+ />
+ </QueryClientProvider>
+ </MemoryRouter>,
+ );
+
+ expect(
+ await screen.findByTestId("agent-settings-tool-list"),
+ ).toHaveTextContent("Browse the web");
+});
+
+it("hides tools on a cloud backend and leaves the stored selection alone", async () => {
+ setRegisteredBackends([
+ {
+ id: "cloud",
+ name: "cloud",
+ host: "https://app.example.test",
+ apiKey: "cloud-key",
+ kind: "cloud",
+ },
+ ]);
+ setActiveSelection({ backendId: "cloud" });
+ let control: AgentSettingsSaveControl | null = null;
+ render(
+ <MemoryRouter>
+ <QueryClientProvider
+ client={
+ new QueryClient({ defaultOptions: { queries: { retry: false } } })
+ }
+ >
+ <AgentSettingsScreen
+ agentSettingsOverride={{
+ agent_kind: "openhands",
+ tools: [{ name: "terminal", params: {} }],
+ }}
+ onSaveControlChange={(next) => {
+ control = next;
+ }}
+ />
+ </QueryClientProvider>
+ </MemoryRouter>,
+ );
+
+ await waitFor(() => expect(control).not.toBeNull());
+ expect(
+ screen.queryByTestId("agent-settings-tools-mode"),
+ ).not.toBeInTheDocument();
+ expect(ToolCatalogService.getCatalog).not.toHaveBeenCalled();
+ expect(control!.buildAgentProfileFields()).not.toHaveProperty("tools");
+});
+
+it("points the default profile to a named profile instead of offering tools", async () => {
+ let control: AgentSettingsSaveControl | null = null;
+ render(
+ <MemoryRouter>
+ <QueryClientProvider
+ client={
+ new QueryClient({ defaultOptions: { queries: { retry: false } } })
+ }
+ >
+ <AgentSettingsScreen
+ agentSettingsOverride={{
+ agent_kind: "openhands",
+ tools: [{ name: "terminal", params: {} }],
+ }}
+ onSaveControlChange={(next) => {
+ control = next;
+ }}
+ isDefaultProfile
+ />
+ </QueryClientProvider>
+ </MemoryRouter>,
+ );
+
+ expect(
+ await screen.findByTestId("agent-settings-tools-default-profile"),
+ ).toHaveTextContent("SETTINGS$AGENT_PROFILE_TOOLS_DEFAULT_PROFILE");
+ expect(
+ screen.queryByTestId("agent-settings-tools-mode"),
+ ).not.toBeInTheDocument();
+ expect(ToolCatalogService.getCatalog).not.toHaveBeenCalled();
+ expect(control!.buildAgentProfileFields()).not.toHaveProperty("tools");
+});
diff --git a/__tests__/routes/agent-settings.test.tsx b/__tests__/routes/agent-settings.test.tsx
index dbf60bd588..bde6b5d051 100644
--- a/__tests__/routes/agent-settings.test.tsx
+++ b/__tests__/routes/agent-settings.test.tsx
@@ -24,14 +24,10 @@ vi.mock("#/hooks/query/use-acp-auth-status", () => ({
useAcpAuthStatus: (...args: unknown[]) => acpAuthStatusMock(...args),
}));
-// The LLM-switching toggle is gated on the backend's *profile* model, which
-// gained the field later than the settings schema did. Stub the probe so both
-// sides of that gate are reachable without a live server.
-const profileSupportsSwitchLlmToolMock = vi.hoisted(() => vi.fn(() => true));
const profileSupportsSecretRefsMock = vi.hoisted(() => vi.fn(() => true));
vi.mock("#/api/agent-profiles-service/profile-field-support", () => ({
- agentProfileSupportsSwitchLlmTool: () => profileSupportsSwitchLlmToolMock(),
agentProfileSupportsSecretRefs: () => profileSupportsSecretRefsMock(),
+ agentProfileSupportsTools: () => true,
}));
// The secret picker lists the user's saved secrets; stub the query so these
@@ -115,7 +111,6 @@ describe("AgentSettingsScreen", () => {
toastMocks.success.mockClear();
toastMocks.error.mockClear();
toastMocks.warning.mockClear();
- profileSupportsSwitchLlmToolMock.mockReturnValue(true);
profileSupportsSecretRefsMock.mockReturnValue(true);
savedSecretsMock.mockReturnValue([
{ name: "GITHUB_TOKEN", description: "repo access" },
@@ -124,108 +119,6 @@ describe("AgentSettingsScreen", () => {
]);
});
- it("renders the agent type selector defaulting to OpenHands with sub-agents toggle", async () => {
- renderAgentSettingsScreen({
- agentSettingsOverride: { agent_kind: "openhands" },
- });
- await screen.findByTestId("agent-settings-screen");
-
- expect(screen.getByLabelText("SETTINGS$NAV_AGENT")).toHaveValue(
- "SETTINGS$AGENT_TYPE_OPENHANDS",
- );
- expect(
- screen.getByTestId("agent-settings-enable-sub-agents"),
- ).toBeInTheDocument();
- expect(screen.queryByTestId("agent-command-input")).not.toBeInTheDocument();
- });
-
- it("builds enable_sub_agents from its toggle", async () => {
- const user = userEvent.setup();
- const { control } = renderAgentSettingsScreen({
- agentSettingsOverride: {
- agent_kind: "openhands",
- enable_sub_agents: false,
- },
- });
- await screen.findByTestId("agent-settings-screen");
-
- const toggle = screen.getByTestId("agent-settings-enable-sub-agents");
- await user.click(toggle.closest("label")!);
-
- expect(control().buildAgentProfileFields()).toMatchObject({
- enable_sub_agents: true,
- });
- });
-
- it("builds enable_switch_llm_tool from its toggle", async () => {
- const user = userEvent.setup();
- const { control } = renderAgentSettingsScreen({
- agentSettingsOverride: {
- agent_kind: "openhands",
- enable_switch_llm_tool: true,
- },
- });
- await screen.findByTestId("agent-settings-screen");
-
- const toggle = screen.getByTestId("agent-settings-enable-switch-llm-tool");
- expect(toggle).toBeChecked();
- await user.click(toggle.closest("label")!);
-
- expect(toggle).not.toBeChecked();
- expect(control().buildAgentProfileFields()).toMatchObject({
- enable_switch_llm_tool: false,
- });
- });
-
- it("hides the LLM-switching toggle when the schema predates the field", async () => {
- const schema = MOCK_DEFAULT_USER_SETTINGS.agent_settings_schema;
- const schemaWithoutField = schema && {
- ...schema,
- sections: schema.sections.map((section) => ({
- ...section,
- fields: section.fields.filter(
- (field) => field.key !== "enable_switch_llm_tool",
- ),
- })),
- };
- vi.spyOn(SettingsService, "getSettings").mockResolvedValue(
- buildSettings({ agent_settings_schema: schemaWithoutField }),
- );
-
- renderAgentSettingsScreen({
- agentSettingsOverride: { agent_kind: "openhands" },
- });
- await screen.findByTestId("agent-settings-screen");
-
- // Older agent-servers without the field hide the toggle cleanly...
- expect(
- screen.queryByTestId("agent-settings-enable-switch-llm-tool"),
- ).not.toBeInTheDocument();
- // ...while the other OpenHands controls still render.
- expect(
- screen.getByTestId("agent-settings-enable-sub-agents"),
- ).toBeInTheDocument();
- });
-
- it("hides the LLM-switching toggle when the profile model predates the field", async () => {
- // agent-server 1.29.0–1.30.x advertises the field in the settings schema
- // while `OpenHandsAgentProfile` still rejects it. Rendering the toggle
- // there would offer a control whose save the server refuses outright.
- profileSupportsSwitchLlmToolMock.mockReturnValue(false);
-
- renderAgentSettingsScreen({
- agentSettingsOverride: { agent_kind: "openhands" },
- });
- await screen.findByTestId("agent-settings-screen");
-
- expect(
- screen.queryByTestId("agent-settings-enable-switch-llm-tool"),
- ).not.toBeInTheDocument();
- expect(
- screen.getByTestId("agent-settings-enable-sub-agents"),
- ).toBeInTheDocument();
- });
-
it("builds tool_concurrency_limit from the input on the OpenHands path", async () => {
const user = userEvent.setup();
const { control } = renderAgentSettingsScreen({
@@ -247,27 +140,6 @@ describe("AgentSettingsScreen", () => {
});
});
- it("hides the sub-agents toggle when ACP is selected", async () => {
- const user = userEvent.setup();
- renderAgentSettingsScreen({
- agentSettingsOverride: { agent_kind: "openhands" },
- });
- await screen.findByTestId("agent-settings-screen");
- expect(
- screen.getByTestId("agent-settings-enable-sub-agents"),
- ).toBeInTheDocument();
-
- await user.click(screen.getByTestId("agent-type-selector"));
- await user.click(
- await screen.findByRole("option", { name: "SETTINGS$AGENT_TYPE_ACP" }),
- );
-
- expect(
- screen.queryByTestId("agent-settings-enable-sub-agents"),
- ).not.toBeInTheDocument();
- expect(screen.getByTestId("agent-command-input")).toBeInTheDocument();
- });
-
it("opens a stored ACP profile on its command and custom model", async () => {
// A model ID outside the provider's suggestions falls through to the
// custom input; known IDs go through the dropdown instead.
@@ -413,8 +285,7 @@ describe("AgentSettingsScreen", () => {
agent_kind: "openhands",
mcp_server_refs: null,
secret_refs: null,
- enable_sub_agents: false,
- enable_switch_llm_tool: true,
+ tools: null,
tool_concurrency_limit: 1,
});
});
@@ -595,7 +466,6 @@ describe("AgentSettingsScreen — MCP server scope", () => {
renderAgentSettingsScreen({
agentSettingsOverride: {
agent_kind: "openhands",
- enable_sub_agents: false,
mcp_server_refs: null,
},
onSaveControlChange: (next) => {
@@ -618,7 +488,6 @@ describe("AgentSettingsScreen — MCP server scope", () => {
renderAgentSettingsScreen({
agentSettingsOverride: {
agent_kind: "openhands",
- enable_sub_agents: false,
mcp_server_refs: ["github"],
},
onSaveControlChange: (next) => {
@@ -642,7 +511,6 @@ describe("AgentSettingsScreen — MCP server scope", () => {
renderAgentSettingsScreen({
agentSettingsOverride: {
agent_kind: "openhands",
- enable_sub_agents: false,
mcp_server_refs: null,
},
onSaveControlChange: (next) => {
@@ -675,7 +543,6 @@ describe("AgentSettingsScreen — MCP server scope", () => {
renderAgentSettingsScreen({
agentSettingsOverride: {
agent_kind: "openhands",
- enable_sub_agents: false,
mcp_server_refs: ["github", "deleted-server"],
},
});
@@ -716,7 +583,6 @@ describe("AgentSettingsScreen — MCP server scope", () => {
renderAgentSettingsScreen({
agentSettingsOverride: {
agent_kind: "openhands",
- enable_sub_agents: false,
},
});
await screen.findByTestId("agent-settings-screen");
@@ -751,7 +617,6 @@ describe("AgentSettingsScreen — MCP scope dirty tracking", () => {
renderAgentSettingsScreen({
agentSettingsOverride: {
agent_kind: "openhands",
- enable_sub_agents: false,
mcp_server_refs: refs,
},
onSaveControlChange: (next) => {
@@ -803,7 +668,6 @@ describe("AgentSettingsScreen — MCP scope dirty tracking", () => {
renderAgentSettingsScreen({
agentSettingsOverride: {
agent_kind: "openhands",
- enable_sub_agents: false,
secret_refs: null,
},
onSaveControlChange: (next) => {
@@ -832,7 +696,6 @@ describe("AgentSettingsScreen — MCP scope dirty tracking", () => {
renderAgentSettingsScreen({
agentSettingsOverride: {
agent_kind: "openhands",
- enable_sub_agents: false,
secret_refs: ["DATADOG_API_KEY"],
},
onSaveControlChange: (next) => {
@@ -860,7 +723,6 @@ describe("AgentSettingsScreen — MCP scope dirty tracking", () => {
renderAgentSettingsScreen({
agentSettingsOverride: {
agent_kind: "openhands",
- enable_sub_agents: false,
secret_refs: ["DELETED_SECRET"],
},
onSaveControlChange: (next) => {
@@ -1080,7 +942,6 @@ describe("AgentSettingsScreen — MCP scope dirty tracking", () => {
renderAgentSettingsScreen({
agentSettingsOverride: {
agent_kind: "openhands",
- enable_sub_agents: false,
},
onSaveControlChange: (next) => {
control = next;
@@ -1110,7 +971,6 @@ describe("AgentSettingsScreen — MCP scope dirty tracking", () => {
renderAgentSettingsScreen({
agentSettingsOverride: {
agent_kind: "openhands",
- enable_sub_agents: false,
},
onSaveControlChange: (next) => {
control = next;
@@ -1132,7 +992,6 @@ describe("AgentSettingsScreen — MCP scope dirty tracking", () => {
renderAgentSettingsScreen({
agentSettingsOverride: {
agent_kind: "openhands",
- enable_sub_agents: false,
},
});
await screen.findByTestId("agent-settings-screen");
diff --git a/__tests__/routes/build-agent-profile-fields.test.ts b/__tests__/routes/build-agent-profile-fields.test.ts
index 0f0e93f534..51b7ad3745 100644
--- a/__tests__/routes/build-agent-profile-fields.test.ts
+++ b/__tests__/routes/build-agent-profile-fields.test.ts
@@ -8,10 +8,6 @@ const baseAcp = {
isDefaultProviderCommand: true,
commandTokens: ["npx", "-y", "@zed-industries/claude-code-acp"],
acpModel: "claude-opus-4-8",
- subAgentsEnabled: false,
- switchLlmToolField: undefined,
- switchLlmToolEnabled: false,
- switchLlmToolSupportedOnProfile: true,
toolConcurrencyField: undefined,
toolConcurrency: "",
mcpMode: "standard" as const,
@@ -19,20 +15,10 @@ const baseAcp = {
secretsMode: "standard" as const,
selectedSecrets: [] as string[],
secretRefsSupportedOnProfile: true,
-};
-
-const switchLlmToolField: SettingsFieldSchema = {
- key: "enable_switch_llm_tool",
- label: "Enable LLM switching tool",
- section: "general",
- section_label: "General",
- value_type: "boolean",
- default: true,
- choices: [],
- depends_on: [],
- prominence: "major",
- secret: false,
- required: false,
+ toolsMode: "standard" as const,
+ selectedTools: [] as string[],
+ toolParams: {},
+ toolCatalogLoaded: true,
};
const concurrencyField: SettingsFieldSchema = {
@@ -105,10 +91,6 @@ describe("buildAgentProfileFields — OpenHands", () => {
isDefaultProviderCommand: false,
commandTokens: [],
acpModel: "",
- subAgentsEnabled: true,
- switchLlmToolField: undefined,
- switchLlmToolEnabled: false,
- switchLlmToolSupportedOnProfile: true,
toolConcurrencyField: undefined,
toolConcurrency: "",
mcpMode: "standard" as const,
@@ -118,52 +100,16 @@ describe("buildAgentProfileFields — OpenHands", () => {
secretRefsSupportedOnProfile: true,
};
- it("passes through enable_sub_agents and omits concurrency when the field is absent", () => {
- expect(buildAgentProfileFields(baseOh)).toEqual({
+ it("leaves tools out until the catalog loads, so the stored selection survives", () => {
+ expect(
+ buildAgentProfileFields({ ...baseOh, toolCatalogLoaded: false }),
+ ).toEqual({
agent_kind: "openhands",
mcp_server_refs: null,
- enable_sub_agents: true,
secret_refs: null,
});
});
- it("emits enable_switch_llm_tool when the schema exposes the field", () => {
- const fields = buildAgentProfileFields({
- ...baseOh,
- switchLlmToolField,
- switchLlmToolEnabled: true,
- });
- if (fields.agent_kind === "openhands") {
- expect(fields.enable_switch_llm_tool).toBe(true);
- }
- });
-
- it("omits enable_switch_llm_tool when the schema has it but the profile model does not", () => {
- // agent-server 1.29.0–1.30.x: agent profiles exist and the settings schema
- // advertises the field, but `OpenHandsAgentProfile` gained it in 1.31.0.
- // The profile POST is `extra="forbid"`, so emitting here 422s the save.
- const fields = buildAgentProfileFields({
- ...baseOh,
- switchLlmToolField,
- switchLlmToolEnabled: false,
- switchLlmToolSupportedOnProfile: false,
- });
- expect(fields).not.toHaveProperty("enable_switch_llm_tool");
- });
-
- it("omits enable_switch_llm_tool when the schema predates the field", () => {
- // Older agent-servers would reject the unknown key on the whole-profile
- // overwrite, so the key is only emitted when the schema advertises it.
- const fields = buildAgentProfileFields({
- ...baseOh,
- switchLlmToolField: undefined,
- switchLlmToolEnabled: true,
- });
- if (fields.agent_kind === "openhands") {
- expect(fields).not.toHaveProperty("enable_switch_llm_tool");
- }
- });
-
it("coerces a valid tool_concurrency_limit to a number", () => {
const fields = buildAgentProfileFields({
...baseOh,
@@ -219,10 +165,10 @@ describe("buildAgentProfileFields — mcp_server_refs", () => {
isDefaultProviderCommand: false,
commandTokens: [],
acpModel: "",
- subAgentsEnabled: false,
- switchLlmToolField: undefined,
- switchLlmToolEnabled: false,
- switchLlmToolSupportedOnProfile: true,
+ toolsMode: "standard" as const,
+ selectedTools: [] as string[],
+ toolParams: {},
+ toolCatalogLoaded: true,
toolConcurrencyField: undefined,
toolConcurrency: "",
mcpMode: "standard" as const,
@@ -275,10 +221,6 @@ describe("buildAgentProfileFields — secret scope", () => {
isDefaultProviderCommand: false,
commandTokens: [] as string[],
acpModel: "",
- subAgentsEnabled: false,
- switchLlmToolField: undefined,
- switchLlmToolEnabled: false,
- switchLlmToolSupportedOnProfile: true,
toolConcurrencyField: undefined,
toolConcurrency: "",
secretsMode: "standard" as const,
@@ -286,6 +228,10 @@ describe("buildAgentProfileFields — secret scope", () => {
secretRefsSupportedOnProfile: true,
mcpMode: "standard" as const,
selectedMcpServers: [] as string[],
+ toolsMode: "standard" as const,
+ selectedTools: [] as string[],
+ toolParams: {},
+ toolCatalogLoaded: true,
};
it("persists null when every secret is allowed", () => {
@@ -332,3 +278,50 @@ describe("buildAgentProfileFields — secret scope", () => {
expect(fields).not.toHaveProperty("secret_refs");
});
});
+
+describe("tool selection", () => {
+ const baseOpenHands = { ...baseAcp, isAcp: false };
+
+ it("saves null while the profile follows the server's standard set", () => {
+ const fields = buildAgentProfileFields(baseOpenHands);
+
+ expect(fields).toMatchObject({ agent_kind: "openhands", tools: null });
+ });
+
+ it("saves the selection with its stored params", () => {
+ const fields = buildAgentProfileFields({
+ ...baseOpenHands,
+ toolsMode: "custom",
+ selectedTools: ["terminal", "glob"],
+ toolParams: { terminal: { username: "dev" } },
+ });
+
+ expect(fields).toMatchObject({
+ tools: [
+ { name: "terminal", params: { username: "dev" } },
+ { name: "glob", params: {} },
+ ],
+ });
+ });
+
+ it("omits tools entirely when the backend serves no catalog", () => {
+ const fields = buildAgentProfileFields({
+ ...baseOpenHands,
+ toolCatalogLoaded: false,
+ toolsMode: "custom",
+ selectedTools: ["glob"],
+ });
+
+ expect(fields).not.toHaveProperty("tools");
+ });
+
+ it("never sends tools for an ACP profile, which owns its own tooling", () => {
+ const fields = buildAgentProfileFields({
+ ...baseAcp,
+ toolsMode: "custom",
+ selectedTools: ["glob"],
+ });
+
+ expect(fields).not.toHaveProperty("tools");
+ });
+});
diff --git a/__tests__/scripts/dev-safe.test.ts b/__tests__/scripts/dev-safe.test.ts
index 643cdb0ea4..228ebe4e78 100644
--- a/__tests__/scripts/dev-safe.test.ts
+++ b/__tests__/scripts/dev-safe.test.ts
@@ -464,6 +464,7 @@ describe("buildAgentServerTelemetryEnv", () => {
env: {
OH_CONVERSATION_RUNTIME: "docker",
OH_CONVERSATION_IMAGE: "agent-server:test",
+ OH_CONVERSATION_IMAGE_HAS_BROWSER: "true",
OH_CONVERSATION_CONTAINER_MEMORY: "2g",
OH_CONVERSATION_CONTAINER_CPUS: "1",
OH_CONVERSATION_CONTAINER_PIDS_LIMIT: "256",
@@ -474,6 +475,7 @@ describe("buildAgentServerTelemetryEnv", () => {
expect(configured).toMatchObject({
OH_CONVERSATION_RUNTIME: "docker",
OH_CONVERSATION_IMAGE: "agent-server:test",
+ OH_CONVERSATION_IMAGE_HAS_BROWSER: "true",
OH_CONVERSATION_CONTAINER_MEMORY: "2g",
OH_CONVERSATION_CONTAINER_CPUS: "1",
OH_CONVERSATION_CONTAINER_PIDS_LIMIT: "256",
@@ -483,6 +485,25 @@ describe("buildAgentServerTelemetryEnv", () => {
buildAgentServerEnv(agentServerConfig, { env: {} }),
).not.toHaveProperty("OH_CONVERSATION_RUNTIME");
});
+
+ it("turns the browser off on the agent-server when browser tools are disabled", () => {
+ expect(
+ buildAgentServerEnv(agentServerConfig, {
+ env: { VITE_ENABLE_BROWSER_TOOLS: "false" },
+ }),
+ ).toMatchObject({ OH_ENABLE_BROWSER: "false" });
+ expect(
+ buildAgentServerEnv(agentServerConfig, { env: {} }),
+ ).not.toHaveProperty("OH_ENABLE_BROWSER");
+ });
+
+ it("keeps an explicit OH_ENABLE_BROWSER when browser tools are disabled", () => {
+ expect(
+ buildAgentServerEnv(agentServerConfig, {
+ env: { VITE_ENABLE_BROWSER_TOOLS: "false", OH_ENABLE_BROWSER: "true" },
+ }),
+ ).toMatchObject({ OH_ENABLE_BROWSER: "true" });
+ });
});
describe("buildAgentServerCommand", () => {
@@ -493,20 +514,20 @@ describe("buildAgentServerCommand", () => {
// Defaults to the released PyPI version with all SDK packages pinned to same version
expect(cmd.args).toEqual([
"--from",
- "openhands-agent-server==1.50.1",
+ "openhands-agent-server==1.53.0",
"--with",
- "openhands-sdk==1.50.1",
+ "openhands-sdk==1.53.0",
"--with",
- "openhands-tools==1.50.1",
+ "openhands-tools==1.53.0",
"--with",
- "openhands-workspace==1.50.1",
+ "openhands-workspace==1.53.0",
"--with",
"posthog>=6,<7",
"agent-server",
"--import-modules",
"canvas_ui_tool",
]);
- expect(cmd.source).toBe("PyPI (1.50.1, default)");
+ expect(cmd.source).toBe("PyPI (1.53.0, default)");
});
it("uses specific PyPI version when OH_AGENT_SERVER_VERSION is set with all packages pinned", () => {
diff --git a/__tests__/scripts/docker-browser-tools.test.ts b/__tests__/scripts/docker-browser-tools.test.ts
new file mode 100644
index 0000000000..6c22937ea9
--- /dev/null
+++ b/__tests__/scripts/docker-browser-tools.test.ts
@@ -0,0 +1,66 @@
+// @vitest-environment node
+
+import { spawnSync } from "node:child_process";
+import { readFileSync } from "node:fs";
+import path from "node:path";
+import { fileURLToPath } from "node:url";
+import { describe, expect, it } from "vitest";
+
+const repoRoot = path.resolve(
+ path.dirname(fileURLToPath(import.meta.url)),
+ "../..",
+);
+const entrypoint = readFileSync(
+ path.join(repoRoot, "docker/entrypoint.sh"),
+ "utf-8",
+);
+
+function browserToolsBlock(): string {
+ const start = entrypoint.indexOf("# >>> docker-browser-tools");
+ const end = entrypoint.indexOf("# <<< docker-browser-tools");
+ if (start === -1 || end === -1) {
+ throw new Error("Docker browser-tools markers are missing");
+ }
+ return entrypoint.slice(start, end);
+}
+
+function resolveEnableBrowser(env: Record<string, string>): string {
+ const result = spawnSync(
+ "bash",
+ [
+ "-c",
+ [
+ "set -uo pipefail",
+ browserToolsBlock(),
+ 'printf "%s" "${OH_ENABLE_BROWSER:-unset}"',
+ ].join("\n"),
+ ],
+ { encoding: "utf-8", env: { PATH: process.env.PATH ?? "", ...env } },
+ );
+ expect(result.status).toBe(0);
+ return result.stdout;
+}
+
+describe("Docker browser-tools flag", () => {
+ it("leaves the agent-server default alone unless the flag is false", () => {
+ expect(resolveEnableBrowser({})).toBe("unset");
+ expect(resolveEnableBrowser({ VITE_ENABLE_BROWSER_TOOLS: "true" })).toBe(
+ "unset",
+ );
+ });
+
+ it("turns the browser off when the flag is false", () => {
+ expect(resolveEnableBrowser({ VITE_ENABLE_BROWSER_TOOLS: "false" })).toBe(
+ "false",
+ );
+ });
+
+ it("keeps an explicit OH_ENABLE_BROWSER", () => {
+ expect(
+ resolveEnableBrowser({
+ VITE_ENABLE_BROWSER_TOOLS: "false",
+ OH_ENABLE_BROWSER: "true",
+ }),
+ ).toBe("true");
+ });
+});
diff --git a/config/defaults.json b/config/defaults.json
index 590ca93996..de6d08d8f5 100644
--- a/config/defaults.json
+++ b/config/defaults.json
@@ -1,12 +1,12 @@
{
"_comment": "Single source of truth for version pins, ports, paths, and defaults shared across the npm and Docker install paths. Read by scripts/dev-safe.mjs, scripts/dev-with-automation.mjs, docker/entrypoint.sh (via generated defaults.env), and .github/workflows/docker.yml.",
"versions": {
- "agentServer": "1.50.1",
+ "agentServer": "1.53.0",
"agentCanvas": "1.24.0",
- "automation": "1.17.0"
+ "automation": "1.18.0"
},
"compatibility": {
- "minimumAgentServer": "1.47.0"
+ "minimumAgentServer": "1.51.0"
},
"images": {
"agentServer": "ghcr.io/openhands/agent-server",
diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh
index d0beb09fe7..92209cd092 100644
--- a/docker/entrypoint.sh
+++ b/docker/entrypoint.sh
@@ -174,6 +174,11 @@ VSCODE_ROUTE="${VSCODE_BASE_PATH}=http://127.0.0.1:${VSCODE_PORT}"
OPENHANDS_DIR="${HOME}/.openhands"
STATE_DIR="${OPENHANDS_DIR}/${CONFIG_STATE_SUBDIR:-agent-canvas}"
export OH_PERSISTENCE_DIR="${OH_PERSISTENCE_DIR:-${OPENHANDS_DIR}}"
+# >>> docker-browser-tools
+if [ "${VITE_ENABLE_BROWSER_TOOLS:-}" = "false" ]; then
+ export OH_ENABLE_BROWSER="${OH_ENABLE_BROWSER:-false}"
+fi
+# <<< docker-browser-tools
export OH_CONVERSATIONS_PATH="${OH_CONVERSATIONS_PATH:-${OPENHANDS_DIR}/${CONFIG_CONVERSATIONS:-agent-canvas/conversations}}"
export OH_BASH_EVENTS_DIR="${OH_BASH_EVENTS_DIR:-${OPENHANDS_DIR}/${CONFIG_BASH_EVENTS:-agent-canvas/bash_events}}"
diff --git a/docs/DEVELOPMENT.md b/docs/DEVELOPMENT.md
index 1190bc2ece..c321a06334 100644
--- a/docs/DEVELOPMENT.md
+++ b/docs/DEVELOPMENT.md
@@ -430,7 +430,7 @@ You can create a `.env` file in the project directory with these variables based
| `VITE_BACKEND_HOST` | Backend host used by the Vite dev proxy | `127.0.0.1:8000` |
| `VITE_SESSION_API_KEY` | (Internal) Session API key injected by the launcher — set `LOCAL_BACKEND_API_KEY` instead | - |
| `VITE_WORKING_DIR` | Workspace path sent when starting new conversations | `workspace/project` |
-| `VITE_ENABLE_BROWSER_TOOLS` | Set to `false` to omit `BrowserToolSet` from new conversation payloads | `true` |
+| `VITE_ENABLE_BROWSER_TOOLS` | Set to `false` to start the agent-server with the browser tool set off | `true` |
| `VITE_BASE_PATH` | Build/serve the SPA under a subpath such as `/canvas` | `/` |
| `VITE_MOCK_API` | Enable/disable API mocking with MSW | `false` |
| `VITE_USE_TLS` | Use HTTPS/WSS for the Vite proxy target | `false` |
diff --git a/package-lock.json b/package-lock.json
index 1a707a01cb..c58091221a 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -14,7 +14,7 @@
"@microlink/react-json-view": "1.31.25",
"@monaco-editor/react": "4.7.0",
"@openhands/extensions": "0.26.0",
- "@openhands/typescript-client": "1.50.1",
+ "@openhands/typescript-client": "1.53.0",
"@react-router/node": "7.18.2",
"@react-router/serve": "7.18.2",
"@tailwindcss/vite": "4.3.3",
@@ -4147,9 +4147,9 @@
}
},
"node_modules/@openhands/typescript-client": {
- "version": "1.50.1",
- "resolved": "https://registry.npmjs.org/@openhands/typescript-client/-/typescript-client-1.50.1.tgz",
- "integrity": "sha512-OfwlYmqZdDShL54IX+EwMrwN7HqeDTCShYTKjdlKRYjVymtd/FAoqX1ixkVAMEI/IJhurdVJIevBd7EJL52yRg==",
+ "version": "1.53.0",
+ "resolved": "https://registry.npmjs.org/@openhands/typescript-client/-/typescript-client-1.53.0.tgz",
+ "integrity": "sha512-QQHU0/WR0e6chlrPug/ZINICynU86ygAvCWwO1ghs1xddRKqK7clyItjgrgmI9ne0IEsJz/ZEELf/34zcY/gZQ==",
"license": "MIT",
"dependencies": {
"@openrouter/sdk": "^1.2.11",
diff --git a/package.json b/package.json
index d4825cc711..f23c2a8161 100644
--- a/package.json
+++ b/package.json
@@ -24,7 +24,7 @@
"@microlink/react-json-view": "1.31.25",
"@monaco-editor/react": "4.7.0",
"@openhands/extensions": "0.26.0",
- "@openhands/typescript-client": "1.50.1",
+ "@openhands/typescript-client": "1.53.0",
"@react-router/node": "7.18.2",
"@react-router/serve": "7.18.2",
"@tailwindcss/vite": "4.3.3",
diff --git a/scripts/check-sdk-version-sync.mjs b/scripts/check-sdk-version-sync.mjs
index 756233468b..ce30f20cf5 100644
--- a/scripts/check-sdk-version-sync.mjs
+++ b/scripts/check-sdk-version-sync.mjs
@@ -26,7 +26,7 @@
*
* Usage:
* node scripts/check-sdk-version-sync.mjs
- * EXPECTED_SDK_VERSION=1.50.1 node scripts/check-sdk-version-sync.mjs
+ * EXPECTED_SDK_VERSION=1.53.0 node scripts/check-sdk-version-sync.mjs
* node scripts/check-sdk-version-sync.mjs --check-pypi
*
* Environment variables:
@@ -85,7 +85,7 @@ Triggering from other repos:
-H "Authorization: token \$GITHUB_TOKEN" \\
-H "Accept: application/vnd.github.v3+json" \\
https://api.github.com/repos/OpenHands/OpenHands/dispatches \\
- -d '{"event_type": "sdk-version-check", "client_payload": {"version": "1.50.1"}}'
+ -d '{"event_type": "sdk-version-check", "client_payload": {"version": "1.53.0"}}'
`);
process.exit(0);
}
@@ -300,9 +300,9 @@ async function fetchPyPIDependencies(packageName, version) {
* Parse PyPI requires_dist array and extract SDK package versions
*
* PyPI returns dependencies in PEP 508 format like:
- * "openhands-sdk>=1.50.1,<2.0.0"
- * "openhands-tools==1.50.1"
- * "openhands-workspace (>=1.50.1)"
+ * "openhands-sdk>=1.53.0,<2.0.0"
+ * "openhands-tools==1.53.0"
+ * "openhands-workspace (>=1.53.0)"
*/
function parseSdkVersionsFromRequiresDist(requiresDist) {
const versions = {};
@@ -316,7 +316,7 @@ function parseSdkVersionsFromRequiresDist(requiresDist) {
}
// Extract the version number - look for patterns like:
- // ">=1.50.1", "==1.50.1", "(>=1.50.1)", "~=1.50.1"
+ // ">=1.53.0", "==1.53.0", "(>=1.53.0)", "~=1.53.0"
// After the package name and before any comma or closing paren
const versionPattern = /[><=~!]+\s*([0-9]+(?:\.[0-9]+)*)/;
const match = dep.match(versionPattern);
diff --git a/scripts/dev-safe.mjs b/scripts/dev-safe.mjs
index 47a35b0442..29fe278c89 100644
--- a/scripts/dev-safe.mjs
+++ b/scripts/dev-safe.mjs
@@ -417,7 +417,7 @@ export const AGENT_SERVER_IMPORT_MODULES = "canvas_ui_tool";
* edits are picked up without a manual reinstall. The agent-server itself
* is rebuilt from local source on each invocation (--reinstall).
* - OH_AGENT_SERVER_GIT_REF: Git commit SHA or branch name
- * - OH_AGENT_SERVER_VERSION: Specific PyPI version (e.g., "1.50.1")
+ * - OH_AGENT_SERVER_VERSION: Specific PyPI version (e.g., "1.53.0")
*
* If none are set, defaults to the released version specified by
* DEFAULT_AGENT_SERVER_VERSION. Set OH_AGENT_SERVER_GIT_REF to use a
@@ -792,6 +792,7 @@ export function buildAgentServerEnv(config, options = {}) {
[
"OH_CONVERSATION_RUNTIME",
"OH_CONVERSATION_IMAGE",
+ "OH_CONVERSATION_IMAGE_HAS_BROWSER",
"OH_CONVERSATION_CONTAINER_MEMORY",
"OH_CONVERSATION_CONTAINER_CPUS",
"OH_CONVERSATION_CONTAINER_PIDS_LIMIT",
@@ -803,6 +804,9 @@ export function buildAgentServerEnv(config, options = {}) {
return {
...buildAgentServerTelemetryEnv(env),
...conversationRuntimeEnv,
+ ...(env.VITE_ENABLE_BROWSER_TOOLS === "false"
+ ? { OH_ENABLE_BROWSER: env.OH_ENABLE_BROWSER || "false" }
+ : {}),
// Force Python to use UTF-8 for all file I/O and streams.
//
// On Windows, Python defaults to the system ANSI codepage (e.g. cp1252).
diff --git a/src/api/agent-profiles-service/profile-field-support.ts b/src/api/agent-profiles-service/profile-field-support.ts
index 1853b976d5..e1d6b6e233 100644
--- a/src/api/agent-profiles-service/profile-field-support.ts
+++ b/src/api/agent-profiles-service/profile-field-support.ts
@@ -1,53 +1,11 @@
-import {
- compareAgentServerVersions,
- getCachedAgentServerVersion,
- getCachedAgentServerInfo,
-} from "#/api/agent-server-compatibility";
import { getActiveBackend } from "#/api/backend-registry/active-store";
-/**
- * `enable_switch_llm_tool` reached `OpenHandsAgentProfile` in
- * software-agent-sdk#3870, first released in agent-server 1.31.0. The same
- * field reached `AgentSettingsConfig` far earlier (1.22.0), so the agent
- * settings schema advertises it on servers whose *profile* model still
- * rejects it.
- *
- * That gap sits inside the supported range rather than below it: agent
- * profiles shipped in 1.29.0 and Canvas accepts back to
- * `config/defaults.json`'s `compatibility.minimumAgentServer`. On 1.29.0
- * through 1.30.x, `AgentProfileBase` is `extra="forbid"`, so a profile save
- * carrying the key 422s and the whole save is lost. Hence the profile editor
- * gates on the server version instead of reusing the settings schema's
- * presence check, which answers a different question.
- */
-export const MIN_AGENT_SERVER_VERSION_FOR_PROFILE_SWITCH_LLM_TOOL = "1.31.0";
-
-/**
- * Whether the active backend's agent-profile model accepts
- * `enable_switch_llm_tool`.
- *
- * An unreadable version counts as support, matching the other version-gated
- * call sites: cloud backends expose no `/server_info` to probe and track the
- * current contract, and a local backend whose version does not parse never
- * gets past `assertAgentServerVersionIsSupported` at boot.
- */
-export function agentProfileSupportsSwitchLlmTool(): boolean {
- const version = getCachedAgentServerVersion();
- if (!version) return true;
- const comparison = compareAgentServerVersions(
- version,
- MIN_AGENT_SERVER_VERSION_FOR_PROFILE_SWITCH_LLM_TOOL,
- );
- if (comparison === null) return true;
- return comparison >= 0;
+/** Local only: cloud launches do not enforce a profile's secret scope yet. */
+export function agentProfileSupportsSecretRefs(): boolean {
+ return getActiveBackend().backend.kind !== "cloud";
}
-/** Only offer a scope when the serving backend advertises enforcement. */
-export function agentProfileSupportsSecretRefs(): boolean {
- if (getActiveBackend().backend.kind === "cloud") return false;
- const capabilities = getCachedAgentServerInfo()?.capabilities;
- return (
- Array.isArray(capabilities) &&
- capabilities.includes("profile_secret_scope_v1")
- );
+/** Local only: cloud launches ignore a profile's tools for now. */
+export function agentProfileSupportsTools(): boolean {
+ return getActiveBackend().backend.kind !== "cloud";
}
diff --git a/src/api/agent-server-adapter.ts b/src/api/agent-server-adapter.ts
index b2bf6c8632..cb1dec949e 100644
--- a/src/api/agent-server-adapter.ts
+++ b/src/api/agent-server-adapter.ts
@@ -16,7 +16,6 @@ import {
import { getAgentServerClientOptions } from "./agent-server-client-options";
import {
getCachedAgentServerInfo,
- isAgentServerToolAvailable,
type AgentServerInfo,
} from "./agent-server-compatibility";
import { getAgentServerWorkingDir } from "./agent-server-config";
@@ -143,9 +142,6 @@ export interface DirectConversationInfo {
sub_conversation_ids?: string[] | null;
}
-const DEFAULT_TOOL_NAMES = ["terminal", "file_editor", "task_tracker"];
-const BROWSER_TOOL_SET_NAME = "browser_tool_set";
-const TASK_TOOL_SET_NAME = "task_tool_set";
// Falls back to the same default the code agent uses when the user has not
// configured `conversation_settings.max_iterations` (see buildConfiguredConversationSettings).
const DEFAULT_MAX_ITERATIONS = 500;
@@ -154,10 +150,6 @@ function resolveMaxIterations(value: unknown): number {
return typeof value === "number" ? value : DEFAULT_MAX_ITERATIONS;
}
-function browserToolsEnabled() {
- return import.meta.env.VITE_ENABLE_BROWSER_TOOLS !== "false";
-}
-
/**
* Shape of the runtime services info served by Agent Canvas backends in
* `/server_info.runtime_services`. All URLs are written from the agent's point of
@@ -773,52 +765,21 @@ function isToolRecord(
);
}
-function shouldIncludeTool(name: string, agentSettings: SettingsRecord) {
- if (name === BROWSER_TOOL_SET_NAME) {
- return browserToolsEnabled() && isAgentServerToolAvailable(name);
- }
-
- if (name === TASK_TOOL_SET_NAME) {
- return (
- agentSettings.enable_sub_agents === true &&
- isAgentServerToolAvailable(name)
- );
- }
-
- return true;
-}
-
-function getAgentTools(agentSettings: SettingsRecord): AgentToolSpec[] {
- const tools = new Map<string, AgentToolSpec>();
-
- for (const name of DEFAULT_TOOL_NAMES) {
- if (shouldIncludeTool(name, agentSettings)) {
- tools.set(name, { name, params: {} });
- }
- }
-
- for (const name of [BROWSER_TOOL_SET_NAME, TASK_TOOL_SET_NAME]) {
- if (shouldIncludeTool(name, agentSettings)) {
- tools.set(name, { name, params: {} });
- }
- }
-
+/** Unset `tools` is left to the server; a list is sent as given. */
+function getAgentTools(
+ agentSettings: SettingsRecord,
+): AgentToolSpec[] | undefined {
const configuredTools = agentSettings.tools;
if (
- Array.isArray(configuredTools) &&
- configuredTools.every((tool) => isToolRecord(tool))
+ !Array.isArray(configuredTools) ||
+ !configuredTools.every((tool) => isToolRecord(tool))
) {
- for (const tool of configuredTools) {
- if (shouldIncludeTool(tool.name, agentSettings)) {
- tools.set(tool.name, {
- name: tool.name,
- params: toRecord(tool.params),
- });
- }
- }
+ return undefined;
}
-
- return Array.from(tools.values());
+ return configuredTools.map((tool) => ({
+ name: tool.name,
+ params: toRecord(tool.params),
+ }));
}
function buildInitialMessage(
diff --git a/src/api/agent-server-compatibility.test.ts b/src/api/agent-server-compatibility.test.ts
index c4e1e5610b..c21f576187 100644
--- a/src/api/agent-server-compatibility.test.ts
+++ b/src/api/agent-server-compatibility.test.ts
@@ -83,7 +83,7 @@ describe("agent-server version compatibility", () => {
});
});
- it.each(["0.99.99", "1.27.999", "1.47.0-rc.1"])(
+ it.each(["0.99.99", "1.27.999", "1.50.1", "1.51.0-rc.1"])(
"rejects older version %s",
(version) => {
const error = getThrownError(() =>
@@ -101,10 +101,10 @@ describe("agent-server version compatibility", () => {
it.each([
MINIMUM_COMPATIBLE_AGENT_SERVER_VERSION,
- "1.47.1",
- "1.48.0",
+ "1.51.1",
+ "1.52.0",
"2.0.0",
- " v1.47.0+build.7 ",
+ " v1.51.0+build.7 ",
])("accepts compatible version %s", (version) => {
expect(() =>
assertAgentServerVersionIsSupported(serverInfo(version)),
diff --git a/src/api/agent-server-compatibility.ts b/src/api/agent-server-compatibility.ts
index fb64cb35a6..6e90268fbe 100644
--- a/src/api/agent-server-compatibility.ts
+++ b/src/api/agent-server-compatibility.ts
@@ -33,7 +33,6 @@ export const INVALID_BACKEND_API_KEY_ERROR = "Invalid API key";
export interface AgentServerInfo extends BaseServerInfo {
sdk_version?: string;
- usable_tools?: string[] | null;
runtime_services?: unknown;
execution_runtime?: "local" | "docker";
}
@@ -41,13 +40,6 @@ export interface AgentServerInfo extends BaseServerInfo {
let cachedAgentServerInfo: AgentServerInfo | null = null;
let cachedAgentServerInfoHost: string | null = null;
-const getAdvertisedTools = (serverInfo: AgentServerInfo | null) => {
- if (Array.isArray(serverInfo?.usable_tools)) {
- return serverInfo.usable_tools;
- }
- return null;
-};
-
export class AgentServerUnavailableError extends Error {
readonly details: string | null;
readonly noBackendConfigured: boolean;
@@ -156,14 +148,6 @@ export function getCachedAgentServerInfo(options?: {
return cachedAgentServerInfo;
}
-export function isAgentServerToolAvailable(toolName: string) {
- const availableTools = getAdvertisedTools(cachedAgentServerInfo);
- if (!Array.isArray(availableTools)) {
- return true;
- }
- return availableTools.includes(toolName);
-}
-
export function isSdkHttpError(error: unknown) {
return (
error instanceof Error &&
diff --git a/src/api/tool-catalog-service/tool-catalog-service.api.test.ts b/src/api/tool-catalog-service/tool-catalog-service.api.test.ts
new file mode 100644
index 0000000000..49cb944a23
--- /dev/null
+++ b/src/api/tool-catalog-service/tool-catalog-service.api.test.ts
@@ -0,0 +1,90 @@
+import { ToolClient } from "@openhands/typescript-client/clients";
+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
+import {
+ __resetActiveStoreForTests,
+ setActiveSelection,
+ setRegisteredBackends,
+} from "#/api/backend-registry/active-store";
+import type { Backend } from "#/api/backend-registry/types";
+import ToolCatalogService, {
+ type ToolCatalogEntry,
+} from "#/api/tool-catalog-service/tool-catalog-service.api";
+
+vi.mock("@openhands/typescript-client/clients", () => ({
+ ToolClient: vi.fn(),
+}));
+
+const getToolCatalog = vi.fn();
+
+const localBackend: Backend = {
+ id: "local",
+ name: "local",
+ host: "http://127.0.0.1:8000",
+ apiKey: "session-key",
+ kind: "local",
+};
+
+const catalogEntry = (
+ overrides: Partial<ToolCatalogEntry> = {},
+): ToolCatalogEntry => ({
+ name: "terminal",
+ user_selectable: true,
+ usable: true,
+ in_default_set: true,
+ description: "Run shell commands.",
+ ...overrides,
+});
+
+beforeEach(() => {
+ vi.clearAllMocks();
+ setRegisteredBackends([localBackend]);
+ setActiveSelection({ backendId: localBackend.id });
+ vi.mocked(ToolClient).mockImplementation(function MockToolClient() {
+ return { getToolCatalog } as unknown as ToolClient;
+ } as unknown as typeof ToolClient);
+});
+
+afterEach(() => {
+ setActiveSelection(null);
+ setRegisteredBackends([]);
+ __resetActiveStoreForTests();
+});
+
+describe("ToolCatalogService.getCatalog", () => {
+ it("returns the server's catalog unchanged when every entry is well-formed", async () => {
+ const tools = [
+ catalogEntry(),
+ catalogEntry({ name: "glob", in_default_set: false }),
+ ];
+ getToolCatalog.mockResolvedValue({ tools });
+
+ await expect(ToolCatalogService.getCatalog()).resolves.toEqual(tools);
+ expect(ToolClient).toHaveBeenCalledWith(
+ expect.objectContaining({ host: localBackend.host }),
+ );
+ });
+
+ it("fails loudly on a catalog entry that omits a discriminator field", async () => {
+ getToolCatalog.mockResolvedValue({
+ tools: [
+ { name: "terminal", user_selectable: true, usable: true },
+ catalogEntry(),
+ ],
+ });
+
+ await expect(ToolCatalogService.getCatalog()).rejects.toThrow(
+ 'malformed tool catalog entry (name="terminal")',
+ );
+ await expect(ToolCatalogService.getCatalog()).rejects.toThrow(
+ "refusing to pick tools from it",
+ );
+ });
+
+ it("fails loudly when the response omits the tools array entirely", async () => {
+ getToolCatalog.mockResolvedValue({});
+
+ await expect(ToolCatalogService.getCatalog()).rejects.toThrow(
+ "malformed tool catalog (missing the tools array)",
+ );
+ });
+});
diff --git a/src/api/tool-catalog-service/tool-catalog-service.api.ts b/src/api/tool-catalog-service/tool-catalog-service.api.ts
new file mode 100644
index 0000000000..40692ac467
--- /dev/null
+++ b/src/api/tool-catalog-service/tool-catalog-service.api.ts
@@ -0,0 +1,54 @@
+import { ToolClient } from "@openhands/typescript-client/clients";
+import type { ToolCatalogEntry } from "@openhands/typescript-client";
+
+import { getAgentServerClientOptions } from "../agent-server-client-options";
+
+export type { ToolCatalogEntry };
+
+function isToolCatalogEntry(value: unknown): value is ToolCatalogEntry {
+ if (typeof value !== "object" || value === null) return false;
+ const entry = value as Record<string, unknown>;
+ return (
+ typeof entry.name === "string" &&
+ typeof entry.user_selectable === "boolean" &&
+ typeof entry.usable === "boolean" &&
+ typeof entry.in_default_set === "boolean" &&
+ typeof entry.description === "string"
+ );
+}
+
+function assertValidCatalog(
+ tools: unknown[],
+): asserts tools is ToolCatalogEntry[] {
+ for (const tool of tools) {
+ if (!isToolCatalogEntry(tool)) {
+ const name =
+ typeof tool === "object" && tool !== null
+ ? ((tool as Record<string, unknown>).name ?? "<missing>")
+ : "<malformed>";
+ throw new Error(
+ `The agent server returned a malformed tool catalog entry ` +
+ `(name="${String(name)}"); refusing to pick tools from it.`,
+ );
+ }
+ }
+}
+
+class ToolCatalogService {
+ /** Tools this server offers, in its order. */
+ static async getCatalog(): Promise<ToolCatalogEntry[]> {
+ const response = await new ToolClient(
+ getAgentServerClientOptions(),
+ ).getToolCatalog();
+ const tools: unknown = response?.tools;
+ if (!Array.isArray(tools)) {
+ throw new Error(
+ "The agent server returned a malformed tool catalog (missing the tools array).",
+ );
+ }
+ assertValidCatalog(tools);
+ return tools;
+ }
+}
+
+export default ToolCatalogService;
diff --git a/src/components/features/settings/agent-profiles/agent-profiles-local-view.tsx b/src/components/features/settings/agent-profiles/agent-profiles-local-view.tsx
index 1e9d577835..ed8c6b5790 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
@@ -1,6 +1,7 @@
import { useCallback, useEffect, useMemo, useState } from "react";
import { useTranslation } from "react-i18next";
import { AgentProfilesManager } from "./agent-profiles-manager";
+import { GlobalToolsNotice } from "./global-tools-notice";
import { mergeAgentProfileSaveInput } from "./merge-agent-profile-save-input";
import { ProfileNameInput } from "#/components/features/settings/llm-profiles/profile-name-input";
import { BrandButton } from "#/components/features/settings/brand-button";
@@ -10,6 +11,7 @@ import {
type AgentSettingsSaveControl,
} from "#/routes/agent-settings";
import AgentProfilesService, {
+ WELL_KNOWN_DEFAULT_AGENT_PROFILE_NAME,
type AgentProfile,
type AgentProfileSummary,
type AgentProfileSaveInput,
@@ -41,9 +43,7 @@ type ViewMode = "list" | "create" | "edit";
function toAgentSettingsOverride(
profile: AgentProfile,
): Record<string, SettingsValue> {
- const secretRefs =
- ((profile as { secret_refs?: unknown }).secret_refs as SettingsValue) ??
- null;
+ const secretRefs = profile.secret_refs ?? null;
if (profile.agent_kind === "acp") {
return {
agent_kind: "acp",
@@ -55,18 +55,10 @@ function toAgentSettingsOverride(
acp_model: profile.acp_model ?? "",
};
}
- // `enable_switch_llm_tool` rides untyped — the pinned ts-client predates it
- // on the profile model (same pattern as `disabled_skills` in the merge
- // fixtures). Fall back to the SDK default (true) when a stored profile
- // predates the field.
- const switchLlmToolEnabled =
- (profile as { enable_switch_llm_tool?: boolean }).enable_switch_llm_tool ??
- true;
return {
agent_kind: "openhands",
mcp_server_refs: profile.mcp_server_refs ?? null,
- enable_sub_agents: profile.enable_sub_agents,
- enable_switch_llm_tool: switchLlmToolEnabled,
+ tools: (profile.tools as SettingsValue) ?? null,
tool_concurrency_limit: profile.tool_concurrency_limit,
secret_refs: secretRefs,
};
@@ -271,10 +263,13 @@ export function AgentProfilesLocalView() {
if (viewMode === "list") {
return (
- <AgentProfilesManager
- onAddProfile={handleAddProfile}
- onEditProfile={handleEditProfile}
- />
+ <div className="flex flex-col gap-4">
+ <GlobalToolsNotice />
+ <AgentProfilesManager
+ onAddProfile={handleAddProfile}
+ onEditProfile={handleEditProfile}
+ />
+ </div>
);
}
@@ -332,6 +327,9 @@ export function AgentProfilesLocalView() {
key={viewMode === "edit" ? `edit-${editingProfile?.id}` : "new-profile"}
agentSettingsOverride={override}
onSaveControlChange={setSaveControl}
+ isDefaultProfile={
+ profileName.trim() === WELL_KNOWN_DEFAULT_AGENT_PROFILE_NAME
+ }
/>
{/* OpenHands profiles reference an LLM profile (required). */}
diff --git a/src/components/features/settings/agent-profiles/global-tools-notice.tsx b/src/components/features/settings/agent-profiles/global-tools-notice.tsx
new file mode 100644
index 0000000000..c9ca785508
--- /dev/null
+++ b/src/components/features/settings/agent-profiles/global-tools-notice.tsx
@@ -0,0 +1,66 @@
+import { useTranslation } from "react-i18next";
+import { AxiosError } from "axios";
+import { BrandButton } from "#/components/features/settings/brand-button";
+import { useSettings } from "#/hooks/query/use-settings";
+import { useSaveSettings } from "#/hooks/mutation/use-save-settings";
+import { readProfileTools } from "#/constants/profile-tools";
+import { agentProfileSupportsTools } from "#/api/agent-profiles-service/profile-field-support";
+import { Typography } from "#/ui/typography";
+import { I18nKey } from "#/i18n/declaration";
+import { cn } from "#/utils/utils";
+import { settingsListContainerClassName } from "#/utils/settings-list-classes";
+import {
+ displayErrorToast,
+ displaySuccessToast,
+} from "#/utils/custom-toast-handlers";
+import { retrieveAxiosErrorMessage } from "#/utils/retrieve-axios-error-message";
+
+/** Surface a custom global `tools` list, which no editor shows, and reset it. */
+export function GlobalToolsNotice() {
+ const { t } = useTranslation("openhands");
+ const { data: settings } = useSettings();
+ const { mutate: saveSettings, isPending } = useSaveSettings();
+
+ const agentSettings = settings?.agent_settings;
+ if (!agentProfileSupportsTools()) return null;
+ if (!agentSettings || agentSettings.agent_kind === "acp") return null;
+ const tools = readProfileTools(agentSettings.tools);
+ if (tools.mode !== "custom") return null;
+
+ const handleReset = () =>
+ saveSettings(
+ { agent_settings_diff: { tools: null } },
+ {
+ onError: (error) => {
+ const message = retrieveAxiosErrorMessage(error as AxiosError);
+ displayErrorToast(message || t(I18nKey.ERROR$GENERIC));
+ },
+ onSuccess: () => displaySuccessToast(t(I18nKey.SETTINGS$SAVED)),
+ },
+ );
+
+ return (
+ <div
+ data-testid="global-tools-notice"
+ className={cn(
+ settingsListContainerClassName,
+ "flex flex-wrap items-center justify-between gap-3 p-3",
+ )}
+ >
+ <Typography.Text className="text-sm">
+ {t(I18nKey.SETTINGS$GLOBAL_TOOLS_CUSTOM, {
+ names: tools.selected.join(", ") || "—",
+ })}
+ </Typography.Text>
+ <BrandButton
+ testId="global-tools-reset"
+ type="button"
+ variant="secondary"
+ isDisabled={isPending}
+ onClick={handleReset}
+ >
+ {t(I18nKey.SETTINGS$GLOBAL_TOOLS_RESET)}
+ </BrandButton>
+ </div>
+ );
+}
diff --git a/src/constants/profile-tools.ts b/src/constants/profile-tools.ts
new file mode 100644
index 0000000000..697bc40456
--- /dev/null
+++ b/src/constants/profile-tools.ts
@@ -0,0 +1,53 @@
+import type { ProfileScopeMode } from "#/constants/profile-scope";
+import type { SettingsValue } from "#/types/settings";
+
+/** A tool spec as stored on an agent profile and sent on the wire. */
+export type ProfileToolSpec = {
+ name: string;
+ params: Record<string, SettingsValue>;
+};
+
+function toParams(value: unknown): Record<string, SettingsValue> {
+ return value && typeof value === "object" && !Array.isArray(value)
+ ? (value as Record<string, SettingsValue>)
+ : {};
+}
+
+/** Read stored `tools` into picker state: absent = standard, `[]` = bare. */
+export function readProfileTools(value: unknown): {
+ mode: ProfileScopeMode;
+ selected: string[];
+ params: Record<string, Record<string, SettingsValue>>;
+} {
+ if (!Array.isArray(value))
+ return { mode: "standard", selected: [], params: {} };
+ const params = new Map<string, Record<string, SettingsValue>>();
+ value.forEach((entry) => {
+ const name = (entry as { name?: unknown })?.name;
+ if (typeof name !== "string") return;
+ if (!params.has(name))
+ params.set(name, toParams((entry as { params?: unknown }).params));
+ });
+ return {
+ mode: "custom",
+ selected: [...params.keys()],
+ params: Object.fromEntries(params),
+ };
+}
+
+/** Build the `tools` value to persist: `null` for standard, else the picks. */
+export function buildProfileToolsValue({
+ mode,
+ selected,
+ params = {},
+}: {
+ mode: ProfileScopeMode;
+ selected: string[];
+ params?: Record<string, Record<string, SettingsValue>>;
+}): ProfileToolSpec[] | null {
+ if (mode === "standard") return null;
+ return selected.map((name) => ({
+ name,
+ params: Object.hasOwn(params, name) ? params[name] : {},
+ }));
+}
diff --git a/src/hooks/query/query-keys.ts b/src/hooks/query/query-keys.ts
index 631ab84a0a..afa45d0259 100644
--- a/src/hooks/query/query-keys.ts
+++ b/src/hooks/query/query-keys.ts
@@ -33,6 +33,10 @@ export const AGENT_PROFILES_QUERY_KEYS = {
["agent-profiles", backendId, orgId, "detail", name] as const,
} as const;
+export const TOOL_CATALOG_QUERY_KEYS = {
+ all: ["tool-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-tool-catalog.ts b/src/hooks/query/use-tool-catalog.ts
new file mode 100644
index 0000000000..95d6ab7467
--- /dev/null
+++ b/src/hooks/query/use-tool-catalog.ts
@@ -0,0 +1,27 @@
+import { useQuery } from "@tanstack/react-query";
+
+import ToolCatalogService from "#/api/tool-catalog-service/tool-catalog-service.api";
+import { useActiveBackend } from "#/contexts/active-backend-context";
+import {
+ AGENT_PROFILES_RETRY_OPTIONS,
+ CONFIG_CACHE_OPTIONS,
+ TOOL_CATALOG_QUERY_KEYS,
+} from "#/hooks/query/query-keys";
+
+interface UseToolCatalogOptions {
+ enabled?: boolean;
+}
+
+/** Tools the active backend offers. */
+export function useToolCatalog(options: UseToolCatalogOptions = {}) {
+ const { backend } = useActiveBackend();
+
+ return useQuery({
+ queryKey: [...TOOL_CATALOG_QUERY_KEYS.all, backend.id, backend.host],
+ queryFn: ToolCatalogService.getCatalog,
+ enabled: options.enabled ?? true,
+ ...CONFIG_CACHE_OPTIONS,
+ ...AGENT_PROFILES_RETRY_OPTIONS,
+ meta: { disableToast: true },
+ });
+}
diff --git a/src/i18n/translation.json b/src/i18n/translation.json
index 071d619887..4d210b6d8b 100644
--- a/src/i18n/translation.json
+++ b/src/i18n/translation.json
@@ -186,6 +186,193 @@
"uk": "Запущено підагент <cmd>{{name}}</cmd>",
"ca": "S'ha executat el subagent <cmd>{{name}}</cmd>"
},
+ "SETTINGS$AGENT_PROFILE_TOOLS": {
+ "en": "Tools",
+ "ja": "ツール",
+ "zh-CN": "工具",
+ "zh-TW": "工具",
+ "ko-KR": "도구",
+ "no": "Verktøy",
+ "it": "Strumenti",
+ "pt": "Ferramentas",
+ "es": "Herramientas",
+ "ar": "الأدوات",
+ "fr": "Outils",
+ "tr": "Araçlar",
+ "de": "Werkzeuge",
+ "uk": "Інструменти",
+ "ca": "Eines"
+ },
+ "SETTINGS$AGENT_PROFILE_TOOLS_CHOOSE": {
+ "en": "Choose tools",
+ "ja": "ツールを選択",
+ "zh-CN": "选择工具",
+ "zh-TW": "選擇工具",
+ "ko-KR": "도구 선택",
+ "no": "Velg verktøy",
+ "it": "Scegli gli strumenti",
+ "pt": "Escolher ferramentas",
+ "es": "Elegir herramientas",
+ "ar": "اختيار الأدوات",
+ "fr": "Choisir les outils",
+ "tr": "Araçları seçin",
+ "de": "Werkzeuge auswählen",
+ "uk": "Вибрати інструменти",
+ "ca": "Tria les eines"
+ },
+ "SETTINGS$AGENT_PROFILE_TOOLS_CHOOSE_HINT": {
+ "en": "This agent gets only the tools you select. Removing a tool removes the ability, not just the instruction to avoid it.",
+ "ja": "このエージェントは選択したツールのみを使用できます。ツールを外すと、使わないよう指示するだけでなく、その機能自体がなくなります。",
+ "zh-CN": "该代理只会获得你选择的工具。移除某个工具会移除相应能力,而不仅仅是提示它不要使用。",
+ "zh-TW": "該代理只會取得你選擇的工具。移除某個工具會移除對應能力,而不只是提示它別使用。",
+ "ko-KR": "이 에이전트는 선택한 도구만 받습니다. 도구를 제거하면 사용하지 말라는 지시가 아니라 해당 기능 자체가 사라집니다.",
+ "no": "Denne agenten får bare verktøyene du velger. Å fjerne et verktøy fjerner evnen, ikke bare beskjeden om å la være.",
+ "it": "Questo agente riceve solo gli strumenti che selezioni. Rimuovere uno strumento elimina la capacità, non solo l'istruzione di non usarlo.",
+ "pt": "Este agente recebe apenas as ferramentas que você selecionar. Remover uma ferramenta remove a capacidade, não apenas a instrução de evitá-la.",
+ "es": "Este agente recibe solo las herramientas que selecciones. Quitar una herramienta elimina la capacidad, no solo la instrucción de no usarla.",
+ "ar": "لا يحصل هذا الوكيل إلا على الأدوات التي تحددها. وإزالة أداة تزيل القدرة نفسها، لا مجرد التعليمات بتجنبها.",
+ "fr": "Cet agent ne reçoit que les outils que vous sélectionnez. Retirer un outil supprime la capacité, et pas seulement la consigne de ne pas l'utiliser.",
+ "tr": "Bu aracı yalnızca seçtiğiniz araçları alır. Bir aracı kaldırmak, yalnızca kullanmama talimatını değil yeteneğin kendisini kaldırır.",
+ "de": "Dieser Agent erhält nur die von Ihnen ausgewählten Werkzeuge. Ein entferntes Werkzeug nimmt ihm die Fähigkeit, nicht nur die Anweisung, es zu meiden.",
+ "uk": "Цей агент отримує лише вибрані вами інструменти. Вилучення інструмента прибирає саму можливість, а не лише вказівку не користуватися ним.",
+ "ca": "Aquest agent només rep les eines que seleccionis. Treure una eina elimina la capacitat, no només la instrucció d'evitar-la."
+ },
+ "SETTINGS$AGENT_PROFILE_TOOLS_KEPT_ON_SAVE": {
+ "en": "Saving keeps the profile's current tools.",
+ "ja": "保存しても、プロファイルの現在のツールはそのまま保持されます。",
+ "zh-CN": "保存时将保留该配置文件当前的工具。",
+ "zh-TW": "儲存時會保留此設定檔目前的工具。",
+ "ko-KR": "저장해도 프로필의 현재 도구는 유지됩니다.",
+ "no": "Lagring beholder profilens nåværende verktøy.",
+ "it": "Il salvataggio mantiene gli strumenti attuali del profilo.",
+ "pt": "Salvar mantém as ferramentas atuais do perfil.",
+ "es": "Al guardar se conservan las herramientas actuales del perfil.",
+ "ar": "يحتفظ الحفظ بأدوات الملف الشخصي الحالية.",
+ "fr": "L'enregistrement conserve les outils actuels du profil.",
+ "tr": "Kaydetmek profilin mevcut araçlarını korur.",
+ "de": "Beim Speichern bleiben die aktuellen Tools des Profils erhalten.",
+ "uk": "Збереження залишає поточні інструменти профілю.",
+ "ca": "En desar es conserven les eines actuals del perfil."
+ },
+ "SETTINGS$AGENT_PROFILE_TOOLS_LOAD_FAILED": {
+ "en": "Could not load the server's tools.",
+ "ja": "サーバーのツールを読み込めませんでした。",
+ "zh-CN": "无法加载服务器的工具。",
+ "zh-TW": "無法載入伺服器的工具。",
+ "ko-KR": "서버의 도구를 불러올 수 없습니다.",
+ "no": "Kunne ikke laste inn serverens verktøy.",
+ "it": "Impossibile caricare gli strumenti del server.",
+ "pt": "Não foi possível carregar as ferramentas do servidor.",
+ "es": "No se pudieron cargar las herramientas del servidor.",
+ "ar": "تعذّر تحميل أدوات الخادم.",
+ "fr": "Impossible de charger les outils du serveur.",
+ "tr": "Sunucunun araçları yüklenemedi.",
+ "de": "Die Tools des Servers konnten nicht geladen werden.",
+ "uk": "Не вдалося завантажити інструменти сервера.",
+ "ca": "No s'han pogut carregar les eines del servidor."
+ },
+ "SETTINGS$AGENT_PROFILE_TOOLS_RETRY": {
+ "en": "Retry",
+ "ja": "再試行",
+ "zh-CN": "重试",
+ "zh-TW": "重試",
+ "ko-KR": "다시 시도",
+ "no": "Prøv igjen",
+ "it": "Riprova",
+ "pt": "Tentar novamente",
+ "es": "Reintentar",
+ "ar": "إعادة المحاولة",
+ "fr": "Réessayer",
+ "tr": "Yeniden dene",
+ "de": "Erneut versuchen",
+ "uk": "Повторити",
+ "ca": "Torna-ho a provar"
+ },
+ "SETTINGS$AGENT_PROFILE_TOOLS_STANDARD": {
+ "en": "Standard tools",
+ "ja": "標準ツール",
+ "zh-CN": "标准工具",
+ "zh-TW": "標準工具",
+ "ko-KR": "표준 도구",
+ "no": "Standardverktøy",
+ "it": "Strumenti standard",
+ "pt": "Ferramentas padrão",
+ "es": "Herramientas estándar",
+ "ar": "الأدوات القياسية",
+ "fr": "Outils standard",
+ "tr": "Standart araçlar",
+ "de": "Standardwerkzeuge",
+ "uk": "Стандартні інструменти",
+ "ca": "Eines estàndard"
+ },
+ "SETTINGS$AGENT_PROFILE_TOOLS_STANDARD_HINT": {
+ "en": "This agent gets the tools the server considers standard, shown above. The list follows the server, so it can change when the server is upgraded.",
+ "ja": "このエージェントには、上に表示されたサーバー標準のツールが与えられます。一覧はサーバーに従うため、サーバーの更新時に変わることがあります。",
+ "zh-CN": "该代理将获得上方所示的服务器标准工具。该列表由服务器决定,因此在服务器升级后可能发生变化。",
+ "zh-TW": "該代理將取得上方所示的伺服器標準工具。此清單由伺服器決定,因此在伺服器升級後可能改變。",
+ "ko-KR": "이 에이전트는 위에 표시된 서버 표준 도구를 받습니다. 목록은 서버를 따르므로 서버를 업그레이드하면 달라질 수 있습니다.",
+ "no": "Denne agenten får verktøyene serveren regner som standard, vist ovenfor. Listen følger serveren og kan endres når den oppgraderes.",
+ "it": "Questo agente riceve gli strumenti che il server considera standard, mostrati sopra. L'elenco segue il server, quindi può cambiare dopo un aggiornamento.",
+ "pt": "Este agente recebe as ferramentas que o servidor considera padrão, mostradas acima. A lista segue o servidor, por isso pode mudar quando ele for atualizado.",
+ "es": "Este agente recibe las herramientas que el servidor considera estándar, mostradas arriba. La lista depende del servidor, así que puede cambiar cuando se actualice.",
+ "ar": "يحصل هذا الوكيل على الأدوات التي يعدّها الخادم قياسية، والمعروضة أعلاه. تتبع القائمة الخادم، لذا قد تتغير عند ترقيته.",
+ "fr": "Cet agent reçoit les outils que le serveur considère comme standard, affichés ci-dessus. La liste suit le serveur et peut donc changer lors d'une mise à niveau.",
+ "tr": "Bu aracı, yukarıda gösterilen ve sunucunun standart saydığı araçları alır. Liste sunucuya bağlıdır, bu nedenle sunucu yükseltildiğinde değişebilir.",
+ "de": "Dieser Agent erhält die oben gezeigten Werkzeuge, die der Server als Standard ansieht. Die Liste richtet sich nach dem Server und kann sich bei einem Upgrade ändern.",
+ "uk": "Цей агент отримує інструменти, які сервер вважає стандартними, показані вище. Список залежить від сервера, тож може змінитися після оновлення.",
+ "ca": "Aquest agent rep les eines que el servidor considera estàndard, mostrades a dalt. La llista depèn del servidor, així que pot canviar quan s'actualitzi."
+ },
+ "SETTINGS$AGENT_PROFILE_TOOLS_DEFAULT_PROFILE": {
+ "en": "The default profile always launches with the global tool set. Create a named profile to choose its tools.",
+ "ja": "デフォルトのプロファイルは常にグローバルなツールセットで起動します。ツールを選ぶには、名前付きのプロファイルを作成してください。",
+ "zh-CN": "默认配置文件始终使用全局工具集启动。如需选择工具,请创建一个命名配置文件。",
+ "zh-TW": "預設設定檔一律以全域工具集啟動。若要選擇工具,請建立具名設定檔。",
+ "ko-KR": "기본 프로필은 항상 전역 도구 세트로 시작됩니다. 도구를 선택하려면 이름이 있는 프로필을 만드세요.",
+ "no": "Standardprofilen starter alltid med det globale verktøysettet. Opprett en navngitt profil for å velge verktøyene.",
+ "it": "Il profilo predefinito si avvia sempre con il set di strumenti globale. Crea un profilo con nome per sceglierne gli strumenti.",
+ "pt": "O perfil padrão sempre inicia com o conjunto global de ferramentas. Crie um perfil com nome para escolher as ferramentas.",
+ "es": "El perfil predeterminado siempre se inicia con el conjunto de herramientas global. Crea un perfil con nombre para elegir sus herramientas.",
+ "ar": "يبدأ الملف الشخصي الافتراضي دائمًا بمجموعة الأدوات العامة. أنشئ ملفًا شخصيًا باسم لاختيار أدواته.",
+ "fr": "Le profil par défaut démarre toujours avec les outils globaux. Créez un profil nommé pour choisir ses outils.",
+ "tr": "Varsayılan profil her zaman genel araç setiyle başlar. Araçlarını seçmek için adlandırılmış bir profil oluşturun.",
+ "de": "Das Standardprofil startet immer mit den globalen Werkzeugen. Erstellen Sie ein benanntes Profil, um seine Werkzeuge auszuwählen.",
+ "uk": "Типовий профіль завжди запускається з глобальним набором інструментів. Щоб вибрати інструменти, створіть іменований профіль.",
+ "ca": "El perfil predeterminat sempre s’inicia amb el conjunt d’eines global. Crea un perfil amb nom per triar-ne les eines."
+ },
+ "SETTINGS$GLOBAL_TOOLS_CUSTOM": {
+ "en": "Conversations started without an agent profile use a custom tool list: {{names}}.",
+ "ja": "エージェントプロファイルなしで開始した会話は、カスタムのツール一覧を使用します: {{names}}。",
+ "zh-CN": "未使用代理配置文件启动的对话将使用自定义工具列表:{{names}}。",
+ "zh-TW": "未使用代理設定檔啟動的對話會使用自訂工具清單:{{names}}。",
+ "ko-KR": "에이전트 프로필 없이 시작한 대화는 사용자 지정 도구 목록을 사용합니다: {{names}}.",
+ "no": "Samtaler som startes uten en agentprofil bruker en egendefinert verktøyliste: {{names}}.",
+ "it": "Le conversazioni avviate senza un profilo agente usano un elenco di strumenti personalizzato: {{names}}.",
+ "pt": "As conversas iniciadas sem um perfil de agente usam uma lista de ferramentas personalizada: {{names}}.",
+ "es": "Las conversaciones iniciadas sin un perfil de agente usan una lista de herramientas personalizada: {{names}}.",
+ "ar": "تستخدم المحادثات التي تبدأ دون ملف تعريف وكيل قائمة أدوات مخصصة: {{names}}.",
+ "fr": "Les conversations démarrées sans profil d'agent utilisent une liste d'outils personnalisée : {{names}}.",
+ "tr": "Aracı profili olmadan başlatılan konuşmalar özel bir araç listesi kullanır: {{names}}.",
+ "de": "Unterhaltungen, die ohne Agentenprofil gestartet werden, verwenden eine benutzerdefinierte Werkzeugliste: {{names}}.",
+ "uk": "Розмови, розпочаті без профілю агента, використовують власний список інструментів: {{names}}.",
+ "ca": "Les converses iniciades sense un perfil d'agent fan servir una llista d'eines personalitzada: {{names}}."
+ },
+ "SETTINGS$GLOBAL_TOOLS_RESET": {
+ "en": "Reset to standard tools",
+ "ja": "標準ツールに戻す",
+ "zh-CN": "重置为标准工具",
+ "zh-TW": "重設為標準工具",
+ "ko-KR": "표준 도구로 재설정",
+ "no": "Tilbakestill til standardverktøy",
+ "it": "Ripristina gli strumenti standard",
+ "pt": "Redefinir para as ferramentas padrão",
+ "es": "Restablecer las herramientas estándar",
+ "ar": "إعادة التعيين إلى الأدوات القياسية",
+ "fr": "Rétablir les outils standard",
+ "tr": "Standart araçlara sıfırla",
+ "de": "Auf Standardwerkzeuge zurücksetzen",
+ "uk": "Скинути до стандартних інструментів",
+ "ca": "Restableix les eines estàndard"
+ },
"TASK$SUBAGENT": {
"en": "Subagent:",
"ja": "サブエージェント:",
@@ -2481,74 +2668,6 @@
"uk": "Агент",
"ca": "Agent"
},
- "SCHEMA$ENABLE_SUB_AGENTS$DESCRIPTION": {
- "en": "Enable sub-agent delegation via TaskToolSet.",
- "ja": "TaskToolSet を介したサブエージェントへの委任を有効にします。",
- "zh-CN": "通过 TaskToolSet 启用子智能体委派。",
- "zh-TW": "透過 TaskToolSet 啟用子智能體委派。",
- "ko-KR": "TaskToolSet을 통한 하위 에이전트 위임을 활성화합니다.",
- "no": "Aktiver delegering til underagenter via TaskToolSet.",
- "it": "Abilita la delega ai sottoagenti tramite TaskToolSet.",
- "pt": "Ative a delegação para subagentes via TaskToolSet.",
- "es": "Habilita la delegación a subagentes mediante TaskToolSet.",
- "ar": "مكّن تفويض المهام إلى الوكلاء الفرعيين عبر TaskToolSet.",
- "fr": "Activez la délégation aux sous-agents via TaskToolSet.",
- "tr": "TaskToolSet aracılığıyla alt ajanlara yetki devrini etkinleştirin.",
- "de": "Aktivieren Sie die Delegierung an Sub-Agenten über TaskToolSet.",
- "uk": "Увімкніть делегування субагентам через TaskToolSet.",
- "ca": "Activa la delegació a subagents mitjançant TaskToolSet."
- },
- "SCHEMA$ENABLE_SUB_AGENTS$LABEL": {
- "en": "Enable sub-agents",
- "ja": "サブエージェントを有効にする",
- "zh-CN": "启用子智能体",
- "zh-TW": "啟用子智能體",
- "ko-KR": "하위 에이전트 활성화",
- "no": "Aktiver underagenter",
- "it": "Abilita sottoagenti",
- "pt": "Ativar subagentes",
- "es": "Habilitar subagentes",
- "ar": "تمكين الوكلاء الفرعيين",
- "fr": "Activer les sous-agents",
- "tr": "Alt ajanları etkinleştir",
- "de": "Sub-Agenten aktivieren",
- "uk": "Увімкнути субагентів",
- "ca": "Activa subagents"
- },
- "SCHEMA$ENABLE_SWITCH_LLM_TOOL$DESCRIPTION": {
- "en": "Allow the agent to move this conversation to another saved LLM profile on its own. Disable to remove that tool.",
- "ja": "エージェントがこの会話を別の保存済み LLM プロファイルへ自動的に移すことを許可します。無効にするとそのツールが削除されます。",
- "zh-CN": "允许智能体自行将当前对话切换到另一个已保存的 LLM 配置。禁用后将移除该工具。",
- "zh-TW": "允許代理自行將目前對話切換到另一個已儲存的 LLM 設定檔。停用後將移除該工具。",
- "ko-KR": "에이전트가 이 대화를 다른 저장된 LLM 프로필로 스스로 전환하는 것을 허용합니다. 비활성화하면 해당 도구가 제거됩니다.",
- "no": "La agenten flytte denne samtalen til en annen lagret LLM-profil på egen hånd. Deaktiver for å fjerne verktøyet.",
- "it": "Consenti all'agente di spostare autonomamente questa conversazione su un altro profilo LLM salvato. Disattiva per rimuovere lo strumento.",
- "pt": "Permite que o agente mova esta conversa para outro perfil de LLM salvo por conta própria. Desative para remover essa ferramenta.",
- "es": "Permite que el agente traslade esta conversación a otro perfil de LLM guardado por su cuenta. Desactívalo para eliminar esa herramienta.",
- "ar": "السماح للوكيل بنقل هذه المحادثة إلى ملف LLM شخصي آخر محفوظ من تلقاء نفسه. عطّل هذا الخيار لإزالة تلك الأداة.",
- "fr": "Permettre à l'agent de transférer lui-même cette conversation vers un autre profil LLM enregistré. Désactivez pour retirer cet outil.",
- "tr": "Aracının bu konuşmayı kendi kendine kayıtlı başka bir LLM profiline taşımasına izin ver. Bu aracı kaldırmak için devre dışı bırak.",
- "de": "Erlauben Sie dem Agenten, diese Unterhaltung selbstständig auf ein anderes gespeichertes LLM-Profil zu übertragen. Deaktivieren, um das Werkzeug zu entfernen.",
- "uk": "Дозволити агенту самостійно переносити цю розмову до іншого збереженого профілю LLM. Вимкніть, щоб прибрати цей інструмент.",
- "ca": "Permet que l'agent mogui aquesta conversa a un altre perfil d'LLM desat per si mateix. Desactiva-ho per eliminar aquesta eina."
- },
- "SCHEMA$ENABLE_SWITCH_LLM_TOOL$LABEL": {
- "en": "Let the agent switch LLM profiles",
- "ja": "エージェントによる LLM プロファイルの切り替えを許可する",
- "zh-CN": "允许智能体切换 LLM 配置",
- "zh-TW": "允許代理切換 LLM 設定檔",
- "ko-KR": "에이전트가 LLM 프로필을 전환하도록 허용",
- "no": "La agenten bytte LLM-profil",
- "it": "Consenti all'agente di cambiare profilo LLM",
- "pt": "Permitir que o agente alterne perfis de LLM",
- "es": "Permitir que el agente cambie de perfil de LLM",
- "ar": "السماح للوكيل بتبديل ملفات LLM الشخصية",
- "fr": "Permettre à l'agent de changer de profil LLM",
- "tr": "Aracının LLM profilleri arasında geçiş yapmasına izin ver",
- "de": "Agenten das Wechseln von LLM-Profilen erlauben",
- "uk": "Дозволити агенту перемикати профілі LLM",
- "ca": "Permet que l'agent canvii de perfil d'LLM"
- },
"SCHEMA$AGENT_CONTEXT$SECTION_LABEL": {
"en": "Agent Context",
"ja": "エージェントコンテキスト",
diff --git a/src/mocks/agent-profiles-handlers.ts b/src/mocks/agent-profiles-handlers.ts
index 4fc76fbd6d..9b1b8e1891 100644
--- a/src/mocks/agent-profiles-handlers.ts
+++ b/src/mocks/agent-profiles-handlers.ts
@@ -4,6 +4,7 @@ import type {
AgentProfileSaveInput,
AgentProfileSummary,
} from "@openhands/typescript-client";
+import type { ToolCatalogEntry } from "#/api/tool-catalog-service/tool-catalog-service.api";
/**
* In-memory agent-profile store for the mock agent-server API. Keyed by name
@@ -41,7 +42,12 @@ const DEFAULT_VERIFICATION = {
};
function makeOpenHandsProfile(
- overrides: Partial<AgentProfile> & { id: string; name: string },
+ // Untyped in the pinned ts-client.
+ overrides: Partial<AgentProfile> & {
+ id: string;
+ name: string;
+ tools?: { name: string; params: Record<string, unknown> }[];
+ },
): AgentProfile {
return {
schema_version: 1,
@@ -54,7 +60,6 @@ function makeOpenHandsProfile(
system_message_suffix: null,
condenser: null,
verification: DEFAULT_VERIFICATION,
- enable_sub_agents: false,
tool_concurrency_limit: 1,
...overrides,
} as AgentProfile;
@@ -72,7 +77,7 @@ const SEEDED_PROFILES: readonly AgentProfile[] = [
makeOpenHandsProfile({
id: "3f1c1b7e-0000-4000-8000-000000000002",
name: "research",
- enable_sub_agents: true,
+ tools: [{ name: "task_tool_set", params: {} }],
tool_concurrency_limit: 4,
}),
];
@@ -126,6 +131,23 @@ function notFound(name: string) {
);
}
+const MOCK_TOOL_CATALOG: ToolCatalogEntry[] = [
+ ["terminal", true, "Run shell commands in a persistent terminal."],
+ ["file_editor", true, "View, create and edit files."],
+ ["task_tracker", true, "Plan and track multi-step work."],
+ ["browser_tool_set", true, "Browse and interact with web pages."],
+ ["switch_llm", true, "Switch to another configured LLM mid-conversation."],
+ ["task_tool_set", false, "Delegate work to sub-agents."],
+ ["glob", false, "Find files by glob pattern."],
+ ["grep", false, "Search file contents with regular expressions."],
+].map(([name, inDefaultSet, description]) => ({
+ name: name as string,
+ user_selectable: true,
+ usable: true,
+ in_default_set: inDefaultSet as boolean,
+ description: description as string,
+}));
+
/**
* Mock handlers for the agent-server `/api/agent-profiles` endpoints (the same
* contract consumed by `AgentProfilesService` and the cloud proxy).
@@ -135,6 +157,9 @@ function notFound(name: string) {
* extra path guarding is needed.
*/
export const AGENT_PROFILES_HANDLERS = [
+ http.get("*/api/tools/catalog", () =>
+ HttpResponse.json({ tools: MOCK_TOOL_CATALOG }),
+ ),
// GET /api/agent-profiles - List all profiles + the active id.
http.get("*/api/agent-profiles", async () => {
const summaries = Array.from(profiles.entries()).map(([name, profile]) =>
diff --git a/src/mocks/settings-handlers.ts b/src/mocks/settings-handlers.ts
index 607a09df78..ef110d1cae 100644
--- a/src/mocks/settings-handlers.ts
+++ b/src/mocks/settings-handlers.ts
@@ -73,36 +73,6 @@ const MOCK_AGENT_SETTINGS_SCHEMA: NonNullable<
key: "general",
label: "General",
fields: [
- {
- key: "enable_sub_agents",
- label: "Enable sub-agents",
- description:
- "Allow the agent to delegate work to specialized built-in sub-agents.",
- section: "general",
- section_label: "General",
- value_type: "boolean",
- default: false,
- choices: [],
- depends_on: [],
- prominence: "major",
- secret: false,
- required: false,
- },
- {
- key: "enable_switch_llm_tool",
- label: "Enable LLM switching tool",
- description:
- "Allow the agent to move the conversation to another saved LLM profile on its own.",
- section: "general",
- section_label: "General",
- value_type: "boolean",
- default: true,
- choices: [],
- depends_on: [],
- prominence: "major",
- secret: false,
- required: false,
- },
{
key: "tool_concurrency_limit",
label: "Parallel tool calls",
@@ -478,7 +448,6 @@ export const MOCK_DEFAULT_USER_SETTINGS: Settings = {
enable_default_condenser: true,
condenser_max_size: null,
},
- enable_sub_agents: false,
tool_concurrency_limit: 1,
},
conversation_settings_schema: MOCK_CONVERSATION_SETTINGS_SCHEMA,
@@ -671,11 +640,8 @@ const MOCK_VERIFIED_MODELS_BY_PROVIDER = MOCK_MODELS.reduce<
}, {});
// Matches the pinned `@openhands/typescript-client`, so mock mode models a
-// server that actually ships this schema. At 1.29.3 the mocked settings schema
-// advertised fields (`enable_switch_llm_tool`) that the mocked server's own
-// profile model would have rejected, and version-gated UI hid controls the
-// rest of the mocks were serving.
-const MOCK_AGENT_SERVER_VERSION = "1.48.0";
+// server that actually ships this schema.
+const MOCK_AGENT_SERVER_VERSION = "1.53.0";
// --- Handlers for options/config/settings ---
// Uses wildcard "*" prefix to match both relative paths and absolute URLs
diff --git a/src/routes/agent-settings.tsx b/src/routes/agent-settings.tsx
index 7986b9ac90..62bbb277dd 100644
--- a/src/routes/agent-settings.tsx
+++ b/src/routes/agent-settings.tsx
@@ -5,24 +5,23 @@ import { useSettings } from "#/hooks/query/use-settings";
import { useAgentSettingsSchema } from "#/hooks/query/use-agent-settings-schema";
import { SettingsDropdownInput } from "#/components/features/settings/settings-dropdown-input";
import { SettingsInput } from "#/components/features/settings/settings-input";
-import { SettingsSwitch } from "#/components/features/settings/settings-switch";
import { SchemaField } from "#/components/features/settings/sdk-settings/schema-field";
import { AcpCredentialsSection } from "#/components/features/settings/acp-credentials-section";
import { useAcpCredentialForm } from "#/hooks/use-acp-credential-form";
+import { BrandButton } from "#/components/features/settings/brand-button";
+import {
+ buildProfileToolsValue,
+ readProfileTools,
+ type ProfileToolSpec,
+} from "#/constants/profile-tools";
import { ProfileScopeList } from "#/components/features/settings/agent-profiles/profile-scope-list";
import { Typography } from "#/ui/typography";
import { I18nKey } from "#/i18n/declaration";
-import { formControlSwitchDescriptionClassName } from "#/utils/form-control-classes";
-import { cn } from "#/utils/utils";
import { SettingsFieldSchema, SettingsValue } from "#/types/settings";
import {
coerceFieldValue,
normalizeFieldValue,
} from "#/utils/sdk-settings-schema";
-import {
- resolveSchemaFieldDescription,
- resolveSchemaFieldLabel,
-} from "#/utils/sdk-settings-field-metadata";
import {
ACP_PROVIDERS,
ACP_CUSTOM_PRESET_KEY,
@@ -37,11 +36,12 @@ import {
sameScopeSelection,
type ProfileScopeMode,
} from "#/constants/profile-scope";
+import { useToolCatalog } from "#/hooks/query/use-tool-catalog";
import { flattenMcpConfig } from "#/utils/mcp-installed-servers";
import { parseMcpConfig } from "#/utils/mcp-config";
import {
agentProfileSupportsSecretRefs,
- agentProfileSupportsSwitchLlmTool,
+ agentProfileSupportsTools,
} from "#/api/agent-profiles-service/profile-field-support";
import { useSearchSecrets } from "#/hooks/query/use-get-secrets";
@@ -56,11 +56,10 @@ type AgentSettingsSnapshot = {
isCustomAcpModel: boolean;
};
-const ENABLE_SUB_AGENTS_FIELD_KEY = "enable_sub_agents";
-const ENABLE_SWITCH_LLM_TOOL_FIELD_KEY = "enable_switch_llm_tool";
const TOOL_CONCURRENCY_FIELD_KEY = "tool_concurrency_limit";
const MCP_SERVER_REFS_KEY = "mcp_server_refs";
const SECRET_REFS_KEY = "secret_refs";
+const TOOLS_KEY = "tools";
const COMMAND_PLACEHOLDER_FALLBACK = "npx -y <package-name>";
const ACP_CUSTOM_MODEL_KEY = "__custom_model__";
const EMPTY_AGENT_SETTINGS_SNAPSHOT: AgentSettingsSnapshot = {
@@ -89,28 +88,6 @@ function detectPreset(
return ACP_CUSTOM_PRESET_KEY;
}
-function findEnableSubAgentsField(
- fields: SettingsFieldSchema[] | undefined,
-): SettingsFieldSchema | undefined {
- return fields?.find((field) => field.key === ENABLE_SUB_AGENTS_FIELD_KEY);
-}
-
-function getEnableSubAgentsValue(
- settingsValue: unknown,
- field: SettingsFieldSchema | undefined,
-) {
- if (typeof settingsValue === "boolean") return settingsValue;
- return field?.default === true;
-}
-
-function getEnableSwitchLlmToolValue(
- settingsValue: unknown,
- field: SettingsFieldSchema | undefined,
-) {
- if (typeof settingsValue === "boolean") return settingsValue;
- return field?.default === true;
-}
-
function isKnownAcpModel(
provider: ACPProviderConfig | undefined,
model: string,
@@ -128,10 +105,9 @@ export type AgentProfileFieldsDraft =
| {
agent_kind: "openhands";
mcp_server_refs: string[] | null;
- enable_sub_agents: boolean;
- enable_switch_llm_tool?: boolean;
tool_concurrency_limit?: number;
secret_refs?: string[] | null;
+ tools?: ProfileToolSpec[] | null;
}
| {
agent_kind: "acp";
@@ -152,16 +128,6 @@ export interface AgentProfileFieldsInput {
isDefaultProviderCommand: boolean;
commandTokens: string[];
acpModel: string;
- subAgentsEnabled: boolean;
- switchLlmToolField?: SettingsFieldSchema;
- switchLlmToolEnabled: boolean;
- /**
- * Whether the backend's *profile* model accepts `enable_switch_llm_tool`.
- * Tracked apart from {@link switchLlmToolField} because the settings schema
- * and the profile model gained the field in different releases — see
- * {@link agentProfileSupportsSwitchLlmTool}.
- */
- switchLlmToolSupportedOnProfile: boolean;
toolConcurrencyField?: SettingsFieldSchema;
toolConcurrency: string | boolean;
mcpMode: ProfileScopeMode;
@@ -170,6 +136,12 @@ export interface AgentProfileFieldsInput {
selectedSecrets: string[];
/** Whether the backend's *profile* model accepts `secret_refs`. */
secretRefsSupportedOnProfile: boolean;
+ toolsMode?: ProfileScopeMode;
+ selectedTools?: string[];
+ /** Stored params per tool, kept so the editor cannot drop what it ignores. */
+ toolParams?: Record<string, Record<string, SettingsValue>>;
+ /** Whether the tool catalog loaded; `tools` is only written then. */
+ toolCatalogLoaded?: boolean;
}
/**
@@ -199,10 +171,6 @@ export function buildAgentProfileFields(
isDefaultProviderCommand,
commandTokens,
acpModel,
- subAgentsEnabled,
- switchLlmToolField,
- switchLlmToolEnabled,
- switchLlmToolSupportedOnProfile,
toolConcurrencyField,
toolConcurrency,
mcpMode,
@@ -210,6 +178,10 @@ export function buildAgentProfileFields(
secretsMode,
selectedSecrets,
secretRefsSupportedOnProfile,
+ toolsMode = "standard",
+ selectedTools = [],
+ toolParams = {},
+ toolCatalogLoaded = false,
} = input;
// Both are base-model fields, so they ride both variants. `mcp_server_refs`
// needs no version gate — it has existed since agent profiles shipped, below
@@ -239,16 +211,14 @@ export function buildAgentProfileFields(
{
agent_kind: "openhands",
...mcpRefs,
- enable_sub_agents: subAgentsEnabled,
...secretRefs,
};
- if (switchLlmToolField && switchLlmToolSupportedOnProfile) {
- // Two conditions, two different questions. The schema tells us the field
- // is a real setting on this server; the version gate tells us its
- // *profile* model will accept it. Between agent-server 1.29.0 and 1.30.x
- // the first is true and the second is not, and the whole-profile
- // overwrite is ``extra="forbid"`` — an unknown key 422s the entire save.
- fields.enable_switch_llm_tool = switchLlmToolEnabled;
+ if (toolCatalogLoaded) {
+ fields.tools = buildProfileToolsValue({
+ mode: toolsMode,
+ selected: selectedTools,
+ params: toolParams,
+ });
}
if (toolConcurrencyField) {
// Reuse the schema-driven coercion/validation; throws on bad input.
@@ -294,11 +264,14 @@ interface AgentSettingsScreenProps {
/** `agent_settings`-shaped profile fields the form opens on. */
agentSettingsOverride?: Record<string, SettingsValue> | null;
onSaveControlChange: (control: AgentSettingsSaveControl) => void;
+ /** Local launches route the `default` profile around its stored tools. */
+ isDefaultProfile?: boolean;
}
export function AgentSettingsScreen({
agentSettingsOverride = null,
onSaveControlChange,
+ isDefaultProfile = false,
}: AgentSettingsScreenProps) {
const { t } = useTranslation("openhands");
const { data: settings, isLoading } = useSettings();
@@ -306,44 +279,10 @@ export function AgentSettingsScreen({
settings?.agent_settings_schema,
);
- // --- Sub-agents (OpenHands path) ---
const fields = React.useMemo(
() => schema?.sections.flatMap((section) => section.fields),
[schema],
);
- const subAgentsField = findEnableSubAgentsField(fields);
- const initialSubAgentsEnabled = React.useMemo(
- () =>
- getEnableSubAgentsValue(
- agentSettingsOverride?.[ENABLE_SUB_AGENTS_FIELD_KEY],
- subAgentsField,
- ),
- [subAgentsField, agentSettingsOverride],
- );
- const [subAgentsEnabled, setSubAgentsEnabled] = useState(
- initialSubAgentsEnabled,
- );
-
- // --- LLM switching tool (OpenHands path) ---
- // Surfaced only when the backend schema exposes the field, so older
- // agent-servers that predate ``enable_switch_llm_tool`` hide it cleanly.
- const switchLlmToolField = fields?.find(
- (field) => field.key === ENABLE_SWITCH_LLM_TOOL_FIELD_KEY,
- );
- const initialSwitchLlmToolEnabled = React.useMemo(
- () =>
- getEnableSwitchLlmToolValue(
- agentSettingsOverride?.[ENABLE_SWITCH_LLM_TOOL_FIELD_KEY],
- switchLlmToolField,
- ),
- [switchLlmToolField, agentSettingsOverride],
- );
- const [switchLlmToolEnabled, setSwitchLlmToolEnabled] = useState(
- initialSwitchLlmToolEnabled,
- );
- const switchLlmToolSupportedOnProfile = agentProfileSupportsSwitchLlmTool();
- const showSwitchLlmTool =
- Boolean(switchLlmToolField) && switchLlmToolSupportedOnProfile;
// --- Parallel tool calls (OpenHands path) ---
// Surfaced only when the backend schema exposes the field, so older
@@ -360,6 +299,61 @@ export function AgentSettingsScreen({
initialToolConcurrency,
);
+ // --- Tools (OpenHands only) ---
+ const initialTools = React.useMemo(
+ () => readProfileTools(agentSettingsOverride?.[TOOLS_KEY]),
+ [agentSettingsOverride],
+ );
+ const [toolsMode, setToolsMode] = useState<ProfileScopeMode>(
+ initialTools.mode,
+ );
+ const [selectedTools, setSelectedTools] = useState<string[] | null>(
+ initialTools.mode === "custom" ? initialTools.selected : null,
+ );
+ const toolsSupported = agentProfileSupportsTools();
+ const toolsEditable = toolsSupported && !isDefaultProfile;
+ const {
+ data: toolCatalog,
+ isError: toolCatalogFailed,
+ refetch: refetchToolCatalog,
+ } = useToolCatalog({ enabled: toolsEditable });
+ // Only a loaded catalog may write `tools`.
+ const toolCatalogLoaded = toolCatalog !== undefined;
+ const standardToolNames = React.useMemo(
+ () =>
+ toolCatalog
+ ?.filter(({ in_default_set: inDefault, usable }) => inDefault && usable)
+ .map(({ name }) => name),
+ [toolCatalog],
+ );
+ /** The server's blurb for a tool, by name. */
+ const toolDescriptions = React.useMemo(
+ () =>
+ new Map(
+ (toolCatalog ?? []).map(({ name, description }) => [name, description]),
+ ),
+ [toolCatalog],
+ );
+ /** Pickable tools this runtime can run, plus anything the profile stores. */
+ const toolPickerCatalog = React.useMemo(() => {
+ const items: { name: string; description?: string }[] = (toolCatalog ?? [])
+ .filter(({ user_selectable: selectable, usable }) => selectable && usable)
+ .map(({ name, description }) => ({ name, description }));
+ // Stored names outside the catalog stay selectable so they are kept.
+ initialTools.selected.forEach((name) => {
+ if (!items.some((item) => item.name === name))
+ items.push({ name, description: toolDescriptions.get(name) });
+ });
+ return items;
+ }, [toolCatalog, toolDescriptions, initialTools]);
+ const orderedSelectedTools = React.useMemo(
+ () =>
+ toolPickerCatalog
+ .map(({ name }) => name)
+ .filter((name) => selectedTools?.includes(name)),
+ [toolPickerCatalog, selectedTools],
+ );
+
// --- MCP servers (both variants; a base-model field) ---
const initialMcpRefs = React.useMemo(
() => readProfileScope(agentSettingsOverride?.[MCP_SERVER_REFS_KEY]),
@@ -547,16 +541,6 @@ export function AgentSettingsScreen({
}
}, [agentSettingsOverride]);
- // Sync the sub-agents toggle when settings reload
- useEffect(() => {
- setSubAgentsEnabled(initialSubAgentsEnabled);
- }, [initialSubAgentsEnabled]);
-
- // Sync the LLM-switching toggle when settings reload
- useEffect(() => {
- setSwitchLlmToolEnabled(initialSwitchLlmToolEnabled);
- }, [initialSwitchLlmToolEnabled]);
-
// Sync the parallel-tool-calls input when settings reload
useEffect(() => {
setToolConcurrency(initialToolConcurrency);
@@ -568,6 +552,27 @@ export function AgentSettingsScreen({
setSelectedMcpServers(initialMcpRefs.selected);
}, [initialMcpRefs]);
+ // Seed a custom selection from the standard set once the catalog arrives,
+ // without replacing edits made while it was pending.
+ useEffect(() => {
+ if (toolsMode !== "custom" || standardToolNames === undefined) return;
+ setSelectedTools(
+ (previous) =>
+ previous ??
+ standardToolNames.filter((name) =>
+ toolPickerCatalog.some((entry) => entry.name === name),
+ ),
+ );
+ }, [toolsMode, standardToolNames, toolPickerCatalog]);
+
+ // Sync the tool selection when settings reload
+ useEffect(() => {
+ setToolsMode(initialTools.mode);
+ setSelectedTools(
+ initialTools.mode === "custom" ? initialTools.selected : null,
+ );
+ }, [initialTools]);
+
// Sync the secret scope when settings reload
useEffect(() => {
setSecretsMode(initialSecretRefs.mode);
@@ -581,7 +586,6 @@ export function AgentSettingsScreen({
const buildFieldsRef = useRef<() => AgentProfileFieldsDraft>(() => ({
agent_kind: "openhands",
mcp_server_refs: null,
- enable_sub_agents: false,
}));
const stableBuildFields = useCallback(() => buildFieldsRef.current(), []);
const credFormRef = useRef(acpCredentialForm);
@@ -605,23 +609,31 @@ export function AgentSettingsScreen({
const secretScopeDirty =
secretsMode !== initialSecretRefs.mode ||
!sameScopeSelection(orderedSelectedSecrets, initialSecretRefs.selected);
+ const toolSelectionDirty =
+ toolsMode !== initialTools.mode ||
+ (toolsMode === "custom" &&
+ !sameScopeSelection(orderedSelectedTools, initialTools.selected));
const settingsDirty =
agentType !== loadedSnapshot.agentType ||
mcpScopeDirty ||
secretScopeDirty ||
+ toolSelectionDirty ||
(agentType === "acp"
? commandText !== loadedSnapshot.commandText ||
acpModel !== loadedSnapshot.acpModel ||
isCustomAcpModel !== loadedSnapshot.isCustomAcpModel
- : subAgentsEnabled !== initialSubAgentsEnabled ||
- switchLlmToolEnabled !== initialSwitchLlmToolEnabled ||
- toolConcurrency !== initialToolConcurrency);
+ : toolConcurrency !== initialToolConcurrency);
const credentialsDirty = acpCredentialForm.isDirty;
const isAnyDirty = settingsDirty || credentialsDirty;
+ const customToolsUninitialized =
+ toolCatalogLoaded &&
+ agentType === "openhands" &&
+ toolsMode === "custom" &&
+ selectedTools === null;
useEffect(() => {
onSaveControlChange({
agentType,
- isValid: !acpCommandEmpty,
+ isValid: !acpCommandEmpty && !customToolsUninitialized,
isDirty: isAnyDirty,
buildAgentProfileFields: stableBuildFields,
credentials: {
@@ -634,6 +646,7 @@ export function AgentSettingsScreen({
onSaveControlChange,
agentType,
acpCommandEmpty,
+ customToolsUninitialized,
isAnyDirty,
credentialsDirty,
stableBuildFields,
@@ -672,10 +685,6 @@ export function AgentSettingsScreen({
isDefaultProviderCommand,
commandTokens,
acpModel,
- subAgentsEnabled,
- switchLlmToolField,
- switchLlmToolEnabled,
- switchLlmToolSupportedOnProfile,
toolConcurrencyField,
toolConcurrency,
mcpMode,
@@ -683,38 +692,14 @@ export function AgentSettingsScreen({
secretsMode,
selectedSecrets: orderedSelectedSecrets,
secretRefsSupportedOnProfile,
+ toolsMode,
+ selectedTools: orderedSelectedTools,
+ toolParams: initialTools.params,
+ toolCatalogLoaded,
});
const isSaving = acpCredentialForm.isSaving;
- // Sub-agents field metadata for OpenHands section
- const subAgentsLabel = subAgentsField
- ? resolveSchemaFieldLabel(t, subAgentsField.key, subAgentsField.label)
- : t(I18nKey.SCHEMA$ENABLE_SUB_AGENTS$LABEL);
- const subAgentsDescription = subAgentsField
- ? resolveSchemaFieldDescription(
- t,
- subAgentsField.key,
- subAgentsField.description,
- )
- : t(I18nKey.SCHEMA$ENABLE_SUB_AGENTS$DESCRIPTION);
-
- // LLM-switching field metadata for OpenHands section
- const switchLlmToolLabel = switchLlmToolField
- ? resolveSchemaFieldLabel(
- t,
- switchLlmToolField.key,
- switchLlmToolField.label,
- )
- : t(I18nKey.SCHEMA$ENABLE_SWITCH_LLM_TOOL$LABEL);
- const switchLlmToolDescription = switchLlmToolField
- ? resolveSchemaFieldDescription(
- t,
- switchLlmToolField.key,
- switchLlmToolField.description,
- )
- : t(I18nKey.SCHEMA$ENABLE_SWITCH_LLM_TOOL$DESCRIPTION);
-
return (
<div
data-testid="agent-settings-screen"
@@ -756,56 +741,6 @@ export function AgentSettingsScreen({
}}
/>
- {!isAcp && (
- <div className="flex flex-col gap-1.5">
- <SettingsSwitch
- testId="agent-settings-enable-sub-agents"
- isToggled={subAgentsEnabled}
- onToggle={(val) => {
- setSubAgentsEnabled(val);
- }}
- >
- {subAgentsLabel}
- </SettingsSwitch>
- {subAgentsDescription ? (
- <Typography.Paragraph
- className={cn(
- // eslint-disable-next-line shadcn/require-static-classes -- Shared static token is linted at its definition; cross-file constants are opaque to this rule.
- formControlSwitchDescriptionClassName,
- "text-tertiary-alt text-xs leading-5",
- )}
- >
- {subAgentsDescription}
- </Typography.Paragraph>
- ) : null}
- </div>
- )}
-
- {!isAcp && showSwitchLlmTool ? (
- <div className="flex flex-col gap-1.5">
- <SettingsSwitch
- testId="agent-settings-enable-switch-llm-tool"
- isToggled={switchLlmToolEnabled}
- onToggle={(val) => {
- setSwitchLlmToolEnabled(val);
- }}
- >
- {switchLlmToolLabel}
- </SettingsSwitch>
- {switchLlmToolDescription ? (
- <Typography.Paragraph
- className={cn(
- // eslint-disable-next-line shadcn/require-static-classes -- Shared static token is linted at its definition; cross-file constants are opaque to this rule.
- formControlSwitchDescriptionClassName,
- "text-tertiary-alt text-xs leading-5",
- )}
- >
- {switchLlmToolDescription}
- </Typography.Paragraph>
- ) : null}
- </div>
- ) : null}
-
{!isAcp && toolConcurrencyField ? (
<SchemaField
field={toolConcurrencyField}
@@ -814,6 +749,98 @@ export function AgentSettingsScreen({
onChange={setToolConcurrency}
/>
) : null}
+ {!isAcp && toolsSupported && isDefaultProfile ? (
+ <div className="flex flex-col gap-2.5">
+ <Typography.Text className="text-sm">
+ {t(I18nKey.SETTINGS$AGENT_PROFILE_TOOLS)}
+ </Typography.Text>
+ <Typography.Text
+ testId="agent-settings-tools-default-profile"
+ className="text-xs text-tertiary-alt"
+ >
+ {t(I18nKey.SETTINGS$AGENT_PROFILE_TOOLS_DEFAULT_PROFILE)}
+ </Typography.Text>
+ </div>
+ ) : null}
+ {!isAcp && toolsEditable ? (
+ <div className="flex flex-col gap-2.5">
+ <Typography.Text className="text-sm">
+ {t(I18nKey.SETTINGS$AGENT_PROFILE_TOOLS)}
+ </Typography.Text>
+ <SettingsDropdownInput
+ testId="agent-settings-tools-mode"
+ name="agent-tools-mode"
+ label=""
+ items={[
+ {
+ key: "standard",
+ label: t(I18nKey.SETTINGS$AGENT_PROFILE_TOOLS_STANDARD),
+ },
+ {
+ key: "custom",
+ label: t(I18nKey.SETTINGS$AGENT_PROFILE_TOOLS_CHOOSE),
+ },
+ ]}
+ selectedKey={toolsMode}
+ isDisabled={isSaving || standardToolNames === undefined}
+ onSelectionChange={(key) => {
+ if (!key) return;
+ setToolsMode(key as ProfileScopeMode);
+ }}
+ />
+ {toolCatalogFailed && standardToolNames === undefined ? (
+ <div
+ className="flex items-center gap-2"
+ data-testid="agent-settings-tools-load-failed"
+ >
+ <Typography.Text className="text-xs text-red-400">
+ {t(I18nKey.SETTINGS$AGENT_PROFILE_TOOLS_LOAD_FAILED)}{" "}
+ {t(I18nKey.SETTINGS$AGENT_PROFILE_TOOLS_KEPT_ON_SAVE)}
+ </Typography.Text>
+ <BrandButton
+ testId="agent-settings-tools-retry"
+ type="button"
+ variant="secondary"
+ onClick={() => refetchToolCatalog()}
+ >
+ {t(I18nKey.SETTINGS$AGENT_PROFILE_TOOLS_RETRY)}
+ </BrandButton>
+ </div>
+ ) : toolsMode === "standard" ? (
+ <ProfileScopeList
+ testId="agent-settings-tool"
+ items={(standardToolNames ?? []).map((name) => ({
+ name,
+ description: toolDescriptions.get(name),
+ }))}
+ selected={standardToolNames ?? []}
+ isDisabled
+ onToggle={() => {}}
+ />
+ ) : (
+ <ProfileScopeList
+ testId="agent-settings-tool"
+ items={toolPickerCatalog}
+ selected={orderedSelectedTools}
+ isDisabled={isSaving || !toolCatalogLoaded}
+ onToggle={(name, checked) =>
+ setSelectedTools((prev) =>
+ checked
+ ? [...(prev ?? []), name]
+ : (prev ?? []).filter((entry) => entry !== name),
+ )
+ }
+ />
+ )}
+ <Typography.Text className="text-xs text-tertiary-alt">
+ {t(
+ toolsMode === "custom"
+ ? I18nKey.SETTINGS$AGENT_PROFILE_TOOLS_CHOOSE_HINT
+ : I18nKey.SETTINGS$AGENT_PROFILE_TOOLS_STANDARD_HINT,
+ )}
+ </Typography.Text>
+ </div>
+ ) : null}
<div className="flex flex-col gap-2.5">
<Typography.Text className="text-sm">
diff --git a/src/services/settings.ts b/src/services/settings.ts
index 59ab76b769..4236abc369 100644
--- a/src/services/settings.ts
+++ b/src/services/settings.ts
@@ -34,7 +34,7 @@ export const DEFAULT_SETTINGS: Settings = {
title_llm_profile: null,
agent_settings_schema: null,
agent_settings: {
- schema_version: 6,
+ schema_version: 8,
agent_kind: "openhands",
agent: "CodeActAgent",
llm: {
@@ -48,8 +48,6 @@ export const DEFAULT_SETTINGS: Settings = {
critic_enabled: false,
enable_iterative_refinement: false,
},
- enable_sub_agents: false,
- enable_switch_llm_tool: true,
mcp_config: {},
},
conversation_settings_schema: null,
diff --git a/tools/canvas_ui_tool.py b/tools/canvas_ui_tool.py
index 228ee2026b..8249ea8c0b 100644
--- a/tools/canvas_ui_tool.py
+++ b/tools/canvas_ui_tool.py
@@ -20,7 +20,7 @@ at the bottom runs before any conversation is created.
"""
from collections.abc import Sequence
-from typing import Literal
+from typing import ClassVar, Literal
from pydantic import Field
@@ -117,6 +117,8 @@ the same turn."""
class CanvasUITool(ToolDefinition[CanvasUIAction, CanvasUIObservation]):
"""Tool for controlling the Agent Canvas UI from the agent."""
+ user_selectable: ClassVar[bool] = False
+
@classmethod
def create(
cls,