Skip to content

πŸ™Œ OpenHands: AI-Driven Development

chore: remove dead code (#18417)

Vasco Schiavoef3cb10e540c
diff --git a/.agents/skills/frontend-api-contracts/references/guide.md b/.agents/skills/frontend-api-contracts/references/guide.md
index 405aa911dc..5321e340a0 100644
--- a/.agents/skills/frontend-api-contracts/references/guide.md
+++ b/.agents/skills/frontend-api-contracts/references/guide.md
@@ -188,8 +188,6 @@ return new ConversationClient(getAgentServerClientOptions()).someMethod(...);
- Onboarding modal: `src/components/features/onboarding/onboarding-modal.tsx` is rendered by `<OnboardingHost />` and normally gated by the `openhands-onboarded` localStorage flag. `OnboardingHost` also suppresses the modal, without writing that flag, when any active Cloud backend's settings report a usable LLM (non-empty model plus API-key or subscription auth); this readiness exception must not apply to Local backends. It tracks logical phases (`backend`, `agent`, `setup`, `hello`) rather than fixed numeric steps; the backend phase may be omitted for an already configured backend. Agent choices are derived from `ACP_PROVIDERS` plus OpenHands. The setup phase renders `SetupLlmStep` for OpenHands or `SetupAcpSecretsStep` for ACP providers. Keep the phase-based navigation so adding or removing the backend slide cannot move users to the wrong step.
-- Files tab diff-view default logic: keyed off `useHasAttachedSource()` (`src/hooks/use-has-attached-source.ts`), which is true when the user explicitly attached _either_ a repo (`conversation.selected_repository`) _or_ a local workspace (`getStoredConversationMetadata(id).selected_workspace`, persisted by `createConversation` when `workingDirOverride` is supplied). The agent-server pre-initialises every conversation workspace as a git worktree for its own change tracking, so do NOT use a filesystem probe (`git status` / `useUnifiedGetGitChanges`) as the attachment signal β€” that was tried in earlier iterations and made every fresh no-attachment conversation incorrectly default to diff view. The companion `useHasGitCommits` probe (`src/hooks/query/use-has-git-commits.ts`) then suppresses diff view for attached-but-empty cases (unborn HEAD, non-git workspace).
-
- 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`.
- 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 }`.
diff --git a/.agents/skills/frontend-development/references/guide.md b/.agents/skills/frontend-development/references/guide.md
index 4878de4000..73ca9c6bb7 100644
--- a/.agents/skills/frontend-development/references/guide.md
+++ b/.agents/skills/frontend-development/references/guide.md
@@ -168,7 +168,7 @@ When adding code that needs a new string, decide up front which rule it falls un
- The environment-switch overlay is split: lightweight store/triggers live in `components/features/backends/environment-switch-store.ts`; the React component lives in `environment-switch-overlay.tsx` (re-exports the store API for back-compat). Eagerly-mounted callers (e.g. `backend-selector.tsx`) MUST import trigger helpers from the store, not the overlay file. The overlay is `React.lazy`'d from `routes/root-layout.tsx`.
- Conditional UI is `React.lazy`'d to keep eager graphs small. Current examples include `AlertBanner` and `CommandMenu` in `root-layout.tsx`, `SettingsModal` in the sidebar, and backend/onboarding modals in `root.tsx`. Tests that assert on these mounted nodes may need `await screen.findByTestId(...)` / `waitFor(...)` instead of synchronous `getByTestId(...)`.
- The terminal tab (`components/features/terminal/terminal.tsx`) is `React.lazy`'d in `conversation-tab-content.tsx` alongside the other tabs, so xterm + addon-fit + xterm.css don't enter the conversation route's eager graph (they ship as a separate `terminal-*.js` chunk now).
- - Avoid importing app code through `#/components/conversation-events/chat` or its `event-message-components/index.ts` barrel β€” they exist for `lib/index.ts` (npm subpath) consumers only. Internal callers use deep paths (`./messages`, `./event-message-components/<name>`, `./event-content-helpers/should-render-event`) so Vite dev doesn't fan out the barrel.
+ - `components/conversation-events/chat/` and `components/features/command-menu/` deliberately have no barrel `index.ts`. Import deep paths (`./messages`, `./event-message-components/<name>`, `./event-content-helpers/should-render-event`, `command-menu/command-menu`) so Vite dev doesn't fan out a barrel.
diff --git a/.agents/skills/verify-openhands/references/feature-map/F23-automation-detail.md b/.agents/skills/verify-openhands/references/feature-map/F23-automation-detail.md
index ee89f1ea5c..653a9bc607 100644
--- a/.agents/skills/verify-openhands/references/feature-map/F23-automation-detail.md
+++ b/.agents/skills/verify-openhands/references/feature-map/F23-automation-detail.md
@@ -14,7 +14,7 @@ which changes name, prompt, agent and LLM profile, timeout and the trigger. A
DRAFT-state test automation (materialized by a draft Test, F21.saved-drafts)
shows a **Draft** badge and no on/off switch.
-Source: `src/routes/automation-detail.tsx`, `src/components/features/automations/detail/`, `src/hooks/use-open-automation-editor.ts`, `src/utils/automation-edit-draft.ts`, `src/utils/automation-state.ts`, `src/components/features/automations/setup/automation-setup-panel.tsx` (edit mode), `src/components/features/automations/delete-confirmation-modal.tsx`, `src/hooks/query/use-automation-detail.ts`, `src/utils/automation-preset-sources.ts`, `src/hooks/query/use-bash-command-logs.ts`, `src/hooks/query/use-automation-tarball-files.ts`, `src/utils/automation-schedule.ts`, `src/utils/automation-timeout.ts`, `src/utils/automation-disabled-reason.ts`, `src/utils/automation-activity-log-export.ts`.
+Source: `src/routes/automation-detail.tsx`, `src/components/features/automations/detail/`, `src/hooks/use-open-automation-editor.ts`, `src/utils/automation-edit-draft.ts`, `src/utils/automation-state.ts`, `src/components/features/automations/setup/automation-setup-panel.tsx` (edit mode), `src/components/features/automations/delete-confirmation-modal.tsx`, `src/hooks/query/use-automation-detail.ts`, `src/utils/automation-preset-sources.ts`, `src/hooks/query/use-bash-command-logs.ts`, `src/hooks/query/use-automation-tarball-files.ts`, `src/utils/automation-schedule.ts`, `src/utils/automation-disabled-reason.ts`, `src/utils/automation-activity-log-export.ts`.
## Sub-features
diff --git a/.pr/1-detail-actions-menu.png b/.pr/1-detail-actions-menu.png
new file mode 100644
index 0000000000..f9fa8b130d
Binary files /dev/null and b/.pr/1-detail-actions-menu.png differ
diff --git a/.pr/2-edit-opens-setup-editor.png b/.pr/2-edit-opens-setup-editor.png
new file mode 100644
index 0000000000..2ce949faec
Binary files /dev/null and b/.pr/2-edit-opens-setup-editor.png differ
diff --git a/.pr/3-chat-input.png b/.pr/3-chat-input.png
new file mode 100644
index 0000000000..19985c1cb7
Binary files /dev/null and b/.pr/3-chat-input.png differ
diff --git a/__tests__/MSW.md b/__tests__/MSW.md
index 8cd0afb5f7..26e47c651b 100644
--- a/__tests__/MSW.md
+++ b/__tests__/MSW.md
@@ -75,8 +75,6 @@ it("should handle server errors", async () => {
});
```
-For WebSocket testing, see `__tests__/helpers/msw-websocket-setup.ts` for utilities.
-
## Adding New API Mocks
When adding new API endpoints, create mocks in both places to maintain 1:1 similarity with the backend:
diff --git a/__tests__/api/agent-server-adapter.test.ts b/__tests__/api/agent-server-adapter.test.ts
index 344725514d..93f21d1bb3 100644
--- a/__tests__/api/agent-server-adapter.test.ts
+++ b/__tests__/api/agent-server-adapter.test.ts
@@ -12,7 +12,7 @@ import {
buildRuntimeServicesSystemSuffix,
buildStartConversationRequest,
buildStartConversationRequestWithEncryptedSettings,
- fetchBackendRuntimeServicesInfo,
+ fetchBackendExecutionRuntime,
getDefaultConversationTitle,
parseRuntimeServicesInfo,
toAppConversation,
@@ -1486,45 +1486,27 @@ describe("buildRuntimeServicesSystemSuffix", () => {
expect(suffix).toContain("Automation backend: not running");
});
- it("fetches runtime services from cached server_info when available", async () => {
+ it("reads server_info from the cached probe when available", async () => {
mockGetCachedAgentServerInfo.mockReturnValue({
version: "1.48.0",
- runtime_services: {
- mode: "docker",
- services: {
- agent_server: { url_from_agent: "http://127.0.0.1:18000" },
- automation: {
- url_from_agent: "http://127.0.0.1:8000",
- api_prefix: "/api/automation",
- auth_env_var: "OPENHANDS_AUTOMATION_API_KEY",
- },
- },
- },
+ execution_runtime: "docker",
});
- const info = await fetchBackendRuntimeServicesInfo();
+ const runtime = await fetchBackendExecutionRuntime();
- expect(info?.mode).toBe("docker");
- expect(info?.services?.automation?.url_from_agent).toBe(
- "http://127.0.0.1:8000",
- );
+ expect(runtime).toBe("docker");
expect(mockGetServerInfo).not.toHaveBeenCalled();
});
- it("fetches runtime services from /server_info when there is no cached probe", async () => {
+ it("fetches /server_info when there is no cached probe", async () => {
mockGetServerInfo.mockResolvedValue({
version: "1.48.0",
- runtime_services: {
- mode: "dev:automation",
- services: {
- agent_server: { url_from_agent: "http://localhost:18000" },
- },
- },
+ execution_runtime: "local",
});
- const info = await fetchBackendRuntimeServicesInfo();
+ const runtime = await fetchBackendExecutionRuntime();
- expect(info?.mode).toBe("dev:automation");
+ expect(runtime).toBe("local");
expect(mockGetServerInfo).toHaveBeenCalledOnce();
});
});
diff --git a/__tests__/api/agent-server-compatibility-bundled-pin.test.ts b/__tests__/api/agent-server-compatibility-bundled-pin.test.ts
index 65f7cfb35f..eb557b691e 100644
--- a/__tests__/api/agent-server-compatibility-bundled-pin.test.ts
+++ b/__tests__/api/agent-server-compatibility-bundled-pin.test.ts
@@ -18,12 +18,10 @@ import {
clearCachedAgentServerInfo,
getCachedAgentServerInfo,
getCachedAgentServerVersion,
- getCachedAgentServerSdkVersion,
validateLocalBackend,
INVALID_BACKEND_API_KEY_ERROR,
isAgentServerAuthError,
isAgentServerUnavailableError,
- isAgentServerUnknownVersionError,
isAgentServerUnsupportedVersionError,
loadAgentServerInfo,
MINIMUM_COMPATIBLE_AGENT_SERVER_VERSION,
@@ -110,11 +108,9 @@ describe("loadAgentServerInfo", () => {
new AgentServerUnsupportedVersionError("1.27.0"),
),
).toBe(true);
- expect(
- isAgentServerUnknownVersionError(
- new AgentServerUnknownVersionError("dev-build"),
- ),
- ).toBe(true);
+ expect(new AgentServerUnknownVersionError("dev-build").code).toBe(
+ AGENT_SERVER_UNKNOWN_VERSION_ERROR_CODE,
+ );
(
window as unknown as Record<string, unknown>
@@ -365,7 +361,6 @@ describe("local backend validation", () => {
describe("cached display versions", () => {
it("returns no versions without a cache and limits populated values to the active host", async () => {
expect(getCachedAgentServerVersion()).toBeNull();
- expect(getCachedAgentServerSdkVersion()).toBeNull();
setRegisteredBackends([localBackend]);
setActiveSelection({ backendId: localBackend.id });
getServerInfoMock.mockResolvedValue({
@@ -376,16 +371,12 @@ describe("cached display versions", () => {
expect(getCachedAgentServerVersion()).toBe(
MINIMUM_COMPATIBLE_AGENT_SERVER_VERSION,
);
- expect(getCachedAgentServerSdkVersion()).toBe("9.8.7");
expect(getCachedAgentServerVersion(localBackend.host)).toBe(
MINIMUM_COMPATIBLE_AGENT_SERVER_VERSION,
);
- expect(getCachedAgentServerSdkVersion(localBackend.host)).toBe("9.8.7");
expect(getCachedAgentServerVersion("http://elsewhere.test")).toBeNull();
- expect(getCachedAgentServerSdkVersion("http://elsewhere.test")).toBeNull();
setRegisteredBackends([cloudBackend]);
setActiveSelection({ backendId: cloudBackend.id });
expect(getCachedAgentServerVersion(localBackend.host)).toBeNull();
- expect(getCachedAgentServerSdkVersion(localBackend.host)).toBeNull();
});
});
diff --git a/__tests__/api/backend-registry/last-conversation-store.test.ts b/__tests__/api/backend-registry/last-conversation-store.test.ts
index dbede7ef7e..979d982fe5 100644
--- a/__tests__/api/backend-registry/last-conversation-store.test.ts
+++ b/__tests__/api/backend-registry/last-conversation-store.test.ts
@@ -1,11 +1,15 @@
import { afterEach, beforeEach, describe, expect, it } from "vitest";
import {
clearLastConversationId,
- getLastConversationId,
LAST_CONVERSATION_STORAGE_KEY,
setLastConversationId,
} from "#/api/backend-registry/last-conversation-store";
+const readStoredMap = (): Record<string, string> =>
+ JSON.parse(
+ window.localStorage.getItem(LAST_CONVERSATION_STORAGE_KEY) ?? "{}",
+ ) as Record<string, string>;
+
beforeEach(() => {
window.localStorage.clear();
});
@@ -15,31 +19,32 @@ afterEach(() => {
});
describe("last-conversation-store", () => {
- it("returns null when nothing has been remembered for a backend", () => {
- expect(getLastConversationId("backend-a", null)).toBeNull();
- });
-
- it("remembers and reads back the most recently selected conversation per backend", () => {
+ it("remembers the most recently selected conversation per backend", () => {
setLastConversationId("backend-a", null, "convo-a-1");
setLastConversationId("backend-b", null, "convo-b-1");
- expect(getLastConversationId("backend-a", null)).toBe("convo-a-1");
- expect(getLastConversationId("backend-b", null)).toBe("convo-b-1");
+ expect(readStoredMap()).toEqual({
+ "backend-a": "convo-a-1",
+ "backend-b": "convo-b-1",
+ });
- // The most recent selection wins.
+ // The most recent selection wins…
setLastConversationId("backend-a", null, "convo-a-2");
- expect(getLastConversationId("backend-a", null)).toBe("convo-a-2");
// …without affecting other backends.
- expect(getLastConversationId("backend-b", null)).toBe("convo-b-1");
+ expect(readStoredMap()).toEqual({
+ "backend-a": "convo-a-2",
+ "backend-b": "convo-b-1",
+ });
});
it("keys cloud backends by (backendId, orgId) so each org gets its own slot", () => {
setLastConversationId("cloud-x", "org-1", "convo-org-1");
setLastConversationId("cloud-x", "org-2", "convo-org-2");
- expect(getLastConversationId("cloud-x", "org-1")).toBe("convo-org-1");
- expect(getLastConversationId("cloud-x", "org-2")).toBe("convo-org-2");
- expect(getLastConversationId("cloud-x", null)).toBeNull();
+ expect(readStoredMap()).toEqual({
+ "cloud-x::org-1": "convo-org-1",
+ "cloud-x::org-2": "convo-org-2",
+ });
});
it("clears a backend's slot without touching others", () => {
@@ -48,20 +53,20 @@ describe("last-conversation-store", () => {
clearLastConversationId("backend-a", null);
- expect(getLastConversationId("backend-a", null)).toBeNull();
- expect(getLastConversationId("backend-b", null)).toBe("convo-b");
+ expect(readStoredMap()).toEqual({ "backend-b": "convo-b" });
});
it("ignores empty conversation ids on write", () => {
setLastConversationId("backend-a", null, "");
- expect(getLastConversationId("backend-a", null)).toBeNull();
+ expect(
+ window.localStorage.getItem(LAST_CONVERSATION_STORAGE_KEY),
+ ).toBeNull();
});
it("survives malformed JSON in storage", () => {
window.localStorage.setItem(LAST_CONVERSATION_STORAGE_KEY, "not-json");
- expect(getLastConversationId("backend-a", null)).toBeNull();
// A subsequent write recovers the storage shape.
setLastConversationId("backend-a", null, "convo-a");
- expect(getLastConversationId("backend-a", null)).toBe("convo-a");
+ expect(readStoredMap()).toEqual({ "backend-a": "convo-a" });
});
});
diff --git a/__tests__/api/mock-settings-catalog.test.ts b/__tests__/api/mock-settings-catalog.test.ts
index 7256776077..da02c151a1 100644
--- a/__tests__/api/mock-settings-catalog.test.ts
+++ b/__tests__/api/mock-settings-catalog.test.ts
@@ -8,7 +8,6 @@ import {
OPENAI_SUBSCRIPTION_MODELS_PATH,
OPENAI_SUBSCRIPTION_STATUS_PATH,
} from "#/constants/llm-subscription";
-let createMockWebClientConfig: typeof import("#/mocks/settings-handlers").createMockWebClientConfig;
const BASE_URL = "http://localhost:3000";
@@ -21,7 +20,6 @@ const fetchJson = async <T>(path: string, init?: RequestInit) => {
beforeEach(async () => {
vi.resetModules();
const handlers = await import("#/mocks/settings-handlers");
- createMockWebClientConfig = handlers.createMockWebClientConfig;
server.resetHandlers(
...handlers.SETTINGS_HANDLERS,
http.all("*", () => new HttpResponse(null, { status: 599 })),
@@ -29,39 +27,6 @@ beforeEach(async () => {
});
describe("mock agent-server discovery", () => {
- it("builds a complete web-client config with optional overrides", () => {
- const defaults = createMockWebClientConfig();
- expect(defaults).toEqual({
- feature_flags: {
- hide_llm_settings: false,
- hide_users_page: false,
- },
- providers_configured: [],
- maintenance_start_time: null,
- recaptcha_site_key: null,
- faulty_models: [],
- error_message: null,
- updated_at: expect.any(String),
- });
-
- expect(
- createMockWebClientConfig({
- feature_flags: {
- hide_llm_settings: true,
- hide_users_page: false,
- },
- updated_at: "2030-01-01T00:00:00.000Z",
- }),
- ).toEqual({
- ...defaults,
- feature_flags: {
- hide_llm_settings: true,
- hide_users_page: false,
- },
- updated_at: "2030-01-01T00:00:00.000Z",
- });
- });
-
it("publishes server metadata and the legacy model catalog", async () => {
const serverInfo = await fetchJson<{
version: string;
diff --git a/__tests__/components/automations/detail/edit-automation-modal.test.tsx b/__tests__/components/automations/detail/edit-automation-modal.test.tsx
deleted file mode 100644
index 05b9216c14..0000000000
--- a/__tests__/components/automations/detail/edit-automation-modal.test.tsx
+++ /dev/null
@@ -1,780 +0,0 @@
-import { describe, it, expect, vi, beforeEach } from "vitest";
-import { render, screen, waitFor } from "@testing-library/react";
-import userEvent from "@testing-library/user-event";
-import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
-
-import { EditAutomationModal } from "#/components/features/automations/detail/edit-automation-modal";
-import AutomationService from "#/api/automation-service/automation-service.api";
-import ProfilesService from "#/api/profiles-service/profiles-service.api";
-import { ActiveBackendProvider } from "#/contexts/active-backend-context";
-import {
- __resetActiveStoreForTests,
- setActiveSelection,
- setRegisteredBackends,
-} from "#/api/backend-registry/active-store";
-import {
- displaySuccessToast,
- displayErrorToast,
-} from "#/utils/custom-toast-handlers";
-import type { Automation } from "#/types/automation";
-import type { Backend } from "#/api/backend-registry/types";
-
-vi.mock("#/api/automation-service/automation-service.api", () => ({
- default: {
- updateAutomation: vi.fn(),
- getCapabilities: vi.fn(),
- },
-}));
-
-vi.mock("#/api/profiles-service/profiles-service.api", () => ({
- default: {
- listProfiles: vi.fn(),
- },
-}));
-
-vi.mock("#/hooks/query/use-agent-profiles", () => ({
- useAgentProfiles: () => ({
- data: { profiles: [{ id: "review-profile", name: "Reviewer" }] },
- isLoading: false,
- isError: false,
- }),
-}));
-
-vi.mock("#/utils/custom-toast-handlers", () => ({
- displaySuccessToast: vi.fn(),
- displayErrorToast: vi.fn(),
-}));
-
-// The form is the interface manifest's, so these tests run against the
-// manifest the pinned package publishes β€” the one a user meets.
-vi.mock("#/manifests/manifest-sources", async (importOriginal) => {
- const extensions = await import("@openhands/extensions/automations");
- return {
- ...(await importOriginal<typeof import("#/manifests/manifest-sources")>()),
- AUTOMATION_INTERFACE_CANDIDATE: (
- extensions as { AUTOMATION_INTERFACE?: unknown }
- ).AUTOMATION_INTERFACE,
- };
-});
-
-// The interface seam resolves its manifest once at module load, so the
-// manifest-driven test overrides individual attribute specs here instead of
-// installing a whole manifest. Empty overrides leave the published
-// manifest's form in force for every other test.
-const specOverrides = vi.hoisted(() => ({
- current: {} as Record<string, object>,
-}));
-vi.mock("#/manifests/automation-interface", async (importOriginal) => {
- const actual =
- await importOriginal<typeof import("#/manifests/automation-interface")>();
- return {
- ...actual,
- getAttributeSpec: (
- name: Parameters<typeof actual.getAttributeSpec>[0],
- ) => ({
- ...actual.getAttributeSpec(name),
- ...specOverrides.current[name],
- }),
- };
-});
-
-const localBackend: Backend = {
- id: "local-1",
- name: "Local",
- host: "http://localhost:8000",
- apiKey: "session-key",
- kind: "local",
-};
-
-const dailyAutomation: Automation = {
- id: "auto-1",
- name: "Daily digest",
- prompt: "Summarize yesterday's PRs",
- trigger: { type: "cron", schedule: "0 9 * * *" },
- enabled: true,
- created_at: "2026-01-01T00:00:00Z",
- updated_at: "2026-01-01T00:00:00Z",
- timezone: "America/Los_Angeles",
-};
-
-const customAutomation: Automation = {
- ...dailyAutomation,
- id: "auto-2",
- name: "Twice daily",
- trigger: { type: "cron", schedule: "0 9,17 * * *" },
-};
-
-// An automation whose stored schedule this form's validator rejects.
-const rejectedScheduleAutomation: Automation = {
- ...dailyAutomation,
- id: "auto-6",
- name: "Legacy schedule",
- trigger: { type: "cron", schedule: "0 0 30 2 *" },
-};
-
-// An event-triggered automation. `buildInitialState` marks these as custom
-// schedules too, so they guard the submit path against cron validation.
-const eventAutomation: Automation = {
- ...dailyAutomation,
- id: "auto-5",
- name: "On PR opened",
- trigger: { type: "event", source: "github", on: "pull_request.opened" },
-};
-
-// A schedule automation pinned to a concrete LLM profile, used to exercise
-// the profile picker (the base fixtures intentionally leave `model` unset).
-const modeledAutomation: Automation = {
- ...dailyAutomation,
- id: "auto-3",
- model: "fast",
-};
-
-// An automation carrying an explicit run timeout (in seconds). The base
-// fixtures intentionally leave `timeout` unset.
-const timeoutAutomation: Automation = {
- ...dailyAutomation,
- id: "auto-4",
- timeout: 600,
-};
-
-const profilesResponse = {
- profiles: [
- {
- name: "fast",
- model: "anthropic/claude-haiku-4-5",
- base_url: null,
- api_key_set: true,
- },
- {
- name: "careful",
- model: "anthropic/claude-opus-4-8",
- base_url: null,
- api_key_set: true,
- },
- ],
- active_profile: "fast",
-};
-
-function renderModal(automation: Automation) {
- const onClose = vi.fn();
- const queryClient = new QueryClient({
- defaultOptions: { queries: { retry: false }, mutations: { retry: false } },
- });
- const utils = render(
- <QueryClientProvider client={queryClient}>
- <ActiveBackendProvider>
- <EditAutomationModal automation={automation} isOpen onClose={onClose} />
- </ActiveBackendProvider>
- </QueryClientProvider>,
- );
- return { ...utils, onClose };
-}
-
-beforeEach(() => {
- vi.clearAllMocks();
- specOverrides.current = {};
- __resetActiveStoreForTests();
- setRegisteredBackends([localBackend]);
- setActiveSelection({ backendId: localBackend.id });
- // Default to no profiles; tests that exercise the picker override this.
- vi.mocked(ProfilesService.listProfiles).mockResolvedValue({
- profiles: [],
- active_profile: null,
- });
- vi.mocked(AutomationService.getCapabilities).mockResolvedValue({
- ready: true,
- maxAutomationTimeoutSeconds: 900,
- triggerKinds: ["cron"],
- eventSources: [],
- eventTypes: [],
- triggers: {},
- features: [],
- });
-});
-
-describe("EditAutomationModal", () => {
- it("pre-fills current values and PATCHes only the fields that changed", async () => {
- // Arrange β€” daily automation at 09:00 with a known prompt. The
- // backend will echo back the merged result.
- vi.mocked(AutomationService.updateAutomation).mockResolvedValue({
- ...dailyAutomation,
- name: "Morning digest",
- prompt: "Summarize today's open PRs",
- trigger: { type: "cron", schedule: "30 10 * * *" },
- });
- const user = userEvent.setup();
- const { onClose } = renderModal(dailyAutomation);
-
- // Sanity-check pre-fill: the inputs reflect the existing automation
- // before the user edits anything.
- const nameInput = screen.getByTestId(
- "edit-automation-name",
- ) as HTMLInputElement;
- const timeInput = screen.getByTestId(
- "edit-automation-time",
- ) as HTMLInputElement;
- expect(nameInput.value).toBe("Daily digest");
- expect(timeInput.value).toBe("09:00");
-
- // Act β€” change name, prompt, and time; leave frequency at Daily.
- await user.clear(nameInput);
- await user.type(nameInput, "Morning digest");
- const promptInput = screen.getByTestId("edit-automation-prompt");
- await user.clear(promptInput);
- await user.type(promptInput, "Summarize today's open PRs");
- await user.clear(timeInput);
- await user.type(timeInput, "10:30");
- await user.click(screen.getByTestId("edit-automation-save"));
-
- // Assert β€” PATCH body contains exactly the diff (no untouched
- // fields like enabled/repository), and the success path closes
- // the modal + toasts the user.
- await waitFor(() => {
- expect(AutomationService.updateAutomation).toHaveBeenCalledTimes(1);
- });
- expect(AutomationService.updateAutomation).toHaveBeenCalledWith("auto-1", {
- name: "Morning digest",
- prompt: "Summarize today's open PRs",
- trigger: { type: "cron", schedule: "30 10 * * *" },
- });
- await waitFor(() => {
- expect(displaySuccessToast).toHaveBeenCalledTimes(1);
- });
- expect(onClose).toHaveBeenCalled();
- });
-
- it("blocks submit and shows a validation error when the name is empty", async () => {
- // Arrange
- const user = userEvent.setup();
- renderModal(dailyAutomation);
-
- // Act β€” clear the name and try to save.
- const nameInput = screen.getByTestId("edit-automation-name");
- await user.clear(nameInput);
- await user.click(screen.getByTestId("edit-automation-save"));
-
- // Assert β€” no PATCH fired, inline error appears.
- expect(AutomationService.updateAutomation).not.toHaveBeenCalled();
- expect(
- screen.getByTestId("edit-automation-name-error"),
- ).toBeInTheDocument();
- });
-
- it("renders the cron field and skips schedule mutation for non-preset cron", async () => {
- // Arrange β€” schedule "0 9,17 * * *" is not a Daily/Weekdays/Weekly
- // preset; frequency stays read-only but the expression itself, and
- // the prompt/name, remain editable.
- vi.mocked(AutomationService.updateAutomation).mockResolvedValue(
- customAutomation,
- );
- const user = userEvent.setup();
- renderModal(customAutomation);
-
- // The cron field is the user-visible signal that we're in custom mode.
- expect(screen.getByTestId("edit-automation-cron")).toBeInTheDocument();
- expect(screen.getByTestId("edit-automation-frequency")).toBeDisabled();
-
- // Act β€” change only the name and save.
- const nameInput = screen.getByTestId("edit-automation-name");
- await user.clear(nameInput);
- await user.type(nameInput, "Renamed");
- await user.click(screen.getByTestId("edit-automation-save"));
-
- // Assert β€” the PATCH body does NOT include a trigger override, so
- // the user's hand-tuned cron is preserved.
- await waitFor(() => {
- expect(AutomationService.updateAutomation).toHaveBeenCalledTimes(1);
- });
- const [, body] = vi.mocked(AutomationService.updateAutomation).mock
- .calls[0];
- expect(body).not.toHaveProperty("trigger");
- expect(body).toMatchObject({ name: "Renamed" });
- });
-
- it("sends the edited cron expression for a custom schedule", async () => {
- // Arrange
- vi.mocked(AutomationService.updateAutomation).mockResolvedValue(
- customAutomation,
- );
- const user = userEvent.setup();
- renderModal(customAutomation);
-
- // The field starts pre-filled with the automation's own expression.
- const cronInput = screen.getByTestId("edit-automation-cron");
- expect(cronInput).toHaveValue("0 9,17 * * *");
-
- // Act
- await user.clear(cronInput);
- await user.type(cronInput, "*/5 * * * *");
- await user.click(screen.getByTestId("edit-automation-save"));
-
- // Assert
- await waitFor(() => {
- expect(AutomationService.updateAutomation).toHaveBeenCalledTimes(1);
- });
- const [, body] = vi.mocked(AutomationService.updateAutomation).mock
- .calls[0];
- expect(body).toMatchObject({
- trigger: { type: "cron", schedule: "*/5 * * * *" },
- });
- });
-
- it("blocks an invalid cron expression instead of sending it", async () => {
- // Arrange
- const user = userEvent.setup();
- renderModal(customAutomation);
-
- // Act β€” 60 is out of range for the minute field.
- const cronInput = screen.getByTestId("edit-automation-cron");
- await user.clear(cronInput);
- await user.type(cronInput, "60 * * * *");
- await user.click(screen.getByTestId("edit-automation-save"));
-
- // Assert β€” the error surfaces and nothing reaches the API.
- expect(
- await screen.findByText("AUTOMATIONS$ERROR_CRON_INVALID"),
- ).toBeInTheDocument();
- expect(AutomationService.updateAutomation).not.toHaveBeenCalled();
- });
-
- it("saves an unrelated edit without revalidating an untouched schedule", async () => {
- // Arrange β€” the stored expression is one this form would reject.
- vi.mocked(AutomationService.updateAutomation).mockResolvedValue(
- rejectedScheduleAutomation,
- );
- const user = userEvent.setup();
- renderModal(rejectedScheduleAutomation);
-
- // Act β€” change only the name.
- const nameInput = screen.getByTestId("edit-automation-name");
- await user.clear(nameInput);
- await user.type(nameInput, "Renamed");
- await user.click(screen.getByTestId("edit-automation-save"));
-
- // Assert
- await waitFor(() => {
- expect(AutomationService.updateAutomation).toHaveBeenCalledTimes(1);
- });
- const [, body] = vi.mocked(AutomationService.updateAutomation).mock
- .calls[0];
- expect(body).not.toHaveProperty("trigger");
- expect(body).toMatchObject({ name: "Renamed" });
- expect(screen.queryByText("AUTOMATIONS$ERROR_CRON_INVALID")).toBeNull();
- });
-
- it("sends a named-day expression the automation service accepts", async () => {
- // Arrange β€” croniter takes day names.
- vi.mocked(AutomationService.updateAutomation).mockResolvedValue(
- customAutomation,
- );
- const user = userEvent.setup();
- renderModal(customAutomation);
-
- // Act
- const cronInput = screen.getByTestId("edit-automation-cron");
- await user.clear(cronInput);
- await user.type(cronInput, "0 0 * * SUN");
- await user.click(screen.getByTestId("edit-automation-save"));
-
- // Assert
- await waitFor(() => {
- expect(AutomationService.updateAutomation).toHaveBeenCalledTimes(1);
- });
- const [, body] = vi.mocked(AutomationService.updateAutomation).mock
- .calls[0];
- expect(body).toMatchObject({
- trigger: { type: "cron", schedule: "0 0 * * SUN" },
- });
- });
-
- it("blocks a schedule that can never fire instead of sending it", async () => {
- // Arrange
- const user = userEvent.setup();
- renderModal(customAutomation);
-
- // Act β€” February never has a 31st.
- const cronInput = screen.getByTestId("edit-automation-cron");
- await user.clear(cronInput);
- await user.type(cronInput, "0 0 31 2 *");
- await user.click(screen.getByTestId("edit-automation-save"));
-
- // Assert
- expect(
- await screen.findByText("AUTOMATIONS$ERROR_CRON_UNREACHABLE"),
- ).toBeInTheDocument();
- expect(AutomationService.updateAutomation).not.toHaveBeenCalled();
- });
-
- it("disables the time input while the cron field owns the schedule", () => {
- // Arrange / Act
- renderModal(customAutomation);
-
- // Assert β€” the field no longer accepts input that save would discard.
- expect(screen.getByTestId("edit-automation-time")).toBeDisabled();
- expect(screen.getByTestId("edit-automation-cron")).toBeEnabled();
- });
-
- it("saves an event-triggered automation without a cron trigger", async () => {
- // Arrange β€” these have no schedule, so cron validation must not run.
- vi.mocked(AutomationService.updateAutomation).mockResolvedValue(
- eventAutomation,
- );
- const user = userEvent.setup();
- renderModal(eventAutomation);
-
- // Act
- const nameInput = screen.getByTestId("edit-automation-name");
- await user.clear(nameInput);
- await user.type(nameInput, "Renamed");
- await user.click(screen.getByTestId("edit-automation-save"));
-
- // Assert
- await waitFor(() => {
- expect(AutomationService.updateAutomation).toHaveBeenCalledTimes(1);
- });
- const [, body] = vi.mocked(AutomationService.updateAutomation).mock
- .calls[0];
- expect(body).not.toHaveProperty("trigger");
- expect(body).toMatchObject({ name: "Renamed" });
- });
-
- it("surfaces an error toast and keeps the modal open when the update fails", async () => {
- // Arrange β€” backend rejects the PATCH.
- vi.mocked(AutomationService.updateAutomation).mockRejectedValue(
- new Error("backend down"),
- );
- const user = userEvent.setup();
- const { onClose } = renderModal(dailyAutomation);
-
- // Act β€” change the time to force a non-empty diff, then save.
- const timeInput = screen.getByTestId("edit-automation-time");
- await user.clear(timeInput);
- await user.type(timeInput, "10:30");
- await user.click(screen.getByTestId("edit-automation-save"));
-
- // Assert β€” error toast fired, modal stays open.
- await waitFor(() => {
- expect(displayErrorToast).toHaveBeenCalledTimes(1);
- });
- expect(onClose).not.toHaveBeenCalled();
- });
-
- it("cannot be dismissed while a save is pending, so a failed save still shows its toast", async () => {
- // Arrange β€” the PATCH stays in flight until the test rejects it.
- let rejectSave: (error: Error) => void = () => {};
- vi.mocked(AutomationService.updateAutomation).mockReturnValue(
- new Promise((_, reject) => {
- rejectSave = reject;
- }),
- );
- const user = userEvent.setup();
- const { container, onClose } = renderModal(dailyAutomation);
- const timeInput = screen.getByTestId("edit-automation-time");
- await user.clear(timeInput);
- await user.type(timeInput, "10:30");
- await user.click(screen.getByTestId("edit-automation-save"));
- await waitFor(() =>
- expect(AutomationService.updateAutomation).toHaveBeenCalledTimes(1),
- );
-
- // Act β€” try every dismiss path while the save is pending.
- const backdrop = container.querySelector<HTMLElement>(
- '[role="presentation"]',
- )!;
- // The X in the corner; the footer Cancel button shares its name.
- const [closeButton] = screen.getAllByRole("button", {
- name: "AUTOMATIONS$CANCEL",
- });
- await user.click(backdrop);
- backdrop.focus();
- await user.keyboard("{Escape}");
- await user.click(closeButton);
-
- // Assert β€” the dialog stays, and the failure reaches its toast.
- expect(closeButton).toBeDisabled();
- expect(onClose).not.toHaveBeenCalled();
- rejectSave(new Error("backend down"));
- await waitFor(() => {
- expect(displayErrorToast).toHaveBeenCalledTimes(1);
- });
- await waitFor(() => expect(closeButton).toBeEnabled());
- await user.click(closeButton);
- expect(onClose).toHaveBeenCalledTimes(1);
- });
-
- it("persists the newly selected LLM profile in the update payload", async () => {
- // Arrange β€” automation currently runs on the "fast" profile, with a
- // second "careful" profile available to switch to.
- vi.mocked(ProfilesService.listProfiles).mockResolvedValue(profilesResponse);
- vi.mocked(AutomationService.updateAutomation).mockResolvedValue({
- ...modeledAutomation,
- model: "careful",
- });
- const user = userEvent.setup();
- const { onClose } = renderModal(modeledAutomation);
-
- // The picker pre-fills with the automation's current profile once the
- // available profiles have loaded.
- await waitFor(() =>
- expect(screen.getByLabelText("LLM profile")).toHaveValue("fast"),
- );
-
- // Act β€” switch to "careful" and save.
- await user.click(screen.getByLabelText("LLM profile"));
- await user.click(await screen.findByText("careful"));
- await user.click(screen.getByTestId("edit-automation-save"));
-
- // Assert β€” only the profile changed, so the PATCH carries just `model`.
- await waitFor(() => {
- expect(AutomationService.updateAutomation).toHaveBeenCalledTimes(1);
- });
- expect(AutomationService.updateAutomation).toHaveBeenCalledWith("auto-3", {
- model: "careful",
- });
- expect(onClose).toHaveBeenCalled();
- });
-
- it("resets the LLM profile to active when 'Active profile' is selected", async () => {
- // Arrange β€” automation pinned to "fast"; the backend re-resolves a null
- // model back to whatever profile is active.
- vi.mocked(ProfilesService.listProfiles).mockResolvedValue(profilesResponse);
- vi.mocked(AutomationService.updateAutomation).mockResolvedValue({
- ...modeledAutomation,
- model: "fast",
- });
- const user = userEvent.setup();
- renderModal(modeledAutomation);
-
- // The picker pre-fills with the pinned profile once profiles have loaded.
- await waitFor(() =>
- expect(screen.getByLabelText("LLM profile")).toHaveValue("fast"),
- );
-
- // Act β€” clear the pin via the "Active profile" option, then save.
- await user.click(screen.getByLabelText("LLM profile"));
- await user.click(await screen.findByText("COMMON$ACTIVE_PROFILE"));
- await user.click(screen.getByTestId("edit-automation-save"));
-
- // Assert β€” the PATCH carries model: null so the backend resets to active.
- await waitFor(() => {
- expect(AutomationService.updateAutomation).toHaveBeenCalledTimes(1);
- });
- expect(AutomationService.updateAutomation).toHaveBeenCalledWith("auto-3", {
- model: null,
- });
- });
-
- it("omits the LLM profile from the payload when it is left unchanged", async () => {
- // Arrange β€” profiles available; the user will only rename the automation.
- vi.mocked(ProfilesService.listProfiles).mockResolvedValue(profilesResponse);
- vi.mocked(AutomationService.updateAutomation).mockResolvedValue(
- modeledAutomation,
- );
- const user = userEvent.setup();
- renderModal(modeledAutomation);
-
- // Ensure we're on the profiles-available path before editing.
- await screen.findByLabelText("LLM profile");
-
- // Act β€” change only the name; leave the profile on "fast".
- const nameInput = screen.getByTestId("edit-automation-name");
- await user.clear(nameInput);
- await user.type(nameInput, "Renamed digest");
- await user.click(screen.getByTestId("edit-automation-save"));
-
- // Assert β€” the PATCH renames but does not resend the unchanged profile.
- await waitFor(() => {
- expect(AutomationService.updateAutomation).toHaveBeenCalledTimes(1);
- });
- const [, body] = vi.mocked(AutomationService.updateAutomation).mock
- .calls[0];
- expect(body).toMatchObject({ name: "Renamed digest" });
- expect(body).not.toHaveProperty("model");
- });
-
- it("hides the LLM profile picker when no profiles are available", async () => {
- // Arrange β€” beforeEach already mocks an empty profile list.
- renderModal(dailyAutomation);
-
- // Assert β€” once the (empty) profile list resolves, no picker is offered.
- await waitFor(() => {
- expect(screen.queryByLabelText("LLM profile")).not.toBeInTheDocument();
- });
- });
-
- it("pre-fills the timeout and sends the new value when it changes", async () => {
- // Arrange β€” automation currently times out after 600s.
- vi.mocked(AutomationService.updateAutomation).mockResolvedValue({
- ...timeoutAutomation,
- timeout: 900,
- });
- const user = userEvent.setup();
- renderModal(timeoutAutomation);
-
- // Sanity-check pre-fill before editing.
- const timeoutInput = screen.getByTestId(
- "edit-automation-timeout",
- ) as HTMLInputElement;
- expect(timeoutInput.value).toBe("600");
-
- // Act β€” raise the timeout to the deployment's 900-second maximum and save.
- await user.clear(timeoutInput);
- await user.type(timeoutInput, "900");
- await user.click(screen.getByTestId("edit-automation-save"));
-
- // Assert β€” the PATCH carries just the new timeout.
- await waitFor(() => {
- expect(AutomationService.updateAutomation).toHaveBeenCalledTimes(1);
- });
- expect(AutomationService.updateAutomation).toHaveBeenCalledWith("auto-4", {
- timeout: 900,
- });
- });
-
- it("sends timeout: null when the timeout field is cleared", async () => {
- // Arrange β€” automation has an explicit 600s timeout.
- vi.mocked(AutomationService.updateAutomation).mockResolvedValue({
- ...timeoutAutomation,
- timeout: null,
- });
- const user = userEvent.setup();
- renderModal(timeoutAutomation);
-
- // Act β€” clear the field to fall back to the server default, then save.
- await user.clear(screen.getByTestId("edit-automation-timeout"));
- await user.click(screen.getByTestId("edit-automation-save"));
-
- // Assert β€” the PATCH resets the stored timeout to null.
- await waitFor(() => {
- expect(AutomationService.updateAutomation).toHaveBeenCalledTimes(1);
- });
- expect(AutomationService.updateAutomation).toHaveBeenCalledWith("auto-4", {
- timeout: null,
- });
- });
-
- it("blocks submit and shows a validation error for an out-of-range timeout", async () => {
- // Arrange
- const user = userEvent.setup();
- renderModal(timeoutAutomation);
- await waitFor(() => {
- expect(screen.getByTestId("edit-automation-timeout")).toHaveAttribute(
- "max",
- "900",
- );
- });
-
- // Act β€” enter a timeout beyond the deployment's cap and try to save.
- const timeoutInput = screen.getByTestId("edit-automation-timeout");
- await user.clear(timeoutInput);
- await user.type(timeoutInput, "901");
- await user.click(screen.getByTestId("edit-automation-save"));
-
- // Assert β€” no PATCH fired, inline error appears.
- expect(AutomationService.updateAutomation).not.toHaveBeenCalled();
- expect(
- screen.getByTestId("edit-automation-timeout-error"),
- ).toBeInTheDocument();
- });
-
- it("never lets the manifest raise the deployment timeout ceiling", async () => {
- // Arrange β€” the manifest offers 1200 seconds while the service owns 900.
- specOverrides.current = { timeout: { max: 1200 } };
- renderModal(timeoutAutomation);
-
- // Assert β€” the service value is the effective maximum.
- await waitFor(() => {
- expect(screen.getByTestId("edit-automation-timeout")).toHaveAttribute(
- "max",
- "900",
- );
- });
- });
-
- it("lets the manifest lower the deployment timeout ceiling", async () => {
- // Arrange β€” this automation surface imposes a stricter product policy.
- specOverrides.current = { timeout: { max: 600 } };
- renderModal(timeoutAutomation);
-
- // Assert β€” the lower manifest value wins over the service maximum.
- await waitFor(() => {
- expect(screen.getByTestId("edit-automation-timeout")).toHaveAttribute(
- "max",
- "600",
- );
- });
- });
-
- it("renders only the attributes the interface manifest declares, with its copy", async () => {
- // Arrange β€” an admitted manifest that omits `prompt` and relabels `name`.
- specOverrides.current = {
- prompt: { present: false },
- name: { label: "Widget name" },
- };
- renderModal(dailyAutomation);
-
- // Assert β€” the prompt control is gone and the manifest's label shows in
- // place of the host translation.
- expect(
- screen.queryByTestId("edit-automation-prompt"),
- ).not.toBeInTheDocument();
- expect(screen.getByText("Widget name")).toBeInTheDocument();
- });
-
- it("omits the timeout from the payload when it is left unchanged", async () => {
- // Arrange
- vi.mocked(AutomationService.updateAutomation).mockResolvedValue(
- timeoutAutomation,
- );
- const user = userEvent.setup();
- renderModal(timeoutAutomation);
-
- // Act β€” rename the automation but leave the timeout at 600.
- const nameInput = screen.getByTestId("edit-automation-name");
- await user.clear(nameInput);
- await user.type(nameInput, "Renamed digest");
- await user.click(screen.getByTestId("edit-automation-save"));
-
- // Assert β€” the PATCH renames but does not resend the unchanged timeout.
- await waitFor(() => {
- expect(AutomationService.updateAutomation).toHaveBeenCalledTimes(1);
- });
- const [, body] = vi.mocked(AutomationService.updateAutomation).mock
- .calls[0];
- expect(body).toMatchObject({ name: "Renamed digest" });
- expect(body).not.toHaveProperty("timeout");
- });
-
- it("stores an optional agent profile instead of a competing model", async () => {
- vi.mocked(AutomationService.getCapabilities).mockResolvedValue({
- ready: true,
- triggerKinds: ["cron"],
- eventSources: [],
- eventTypes: [],
- triggers: {},
- features: ["agentProfiles"],
- });
- vi.mocked(ProfilesService.listProfiles).mockResolvedValue(profilesResponse);
- vi.mocked(AutomationService.updateAutomation).mockResolvedValue({
- ...modeledAutomation,
- agent_profile_id: "review-profile",
- model: null,
- });
- const user = userEvent.setup();
- renderModal(modeledAutomation);
-
- await user.click(await screen.findByTestId("automation-agent-profile"));
- await user.click(await screen.findByRole("option", { name: "Reviewer" }));
- await user.click(screen.getByTestId("edit-automation-save"));
-
- await waitFor(() =>
- expect(AutomationService.updateAutomation).toHaveBeenCalledTimes(1),
- );
- expect(
- vi.mocked(AutomationService.updateAutomation).mock.calls[0][1],
- ).toMatchObject({
- agent_profile_id: "review-profile",
- model: null,
- });
- });
-});
diff --git a/__tests__/components/chat/message-display-continuity.test.tsx b/__tests__/components/chat/message-display-continuity.test.tsx
index 9844e725d2..4e7594655a 100644
--- a/__tests__/components/chat/message-display-continuity.test.tsx
+++ b/__tests__/components/chat/message-display-continuity.test.tsx
@@ -70,13 +70,6 @@ vi.mock("#/components/shared/buttons/scroll-to-bottom-button", () => ({
ScrollToBottomButton: () => <button type="button">Scroll to bottom</button>,
}));
-vi.mock("#/components/conversation-events/chat", async (importOriginal) => ({
- ...(await importOriginal<
- typeof import("#/components/conversation-events/chat")
- >()),
- Messages: () => <div data-testid="conversation-messages" />,
-}));
-
// Helper to render with QueryClient and route params
const renderWithQueryClient = (
ui: React.ReactElement,
@@ -167,10 +160,7 @@ describe("ChatInterface – message display continuity (spec 3.1)", () => {
expect(
screen.queryByTestId("chat-messages-skeleton"),
).not.toBeInTheDocument();
- expect(
- screen.queryByTestId("conversation-messages") ??
- screen.queryByTestId("user-message"),
- ).not.toBeNull();
+ expect(screen.getByTestId("user-message")).toBeInTheDocument();
});
it("shows skeleton when store is empty and loading", () => {
@@ -253,10 +243,7 @@ describe("ChatInterface – message display continuity (spec 3.1)", () => {
expect(
screen.queryByTestId("chat-messages-skeleton"),
).not.toBeInTheDocument();
- expect(
- screen.queryByTestId("conversation-messages") ??
- screen.queryByTestId("user-message"),
- ).not.toBeNull();
+ expect(screen.getByTestId("user-message")).toBeInTheDocument();
});
});
});
diff --git a/__tests__/components/conversation-events/get-event-content.test.tsx b/__tests__/components/conversation-events/get-event-content.test.tsx
index d786a49bfa..44f5491e91 100644
--- a/__tests__/components/conversation-events/get-event-content.test.tsx
+++ b/__tests__/components/conversation-events/get-event-content.test.tsx
@@ -8,7 +8,7 @@ import {
LAUNCH_CHILD_CONVERSATION_ACTION_KIND,
LAUNCH_CHILD_CONVERSATION_TOOL_NAME,
} from "#/constants/child-conversation";
-import { getEventContent } from "#/components/conversation-events/chat";
+import { getEventContent } from "#/components/conversation-events/chat/event-content-helpers/get-event-content";
import {
ActionEvent,
ObservationEvent,
diff --git a/__tests__/components/features/chat/utils/chat-input.utils.test.ts b/__tests__/components/features/chat/utils/chat-input.utils.test.ts
index 22d646690a..3b136d6d3d 100644
--- a/__tests__/components/features/chat/utils/chat-input.utils.test.ts
+++ b/__tests__/components/features/chat/utils/chat-input.utils.test.ts
@@ -9,7 +9,6 @@ import {
getTextContent,
insertTextAtCaret,
isContentEmpty,
- isPastedClipboardImage,
normalizePastedFile,
partitionImagesForUpload,
} from "#/components/features/chat/utils/chat-input.utils";
@@ -82,28 +81,6 @@ describe("normalizePastedFile", () => {
});
});
-describe("isPastedClipboardImage", () => {
- it("returns true for normalized clipboard screenshot names", () => {
- const file = new File(["x"], "pasted-image-1710000000000.png", {
- type: "image/png",
- });
- expect(isPastedClipboardImage(file)).toBe(true);
- });
-
- it("returns false for images picked from the file dialog", () => {
- const file = new File(["x"], "photo.png", { type: "image/png" });
- expect(isPastedClipboardImage(file)).toBe(false);
- });
-
- it("matches normalized names case-insensitively", () => {
- expect(
- isPastedClipboardImage(
- new File(["x"], "PASTED-IMAGE-1710000000000.WEBP"),
- ),
- ).toBe(true);
- });
-});
-
describe("partitionImagesForUpload", () => {
it("splits marked images into the file-upload bucket", () => {
const embed = new File(["a"], "embed.png", { type: "image/png" });
@@ -202,12 +179,6 @@ describe("module-initialized clipboard contracts", () => {
).toBe(`pasted-image-1234.${extension}`);
}
- const named = (name: string) =>
- fresh.isPastedClipboardImage(new File(["x"], name));
- expect(named("pasted-image-1710000000000.png")).toBe(true);
- expect(named("prefix-pasted-image-1710000000000.png")).toBe(false);
- expect(named("pasted-image-1710000000000.png.extra")).toBe(false);
-
const editable = document.createElement("div");
editable.innerText = "message";
expect(fresh.getTextContent(editable)).toBe("message");
diff --git a/__tests__/components/features/command-menu/command-menu.test.tsx b/__tests__/components/features/command-menu/command-menu.test.tsx
index e7a7a8dec6..c3b555e654 100644
--- a/__tests__/components/features/command-menu/command-menu.test.tsx
+++ b/__tests__/components/features/command-menu/command-menu.test.tsx
@@ -8,10 +8,8 @@ import {
import userEvent from "@testing-library/user-event";
import { renderToStaticMarkup } from "react-dom/server";
import { describe, it, expect, beforeEach, afterEach, vi } from "vitest";
-import {
- CommandMenu,
- CommandMenuTrigger,
-} from "#/components/features/command-menu";
+import { CommandMenu } from "#/components/features/command-menu/command-menu";
+import { CommandMenuTrigger } from "#/components/features/command-menu/command-menu-trigger";
import { COMMAND_MENU_ROUTE } from "#/components/features/command-menu/command-menu-items";
import { getInterfaceCopy } from "#/manifests/automation-interface";
import {
diff --git a/__tests__/helpers/README.md b/__tests__/helpers/README.md
deleted file mode 100644
index c28a8bb8ec..0000000000
--- a/__tests__/helpers/README.md
+++ /dev/null
@@ -1,46 +0,0 @@
-# Test Helpers
-
-This directory contains reusable test utilities and components for the OpenHands frontend test suite.
-
-## Files
-
-### `websocket-test-components.tsx`
-Contains React test components for accessing and displaying WebSocket-related store values:
-- `ConnectionStatusComponent` - Displays WebSocket connection state
-- `EventStoreComponent` - Displays event store values (events count, UI events count, latest event ID)
-- `OptimisticUserMessageStoreComponent` - Displays optimistic user message store values
-- `ErrorMessageStoreComponent` - Displays error message store values
-
-These components are designed to be used in tests to verify that WebSocket events are properly processed and stored.
-
-
-
-### `msw-websocket-setup.ts`
-Contains MSW (Mock Service Worker) setup utilities for WebSocket testing:
-- `createWebSocketLink()` - Creates a WebSocket link for MSW testing
-- `createWebSocketMockServer()` - Creates and configures an MSW server for WebSocket testing
-- `createWebSocketTestSetup()` - Creates a complete WebSocket testing setup
-- `conversationWebSocketTestSetup()` - Standard setup for conversation WebSocket handler tests
-
-## Usage
-
-```typescript
-import {
- ConnectionStatusComponent,
- EventStoreComponent,
-} from "./__tests__/helpers/websocket-test-components";
-import { conversationWebSocketTestSetup } from "./__tests__/helpers/msw-websocket-setup";
-
-// Set up MSW server
-const { wsLink, server } = conversationWebSocketTestSetup();
-
-// Render components with WebSocket context (helper function defined in test file)
-renderWithWebSocketContext(<ConnectionStatusComponent />);
-```
-
-## Benefits
-
-- **Reusability**: Test components and utilities can be shared across multiple test files
-- **Maintainability**: Changes to test setup only need to be made in one place
-- **Consistency**: Ensures consistent test setup across different WebSocket-related tests
-- **Readability**: Test files are cleaner and focus on test logic rather than setup boilerplate
diff --git a/__tests__/helpers/msw-websocket-setup.ts b/__tests__/helpers/msw-websocket-setup.ts
deleted file mode 100644
index 25d533e1bb..0000000000
--- a/__tests__/helpers/msw-websocket-setup.ts
+++ /dev/null
@@ -1,44 +0,0 @@
-import { ws } from "msw";
-import { setupServer } from "msw/node";
-
-/**
- * Creates a WebSocket link for MSW testing
- * @param url - WebSocket URL to mock (default: "ws://localhost/events/socket")
- * @returns MSW WebSocket link
- */
-export const createWebSocketLink = (url = "ws://localhost/events/socket") =>
- ws.link(url);
-
-/**
- * Creates and configures an MSW server for WebSocket testing
- * @param wsLink - WebSocket link to use for the server
- * @returns Configured MSW server
- */
-export const createWebSocketMockServer = (wsLink: ReturnType<typeof ws.link>) =>
- setupServer(
- wsLink.addEventListener("connection", ({ server }) => {
- server.connect();
- }),
- );
-
-/**
- * Creates a complete WebSocket testing setup with server and link
- * @param url - WebSocket URL to mock (default: "ws://localhost/events/socket")
- * @returns Object containing the WebSocket link and configured server
- */
-export const createWebSocketTestSetup = (
- url = "ws://localhost/events/socket",
-) => {
- const wsLink = createWebSocketLink(url);
- const server = createWebSocketMockServer(wsLink);
-
- return { wsLink, server };
-};
-
-/**
- * Standard WebSocket test setup for conversation WebSocket handler tests
- * Updated to use the V1 WebSocket URL pattern: /sockets/session/{conversationId}
- * Uses a wildcard pattern to match any conversation ID
- */
-export const conversationWebSocketTestSetup = () =>
- createWebSocketTestSetup("ws://localhost:3000/sockets/session/*");
diff --git a/__tests__/helpers/websocket-test-components.tsx b/__tests__/helpers/websocket-test-components.tsx
deleted file mode 100644
index b728a6bde3..0000000000
--- a/__tests__/helpers/websocket-test-components.tsx
+++ /dev/null
@@ -1,73 +0,0 @@
-import React from "react";
-import { useConversationWebSocket } from "#/contexts/conversation-websocket-context";
-import { useEventStore } from "#/stores/use-event-store";
-import { useErrorMessageStore } from "#/stores/error-message-store";
-import { useOptimisticUserMessageStore } from "#/stores/optimistic-user-message-store";
-import { isAgentServerEvent } from "#/types/agent-server/type-guards";
-import { OpenHandsEvent } from "#/types/agent-server/core";
-
-/**
- * Test component to access and display WebSocket connection state
- */
-export function ConnectionStatusComponent() {
- const context = useConversationWebSocket();
-
- return (
- <div>
- <div data-testid="connection-state">
- {context?.connectionState || "NOT_AVAILABLE"}
- </div>
- </div>
- );
-}
-
-/**
- * Test component to access and display event store values
- */
-export function EventStoreComponent() {
- const { events, uiEvents } = useEventStore();
- return (
- <div>
- <div data-testid="events-count">{events.length}</div>
- <div data-testid="ui-events-count">{uiEvents.length}</div>
- <div data-testid="latest-event-id">
- {isAgentServerEvent(events[events.length - 1])
- ? (events[events.length - 1] as OpenHandsEvent).id
- : "none"}
- </div>
- </div>
- );
-}
-
-/**
- * Test component to access and display the queue of pending user messages
- * tracked locally until the WebSocket echoes them back.
- */
-export function OptimisticUserMessageStoreComponent() {
- const { pendingMessages } = useOptimisticUserMessageStore();
- return (
- <div>
- <div data-testid="optimistic-user-message">
- {pendingMessages[0]?.text || "none"}
- </div>
- <div data-testid="optimistic-user-message-count">
- {pendingMessages.length}
- </div>
- <div data-testid="optimistic-user-message-statuses">
- {pendingMessages.map((m) => m.status).join(",") || "none"}
- </div>
- </div>
- );
-}
-
-/**
- * Test component to access and display error message store values
- */
-export function ErrorMessageStoreComponent() {
- const { errorMessage } = useErrorMessageStore();
- return (
- <div>
- <div data-testid="error-message">{errorMessage || "none"}</div>
- </div>
- );
-}
diff --git a/__tests__/hooks/chat/use-chat-input-events.test.tsx b/__tests__/hooks/chat/use-chat-input-events.test.tsx
index 1dbe805b48..3f4506e1d5 100644
--- a/__tests__/hooks/chat/use-chat-input-events.test.tsx
+++ b/__tests__/hooks/chat/use-chat-input-events.test.tsx
@@ -67,7 +67,6 @@ const renderInputEvents = ({
smartResize,
increaseHeight,
isEmpty,
- vi.fn(),
onFocus,
onBlur,
),
@@ -282,16 +281,9 @@ describe("chat input callback freshness", () => {
const latestResize = vi.fn();
const increaseHeight = vi.fn();
const isEmpty = vi.fn(() => false);
- const clearHandler = vi.fn();
const { result, rerender } = renderHook(
({ inputRef, resize }) =>
- useChatInputEvents(
- inputRef,
- resize,
- increaseHeight,
- isEmpty,
- clearHandler,
- ),
+ useChatInputEvents(inputRef, resize, increaseHeight, isEmpty),
{
initialProps: { inputRef: first.ref, resize: firstResize },
},
@@ -312,20 +304,13 @@ describe("chat input callback freshness", () => {
it("uses the latest empty-content callbacks after rerender", () => {
const inputRef: RefObject<HTMLDivElement | null> = { current: null };
const smartResize = vi.fn();
- const clearHandler = vi.fn();
const firstCheck = vi.fn(() => false);
const latestCheck = vi.fn(() => true);
const firstIncrease = vi.fn();
const latestIncrease = vi.fn();
const { result, rerender } = renderHook(
({ check, increase }) =>
- useChatInputEvents(
- inputRef,
- smartResize,
- increase,
- check,
- clearHandler,
- ),
+ useChatInputEvents(inputRef, smartResize, increase, check),
{
initialProps: { check: firstCheck, increase: firstIncrease },
},
@@ -353,7 +338,6 @@ describe("chat input callback freshness", () => {
const smartResize = vi.fn();
const increaseHeight = vi.fn();
const isEmpty = vi.fn(() => false);
- const clearHandler = vi.fn();
const { result, rerender } = renderHook(
({ inputRef, focus, blur }) =>
useChatInputEvents(
@@ -361,7 +345,6 @@ describe("chat input callback freshness", () => {
smartResize,
increaseHeight,
isEmpty,
- clearHandler,
focus,
blur,
),
diff --git a/__tests__/hooks/query/use-automations-backend-switch.test.tsx b/__tests__/hooks/query/use-automations-backend-switch.test.tsx
index b2f0597518..e183965716 100644
--- a/__tests__/hooks/query/use-automations-backend-switch.test.tsx
+++ b/__tests__/hooks/query/use-automations-backend-switch.test.tsx
@@ -19,7 +19,6 @@ import {
useDeleteAutomation,
useImportAutomation,
useToggleAutomation,
- useUpdateAutomation,
} from "#/hooks/query/use-automations";
import {
useAutomationDetail,
@@ -47,7 +46,6 @@ vi.mock("#/api/automation-service/automation-service.api", () => ({
cancelAutomationRun: vi.fn(),
createAutomation: vi.fn(),
deleteAutomation: vi.fn(),
- updateAutomation: vi.fn(),
toggleAutomation: vi.fn(),
listServerDrafts: vi.fn(),
getCapabilities: vi.fn(),
@@ -156,10 +154,8 @@ beforeEach(() => {
automationRun,
);
vi.mocked(AutomationService.deleteAutomation).mockReset();
- vi.mocked(AutomationService.updateAutomation).mockReset();
vi.mocked(AutomationService.toggleAutomation).mockReset();
vi.mocked(AutomationService.deleteAutomation).mockResolvedValue(undefined);
- vi.mocked(AutomationService.updateAutomation).mockResolvedValue(automation);
vi.mocked(AutomationService.toggleAutomation).mockResolvedValue(automation);
vi.mocked(AutomationService.getAutomations).mockResolvedValue(listResponse);
@@ -175,7 +171,6 @@ afterEach(() => {
});
describe("useAutomationDrafts β€” draft endpoint unavailability", () => {
-
it("does not call the drafts endpoint when capabilities do not advertise drafts", async () => {
vi.mocked(AutomationService.getCapabilities).mockResolvedValue({
ready: true,
@@ -482,26 +477,6 @@ describe("automation mutation hooks β€” analytics tracking", () => {
});
});
- it("captures automation_edited after a successful update", async () => {
- const { result } = renderHook(() => useUpdateAutomation(), {
- wrapper: makeWrapper(),
- });
-
- await act(async () => {
- await result.current.mutateAsync({
- id: "auto-1",
- body: { name: "Renamed" },
- });
- });
-
- await waitFor(() => {
- expect(captureMock).toHaveBeenCalledWith(
- "automation_edited",
- expect.objectContaining({ backend_kind: "local" }),
- );
- });
- });
-
it("captures automation_disable_button when an automation is disabled", async () => {
const { result } = renderHook(() => useToggleAutomation(), {
wrapper: makeWrapper(),
@@ -572,7 +547,6 @@ describe("automation mutation hooks β€” error toasts", () => {
.mockImplementation(() => "toast-id");
vi.mocked(AutomationService.dispatchAutomation).mockRejectedValue(notFound);
vi.mocked(AutomationService.createAutomation).mockRejectedValue(notFound);
- vi.mocked(AutomationService.updateAutomation).mockRejectedValue(notFound);
vi.mocked(AutomationService.cancelAutomationRun).mockRejectedValue(
notFound,
);
@@ -615,20 +589,6 @@ describe("automation mutation hooks β€” error toasts", () => {
);
},
},
- {
- action: "Edit save",
- run: () => {
- const { result } = renderHook(() => useUpdateAutomation(), {
- wrapper: makeAppClientWrapper(),
- });
- act(() =>
- result.current.mutate(
- { id: "auto-1", body: { name: "Renamed" } },
- { onError: toastApiMessage },
- ),
- );
- },
- },
{
action: "Cancel run",
run: () => {
diff --git a/__tests__/hooks/query/use-has-git-commits.test.tsx b/__tests__/hooks/query/use-has-git-commits.test.tsx
deleted file mode 100644
index 9659968926..0000000000
--- a/__tests__/hooks/query/use-has-git-commits.test.tsx
+++ /dev/null
@@ -1,118 +0,0 @@
-import React from "react";
-import { renderHook, waitFor } from "@testing-library/react";
-import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
-import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
-
-import AgentServerRuntimeService from "#/api/runtime-service/agent-server-runtime-service";
-import { useHasGitCommits } from "#/hooks/query/use-has-git-commits";
-
-const useActiveBackendMock = vi.fn();
-vi.mock("#/contexts/active-backend-context", () => ({
- useActiveBackend: () => useActiveBackendMock(),
-}));
-
-const useActiveConversationMock = vi.fn();
-vi.mock("#/hooks/query/use-active-conversation", () => ({
- useActiveConversation: () => useActiveConversationMock(),
-}));
-
-const useRuntimeIsReadyMock = vi.fn();
-vi.mock("#/hooks/use-runtime-is-ready", () => ({
- useRuntimeIsReady: () => useRuntimeIsReadyMock(),
-}));
-
-const executeCommandSpy = vi.spyOn(AgentServerRuntimeService, "executeCommand");
-
-function makeWrapper() {
- const client = new QueryClient({
- defaultOptions: { queries: { retry: false } },
- });
- return function HasGitCommitsTestWrapper({
- children,
- }: {
- children: React.ReactNode;
- }) {
- return (
- <QueryClientProvider client={client}>{children}</QueryClientProvider>
- );
- };
-}
-
-const makeBackend = (kind: "local" | "cloud") => ({
- backend: {
- id: "backend-id",
- name: kind === "local" ? "Local" : "Production",
- host:
- kind === "local" ? "http://127.0.0.1:8000" : "https://app.all-hands.dev",
- apiKey: "test-key",
- kind,
- },
- orgId: null,
-});
-
-const conversation = {
- id: "conv-1",
- conversation_url: "https://runtime.example.com/api/conversations/conv-1",
- session_api_key: "session-key",
- workspace: { working_dir: "/workspace/project" },
-};
-
-describe("useHasGitCommits", () => {
- beforeEach(() => {
- useActiveBackendMock.mockReset();
- useActiveConversationMock.mockReset();
- useRuntimeIsReadyMock.mockReset();
- executeCommandSpy.mockReset();
-
- useRuntimeIsReadyMock.mockReturnValue(true);
- useActiveConversationMock.mockReturnValue({ data: conversation });
- });
-
- afterEach(() => {
- vi.clearAllMocks();
- });
-
- it("does not call executeCommand on a cloud backend", async () => {
- // Arrange
- useActiveBackendMock.mockReturnValue(makeBackend("cloud"));
-
- // Act
- const { result } = renderHook(() => useHasGitCommits(), {
- wrapper: makeWrapper(),
- });
-
- // Assert: probe stays disabled; hasCommits remains null.
- await new Promise((resolve) => {
- setTimeout(resolve, 20);
- });
- expect(executeCommandSpy).not.toHaveBeenCalled();
- expect(result.current.hasCommits).toBeNull();
- });
-
- it("probes HEAD via executeCommand on a local backend and returns true when the repo has commits", async () => {
- // Arrange
- useActiveBackendMock.mockReturnValue(makeBackend("local"));
- executeCommandSpy.mockResolvedValue({
- exit_code: 0,
- stdout: "abcdef0\n",
- stderr: "",
- });
-
- // Act
- const { result } = renderHook(() => useHasGitCommits(), {
- wrapper: makeWrapper(),
- });
-
- // Assert
- await waitFor(() => expect(result.current.isLoading).toBe(false));
- expect(executeCommandSpy).toHaveBeenCalledWith(
- conversation.conversation_url,
- conversation.session_api_key,
- "git rev-parse --verify HEAD",
- "/workspace/project",
- 10,
- conversation.id,
- );
- expect(result.current.hasCommits).toBe(true);
- });
-});
diff --git a/__tests__/hooks/use-has-attached-source.test.ts b/__tests__/hooks/use-has-attached-source.test.ts
deleted file mode 100644
index d4033a50b1..0000000000
--- a/__tests__/hooks/use-has-attached-source.test.ts
+++ /dev/null
@@ -1,78 +0,0 @@
-import { describe, expect, it, vi, beforeEach, afterEach } from "vitest";
-import { renderHook } from "@testing-library/react";
-
-import { useHasAttachedSource } from "#/hooks/use-has-attached-source";
-import { setStoredConversationMetadata } from "#/api/conversation-metadata-store";
-
-const useActiveConversationMock = vi.fn();
-
-vi.mock("#/hooks/query/use-active-conversation", () => ({
- useActiveConversation: () => useActiveConversationMock(),
-}));
-
-describe("useHasAttachedSource", () => {
- beforeEach(() => {
- window.localStorage.clear();
- useActiveConversationMock.mockReset();
- });
-
- afterEach(() => {
- window.localStorage.clear();
- });
-
- it("returns true when the conversation has a selected_repository", () => {
- useActiveConversationMock.mockReturnValue({
- data: {
- id: "conv-1",
- selected_repository: "octocat/hello-world",
- },
- isLoading: false,
- });
-
- const { result } = renderHook(() => useHasAttachedSource());
-
- expect(result.current.hasAttachedSource).toBe(true);
- expect(result.current.isLoading).toBe(false);
- });
-
- it("returns true when the conversation has a stored selected_workspace (no repo)", () => {
- setStoredConversationMetadata("conv-2", {
- selected_repository: null,
- selected_branch: null,
- git_provider: null,
- selected_workspace: "/home/me/code/foo",
- });
-
- useActiveConversationMock.mockReturnValue({
- data: { id: "conv-2", selected_repository: null },
- isLoading: false,
- });
-
- const { result } = renderHook(() => useHasAttachedSource());
-
- expect(result.current.hasAttachedSource).toBe(true);
- });
-
- it("returns false when neither a repo nor a workspace is attached", () => {
- useActiveConversationMock.mockReturnValue({
- data: { id: "conv-3", selected_repository: null },
- isLoading: false,
- });
-
- const { result } = renderHook(() => useHasAttachedSource());
-
- expect(result.current.hasAttachedSource).toBe(false);
- });
-
- it("propagates the active-conversation isLoading flag", () => {
- useActiveConversationMock.mockReturnValue({
- data: undefined,
- isLoading: true,
- });
-
- const { result } = renderHook(() => useHasAttachedSource());
-
- expect(result.current.hasAttachedSource).toBe(false);
- expect(result.current.isLoading).toBe(true);
- });
-});
diff --git a/__tests__/manifests/automation-interface.test.ts b/__tests__/manifests/automation-interface.test.ts
index ade56a4924..b09798ebda 100644
--- a/__tests__/manifests/automation-interface.test.ts
+++ b/__tests__/manifests/automation-interface.test.ts
@@ -34,7 +34,6 @@ describe("the automation interface seam", () => {
/No automation interface manifest is admitted/,
);
expect(() => seam.getAutomationEndpoint("createPrompt")).toThrow();
- expect(() => seam.getAttributeSpec("timeout")).toThrow();
expect(() => seam.getImportExportSpec()).toThrow();
expect(() => seam.getFeaturedAutomationIds()).toThrow();
expect({
@@ -75,15 +74,13 @@ describe("the automation interface seam", () => {
// Arrange
const seam = await loadSeam(createInterfaceManifest());
- // Act & Assert β€” copy, attribute specs, the import/export envelope, and
+ // Act & Assert β€” copy, the import/export envelope, and
// the id lists all come from the manifest.
expect(seam.hasAutomationInterface()).toBe(true);
expect({
listTitle: seam.getInterfaceCopy().listTitle,
sidebarLabel: seam.getInterfaceCopy().sidebarLabel,
editTitle: seam.getInterfaceCopy().editTitle,
- nameLabel: seam.getAttributeSpec("name").label,
- timeoutMax: seam.getAttributeSpec("timeout").max,
importExport: seam.getImportExportSpec(),
docsUrl: seam.getAutomationsDocsUrl(),
featured: [...seam.getFeaturedAutomationIds()],
@@ -92,8 +89,6 @@ describe("the automation interface seam", () => {
listTitle: "Widget automations",
sidebarLabel: "Automate everything",
editTitle: "Edit the widget automation",
- nameLabel: "Widget name",
- timeoutMax: 900,
importExport: {
fileKind: "widget",
fileVersion: 1,
@@ -109,17 +104,6 @@ describe("the automation interface seam", () => {
});
});
- it("hides an attribute the admitted manifest does not declare", async () => {
- // Arrange β€” the factory manifest declares only `name` and `timeout`.
- const seam = await loadSeam(createInterfaceManifest());
-
- // Act
- const spec = seam.getAttributeSpec("prompt");
-
- // Assert
- expect(spec.present).toBe(false);
- });
-
it("leaves the sub-page surface absent when the manifest declares none", async () => {
// Arrange β€” an admitted manifest without the sub-page group. The host has
// no defaults for this surface, so nothing stands in.
diff --git a/__tests__/routes/automations-list-behavior.test.tsx b/__tests__/routes/automations-list-behavior.test.tsx
index b765c53215..dad59dae94 100644
--- a/__tests__/routes/automations-list-behavior.test.tsx
+++ b/__tests__/routes/automations-list-behavior.test.tsx
@@ -319,29 +319,6 @@ vi.mock("#/components/features/automations/delete-confirmation-modal", () => ({
) : null,
}));
-vi.mock(
- "#/components/features/automations/detail/edit-automation-modal",
- () => ({
- EditAutomationModal: ({
- automation,
- isOpen,
- onClose,
- }: {
- automation: Automation;
- isOpen: boolean;
- onClose: () => void;
- }) =>
- isOpen ? (
- <div data-testid="edit-modal">
- <span>{automation.name}</span>
- <button type="button" onClick={onClose}>
- close-edit
- </button>
- </div>
- ) : null,
- }),
-);
-
vi.mock("#/components/features/automations/import-automation-modal", () => ({
ImportAutomationModal: ({
isOpen,
@@ -743,7 +720,6 @@ describe("automations list interactions", () => {
automationName: "missing-id",
});
expect(screen.queryByTestId("delete-modal")).not.toBeInTheDocument();
- expect(screen.queryByTestId("edit-modal")).not.toBeInTheDocument();
});
it("reports pending dispatches and confirms a successful run", async () => {
@@ -886,7 +862,6 @@ describe("automations list interactions", () => {
expect(mocks.navigate).toHaveBeenCalledWith(
"/automations/setup?automationId=automation-1",
);
- expect(screen.queryByTestId("edit-modal")).not.toBeInTheDocument();
});
it("offers editing regardless of the backend kind", () => {
diff --git a/__tests__/services/telemetry.test.ts b/__tests__/services/telemetry.test.ts
index 7db2229f39..cbed239e30 100644
--- a/__tests__/services/telemetry.test.ts
+++ b/__tests__/services/telemetry.test.ts
@@ -9,7 +9,6 @@ let latestPostHogConfig:
const mockPosthog = {
init: vi.fn(),
capture: vi.fn(),
- captureException: vi.fn(),
opt_in_capturing: vi.fn(),
opt_out_capturing: vi.fn(),
has_opted_out_capturing: vi.fn(() => false),
@@ -55,7 +54,6 @@ import {
setTelemetryIdentity,
subscribeTelemetryConsent,
trackEvent,
- trackException,
trackInstall,
trackSessionStart,
} from "#/services/telemetry";
@@ -623,19 +621,6 @@ describe("Telemetry Service", () => {
});
});
- describe("trackException", () => {
- it("uses the consent-aware boundary", async () => {
- await setTelemetryConsent("granted");
- const error = new Error("failure");
-
- await trackException(error, { error_source: "test" });
-
- expect(mockPosthog.captureException).toHaveBeenCalledWith(error, {
- error_source: "test",
- });
- });
- });
-
describe("clearTelemetryData", () => {
it("clears all telemetry data from browser storage", async () => {
await setTelemetryConsent("granted");
diff --git a/__tests__/utils/automation-schedule.test.ts b/__tests__/utils/automation-schedule.test.ts
index b2a4084959..1a4a3acaa2 100644
--- a/__tests__/utils/automation-schedule.test.ts
+++ b/__tests__/utils/automation-schedule.test.ts
@@ -1,11 +1,5 @@
import { describe, it, expect } from "vitest";
-import { I18nKey } from "#/i18n/declaration";
-import {
- buildCronSchedule,
- validateCronSchedule,
- parseCronSchedule,
- parseTimeOfDay,
-} from "#/utils/automation-schedule";
+import { parseCronSchedule } from "#/utils/automation-schedule";
describe("automation-schedule", () => {
describe("parseCronSchedule", () => {
@@ -46,136 +40,4 @@ describe("automation-schedule", () => {
expect(results.every((r) => r.kind === "custom")).toBe(true);
});
});
-
- describe("buildCronSchedule", () => {
- it("emits canonical cron strings for each preset kind", () => {
- // Act
- const daily = buildCronSchedule({ kind: "daily", hour: 9, minute: 0 });
- const weekdays = buildCronSchedule({
- kind: "weekdays",
- hour: 8,
- minute: 30,
- });
- const weekly = buildCronSchedule({
- kind: "weekly",
- hour: 14,
- minute: 0,
- weekday: 3,
- });
-
- // Assert
- expect(daily).toBe("0 9 * * *");
- expect(weekdays).toBe("30 8 * * 1-5");
- expect(weekly).toBe("0 14 * * 3");
- });
- });
-
- describe("validateCronSchedule", () => {
- it("accepts, and trims, expressions the preset parser reports as custom", () => {
- // Arrange β€” none of these map onto Daily/Weekdays/Weekly, so the
- // edit modal relies on this check rather than parseCronSchedule.
- const valid = ["*/10 * * * *", "0 9,17 * * *", "0 0 1-15 * 1-5"];
-
- // Assert
- expect(valid.map((c) => validateCronSchedule(c))).toEqual(
- valid.map((schedule) => ({ schedule })),
- );
- expect(valid.every((c) => parseCronSchedule(c).kind === "custom")).toBe(
- true,
- );
- expect(validateCronSchedule(" */10 * * * * ")).toEqual({
- schedule: "*/10 * * * *",
- });
- });
-
- it("accepts the expressions the automation service accepts", () => {
- // Arrange β€” verified against croniter 6.2.2.
- const serviceAccepts = [
- "0 0 * * 7",
- "0 0 * * SUN",
- "0 0 * JAN *",
- "0 0 * * MON-FRI",
- "0 0 L * *",
- "0 0 15W * *",
- "0 0 * * 5#3",
- "0 0 ? * MON",
- "5-1 * * * *", // a reversed range wraps
- "*/90 * * * *", // the step is unbounded
- "* * * * * *", // seconds
- "* * * * * * *", // seconds and year
- "@daily",
- "0 0 29 2 *", // leap years only, but it does fire
- "0 0 31 1,2 *", // January has a 31st
- ];
-
- // Assert
- expect(serviceAccepts.map((c) => validateCronSchedule(c))).toEqual(
- serviceAccepts.map((schedule) => ({ schedule })),
- );
- });
-
- it("rejects wrong field counts, out-of-range values and free text", () => {
- // Arrange
- const invalid = [
- "* * * *",
- "* * * * * * * *",
- "60 * * * *",
- "* * * * 9",
- "every ten minutes please now",
- "@bogus",
- "",
- ];
-
- // Assert β€” one shared key, so the form shows the same guidance.
- expect(invalid.map((c) => validateCronSchedule(c))).toEqual(
- invalid.map(() => ({
- errorKey: I18nKey.AUTOMATIONS$ERROR_CRON_INVALID,
- })),
- );
- });
-
- it("rejects a well-formed schedule that can never fire", () => {
- // Arrange β€” croniter parses these, then finds no fire time.
- const unreachable = [
- "0 0 31 2 *",
- "0 0 30 2 *",
- "0 0 31 4 *",
- "0 0 31 2,4 *",
- "0 0 31 2 MON",
- ];
-
- // Assert β€” well-formed, not malformed, so a distinct key.
- expect(unreachable.map((c) => validateCronSchedule(c))).toEqual(
- unreachable.map(() => ({
- errorKey: I18nKey.AUTOMATIONS$ERROR_CRON_UNREACHABLE,
- })),
- );
- });
- });
-
- it("accepts single-start stepped fields, matching croniter's n/m expansion", () => {
- // Arrange β€” croniter expands `2/2` in the month field to 2,4,6,8,10,12,
- // so the 31st fires in August/October/December: reachable.
- const stepped = "0 0 31 2/2 *";
-
- // Act
- const result = validateCronSchedule(stepped);
-
- // Assert
- expect(result).toEqual({ schedule: stepped });
- });
-
- describe("parseTimeOfDay", () => {
- it("parses HH:MM and rejects out-of-range or malformed values", () => {
- // Act
- const valid = parseTimeOfDay("09:30");
- const invalidHour = parseTimeOfDay("24:00");
- const malformed = parseTimeOfDay("9-30");
-
- // Assert
- expect(valid).toEqual({ hour: 9, minute: 30 });
- expect(invalidHour).toBeNull();
- expect(malformed).toBeNull();
- });
- });
});
diff --git a/__tests__/utils/automation-timeout.test.ts b/__tests__/utils/automation-timeout.test.ts
deleted file mode 100644
index ada3baa7de..0000000000
--- a/__tests__/utils/automation-timeout.test.ts
+++ /dev/null
@@ -1,64 +0,0 @@
-import { describe, it, expect } from "vitest";
-import { I18nKey } from "#/i18n/declaration";
-import { validateAutomationTimeout } from "#/utils/automation-timeout";
-
-describe("validateAutomationTimeout", () => {
- it("treats a blank value as 'use the server default'", () => {
- // Arrange / Act
- const result = validateAutomationTimeout(" ");
-
- // Assert
- expect(result).toEqual({ value: null });
- });
-
- it("accepts a positive integer up to a deployment-provided maximum", () => {
- // Arrange / Act
- const result = validateAutomationTimeout("900", 900);
-
- // Assert
- expect(result).toEqual({ value: 900 });
- });
-
- it("rejects a non-integer value", () => {
- // Arrange / Act
- const result = validateAutomationTimeout("12.5");
-
- // Assert
- expect(result).toEqual({
- errorKey: I18nKey.AUTOMATIONS$ERROR_TIMEOUT_INVALID_NUMBER,
- });
- });
-
- it("rejects a non-positive value", () => {
- // Arrange / Act
- const result = validateAutomationTimeout("0");
-
- // Assert
- expect(result).toEqual({
- errorKey: I18nKey.AUTOMATIONS$ERROR_TIMEOUT_POSITIVE,
- });
- });
-
- it("rejects a value above the maximum", () => {
- // Arrange / Act
- const result = validateAutomationTimeout("901", 900);
-
- // Assert
- expect(result).toEqual({
- errorKey: I18nKey.AUTOMATIONS$ERROR_TIMEOUT_MAX_EXCEEDED,
- });
- });
-
- it("validates against a ceiling the interface manifest lowered", () => {
- // Arrange / Act β€” a manifest max of 900 moves the boundary: 900 stays
- // in range while 901, fine under the 1800 default, is now rejected.
- const atCeiling = validateAutomationTimeout("900", 900);
- const overCeiling = validateAutomationTimeout("901", 900);
-
- // Assert
- expect(atCeiling).toEqual({ value: 900 });
- expect(overCeiling).toEqual({
- errorKey: I18nKey.AUTOMATIONS$ERROR_TIMEOUT_MAX_EXCEEDED,
- });
- });
-});
diff --git a/__tests__/utils/browser-and-file-utilities.test.ts b/__tests__/utils/browser-and-file-utilities.test.ts
index 383ac4e42d..cda1af61c7 100644
--- a/__tests__/utils/browser-and-file-utilities.test.ts
+++ b/__tests__/utils/browser-and-file-utilities.test.ts
@@ -6,8 +6,6 @@ import {
getStyleHeightPx,
isMobileDevice,
isMobileUserAgent,
- isProductionDomain,
- removeUnwantedKeys,
setStyleHeightPx,
} from "#/utils/utils";
@@ -49,8 +47,7 @@ const useWindowCapabilities = ({
if (property === "matchMedia") {
if (finePointer === undefined) return undefined;
return vi.fn((query: string) => ({
- matches:
- query === "(pointer: fine)" ? finePointer : !finePointer,
+ matches: query === "(pointer: fine)" ? finePointer : !finePointer,
}));
}
return Reflect.get(target, property, receiver);
@@ -163,53 +160,6 @@ describe("mobile environment detection", () => {
});
});
-describe("deployment domain detection", () => {
- it.each([
- ["https://app.all-hands.dev", true],
- ["http://localhost:3000", false],
- ])("reports whether %s is the production origin", (origin, expected) => {
- vi.stubGlobal("window", { location: { origin } });
-
- expect(isProductionDomain()).toBe(expected);
- });
-});
-
-describe("event export sanitization", () => {
- it("removes status entries and browser-only extras without mutating input", () => {
- const retainedEvent = {
- action: "browse",
- extras: {
- open_page_urls: ["https://example.com"],
- active_page_index: 0,
- dom_object: { tag: "main" },
- axtree_object: { role: "document" },
- extra_element_properties: { bid: "1" },
- last_browser_action: "click",
- last_browser_action_error: null,
- focused_element_bid: "1",
- trace_id: "trace-1",
- },
- };
- const plainEvent = { action: "message", args: { content: "hello" } };
- const statusEvent = { status: "ok", action: "ignored" };
-
- const result = removeUnwantedKeys([retainedEvent, plainEvent, statusEvent]);
-
- expect(result).toEqual([
- {
- action: "browse",
- extras: { trace_id: "trace-1" },
- },
- plainEvent,
- ]);
- expect(result[0]).not.toBe(retainedEvent);
- expect(result[0].extras).not.toBe(retainedEvent.extras);
- expect(retainedEvent.extras.open_page_urls).toEqual([
- "https://example.com",
- ]);
- });
-});
-
describe("file type labels", () => {
it.each([
["archive.tar.gz", "GZ"],
diff --git a/__tests__/utils/conversation-overview-project-scope.test.ts b/__tests__/utils/conversation-overview-project-scope.test.ts
index 87f6888eb6..282b372169 100644
--- a/__tests__/utils/conversation-overview-project-scope.test.ts
+++ b/__tests__/utils/conversation-overview-project-scope.test.ts
@@ -1,30 +1,11 @@
import { describe, expect, it } from "vitest";
-import type { Automation } from "#/types/automation";
import type { SkillInfo } from "#/types/settings";
import {
CONVERSATION_OVERVIEW_PROJECT_SCOPE,
- countAutomationsForRepository,
- countSkillsForProject,
- filterAutomationsByProjectScope,
filterSkillsByProjectScope,
- isAutomationForRepository,
- sortAutomationsByProjectRelevance,
sortSkillsByProjectRelevance,
} from "#/utils/conversation-overview-project-scope";
-function buildAutomation(
- overrides: Partial<Automation> & Pick<Automation, "id" | "name">,
-): Automation {
- return {
- trigger: { type: "cron", schedule: "0 * * * *" },
- enabled: true,
- created_at: "2026-01-01T00:00:00Z",
- updated_at: "2026-01-01T00:00:00Z",
- prompt: null,
- ...overrides,
- };
-}
-
function buildSkill(
overrides: Partial<SkillInfo> & Pick<SkillInfo, "name">,
): SkillInfo {
@@ -44,66 +25,6 @@ function buildSkill(
}
describe("conversation overview project scope", () => {
- it("matches automations to the open repository case-insensitively", () => {
- expect(
- isAutomationForRepository(
- buildAutomation({
- id: "1",
- name: "A",
- repository: "OpenHands/Agent-Canvas.git",
- }),
- "openhands/agent-canvas",
- ),
- ).toBe(true);
- expect(
- isAutomationForRepository(
- buildAutomation({ id: "2", name: "B", repository: "other/repo" }),
- "openhands/agent-canvas",
- ),
- ).toBe(false);
- expect(
- isAutomationForRepository(
- buildAutomation({ id: "3", name: "C" }),
- "openhands/agent-canvas",
- ),
- ).toBe(false);
- });
-
- it("filters and sorts automations for project vs all scopes", () => {
- const automations = [
- buildAutomation({ id: "1", name: "Zeta", repository: "other/repo" }),
- buildAutomation({
- id: "2",
- name: "Alpha",
- repository: "openhands/agent-canvas",
- }),
- buildAutomation({
- id: "3",
- name: "Beta",
- repository: "openhands/agent-canvas",
- }),
- ];
-
- expect(
- filterAutomationsByProjectScope(
- automations,
- CONVERSATION_OVERVIEW_PROJECT_SCOPE.project,
- "openhands/agent-canvas",
- ).map((automation) => automation.id),
- ).toEqual(["2", "3"]);
-
- expect(
- sortAutomationsByProjectRelevance(
- automations,
- "openhands/agent-canvas",
- ).map((automation) => automation.name),
- ).toEqual(["Alpha", "Beta", "Zeta"]);
-
- expect(
- countAutomationsForRepository(automations, "openhands/agent-canvas"),
- ).toBe(2);
- });
-
it("filters and sorts skills with project skills first", () => {
const skills = [
buildSkill({ name: "public-z", source: "public" }),
@@ -124,7 +45,5 @@ describe("conversation overview project scope", () => {
(skill) => skill.name,
),
).toEqual(["project-a", "personal-b", "public-z"]);
-
- expect(countSkillsForProject(skills, "/workspace/demo")).toBe(1);
});
});
diff --git a/__tests__/utils/file-priority.test.ts b/__tests__/utils/file-priority.test.ts
deleted file mode 100644
index 450f7788a4..0000000000
--- a/__tests__/utils/file-priority.test.ts
+++ /dev/null
@@ -1,93 +0,0 @@
-import { describe, it, expect } from "vitest";
-
-import { sortFilesByPriority, filePriorityScore } from "#/utils/file-priority";
-
-describe("file-priority", () => {
- it("places index.html before other files", () => {
- const sorted = sortFilesByPriority([
- "src/utils/helpers.ts",
- "src/index.html",
- "src/components/widget.tsx",
- ]);
- expect(sorted[0]).toBe("src/index.html");
- });
-
- it("places README.md before generic source files", () => {
- const sorted = sortFilesByPriority([
- "src/components/widget.tsx",
- "README.md",
- "src/utils/helpers.ts",
- ]);
- expect(sorted[0]).toBe("README.md");
- });
-
- it("prefers top-level index.html over a nested one", () => {
- const sorted = sortFilesByPriority(["src/nested/index.html", "index.html"]);
- expect(sorted[0]).toBe("index.html");
- expect(sorted[1]).toBe("src/nested/index.html");
- });
-
- it("prefers a shallower path even when the deeper one is more 'important'", () => {
- // README.md (depth 0) outranks foo/bar/index.html (depth 2) despite
- // index.html being a higher-priority basename β€” the user almost always
- // cares more about top-level files first.
- const sorted = sortFilesByPriority(["foo/bar/index.html", "README.md"]);
- expect(sorted[0]).toBe("README.md");
- expect(sorted[1]).toBe("foo/bar/index.html");
- });
-
- it("ranks index.html above README.md at the same depth", () => {
- const sorted = sortFilesByPriority(["README.md", "index.html"]);
- expect(sorted[0]).toBe("index.html");
- expect(sorted[1]).toBe("README.md");
- });
-
- it("falls back to alphabetical order for unimportant files", () => {
- const sorted = sortFilesByPriority([
- "src/zeta.ts",
- "src/alpha.ts",
- "src/mu.ts",
- ]);
- expect(sorted).toEqual(["src/alpha.ts", "src/mu.ts", "src/zeta.ts"]);
- });
-
- it("scores high-priority basenames lower than generic files", () => {
- expect(filePriorityScore("package.json")).toBeLessThan(
- filePriorityScore("src/some-helper.ts"),
- );
- });
-
- it("does not mutate the input array", () => {
- const input = ["b.ts", "a.ts"];
- const original = [...input];
- sortFilesByPriority(input);
- expect(input).toEqual(original);
- });
-
- // Regression for the depth-calculation bug where empty path segments
- // produced by leading / trailing / double slashes (e.g. agent-server
- // payloads that happen to start with `/`) inflated the computed depth
- // and caused a top-level file to sort below an actually-nested one.
- describe("depth calculation tolerates non-canonical path forms", () => {
- it("treats a leading-slash path the same as the unprefixed form", () => {
- const sorted = sortFilesByPriority([
- "src/nested/index.html",
- "/index.html",
- ]);
- expect(sorted[0]).toBe("/index.html");
- expect(sorted[1]).toBe("src/nested/index.html");
- });
-
- it("collapses double slashes when computing depth", () => {
- // `src//index.html` should sort identically to `src/index.html` (both
- // depth 1 β€” one nesting level under root), beating a genuinely
- // deeper path even though `index.html` is high-priority either way.
- const sorted = sortFilesByPriority([
- "deeply/nested/index.html",
- "src//index.html",
- ]);
- expect(sorted[0]).toBe("src//index.html");
- expect(sorted[1]).toBe("deeply/nested/index.html");
- });
- });
-});
diff --git a/__tests__/utils/format-model-name.test.ts b/__tests__/utils/format-model-name.test.ts
index 255118f85e..28dd8d94db 100644
--- a/__tests__/utils/format-model-name.test.ts
+++ b/__tests__/utils/format-model-name.test.ts
@@ -3,7 +3,6 @@ import {
FREE_MODEL_SUFFIX,
formatModelNameForDisplay,
formatNativeModelName,
- formatProviderModelNameForDisplay,
isFreeOpenHandsModel,
} from "#/utils/format-model-name";
@@ -32,22 +31,15 @@ describe("formatNativeModelName", () => {
it("labels only DB-flagged OpenHands free-model routes as free", () => {
for (const fullModel of FREE_MODELS) {
- const name = fullModel.slice("openhands/".length);
expect(formatModelNameForDisplay(fullModel, FREE_MODELS)).toBe(
`${fullModel}${FREE_MODEL_SUFFIX}`,
);
- expect(
- formatProviderModelNameForDisplay("openhands", name, FREE_MODELS),
- ).toBe(`${name}${FREE_MODEL_SUFFIX}`);
expect(isFreeOpenHandsModel(fullModel, FREE_MODELS)).toBe(true);
}
expect(formatModelNameForDisplay("openai/glm-5.2", FREE_MODELS)).toBe(
"openai/glm-5.2",
);
- expect(
- formatProviderModelNameForDisplay("openai", "glm-5.2", FREE_MODELS),
- ).toBe("glm-5.2");
expect(isFreeOpenHandsModel("openai/glm-5.2", FREE_MODELS)).toBe(false);
});
diff --git a/__tests__/utils/git-and-task-utilities.test.ts b/__tests__/utils/git-and-task-utilities.test.ts
index 03959d6011..d5a1856ba2 100644
--- a/__tests__/utils/git-and-task-utilities.test.ts
+++ b/__tests__/utils/git-and-task-utilities.test.ts
@@ -1,36 +1,22 @@
import { describe, expect, it } from "vitest";
import {
- buildSessionHeaders,
constructBranchUrl,
constructPullRequestUrl,
constructRepositoryUrl,
- getConversationStatusLabel,
getCreateNewBranchPrompt,
getCreatePRPrompt,
- getDisplayedTaskGroups,
getGitCommitPrompt,
getGitProviderBaseUrl,
getGitPullPrompt,
getGitPushPrompt,
- getLimitedTaskGroups,
- getOpenHandsQuery,
getPR,
getPRShort,
getProviderName,
- getPushToPRPrompt,
- getStatusClassName,
getStatusColor,
- getStatusIcon,
- getTotalTaskCount,
- hasOpenHandsSuffix,
isTaskPolling,
- shouldIncludeRepository,
} from "#/utils/utils";
import { AgentState } from "#/types/agent-state";
import { Provider } from "#/types/settings";
-import { ConversationStatus } from "#/types/conversation-status";
-import { GitRepository } from "#/types/git";
-import { SuggestedTask, SuggestedTaskGroup } from "#/utils/types";
import {
OH_STATUS_ERROR_COLOR,
OH_STATUS_SUCCESS_COLOR,
@@ -39,28 +25,6 @@ import {
const PAUSING_COLOR = "#FFD600";
const STOPPED_COLOR = "#ffffff";
-const repository = (fullName: string): GitRepository => ({
- id: "1",
- full_name: fullName,
- git_provider: "github",
- is_public: true,
-});
-
-const task = (repo: string, issueNumber: number): SuggestedTask => ({
- git_provider: "github",
- issue_number: issueNumber,
- repo,
- title: `Task ${issueNumber}`,
- task_type: "OPEN_ISSUE",
-});
-
-const group = (title: string, taskCount: number): SuggestedTaskGroup => ({
- title,
- tasks: Array.from({ length: taskCount }, (_, index) =>
- task(`owner/${title}`, index + 1),
- ),
-});
-
describe("getGitProviderBaseUrl", () => {
it.each([
{ provider: "github" as Provider, expected: "https://github.com" },
@@ -380,249 +344,6 @@ describe("git action prompts", () => {
expect(prompt).toContain("open a merge request");
expect(prompt).toContain("follow it when creating the MR description");
});
-
- it("references the existing PR in the push-to-PR prompt", () => {
- expect(getPushToPRPrompt("github")).toBe(
- "Please push the latest changes to the existing pull request.",
- );
- expect(getPushToPRPrompt("gitlab")).toBe(
- "Please push the latest changes to the existing merge request.",
- );
- });
-});
-
-describe("getTotalTaskCount", () => {
- it("returns 0 when there are no task groups", () => {
- expect(getTotalTaskCount(undefined)).toBe(0);
- expect(getTotalTaskCount([])).toBe(0);
- });
-
- it("sums tasks across every group", () => {
- expect(getTotalTaskCount([group("a", 2), group("b", 3)])).toBe(5);
- });
-
- it("ignores groups with no tasks", () => {
- expect(getTotalTaskCount([group("a", 0), group("b", 1)])).toBe(1);
- });
-});
-
-describe("getLimitedTaskGroups", () => {
- it("returns every group when the limit is not reached", () => {
- const groups = [group("a", 1), group("b", 1)];
-
- expect(getLimitedTaskGroups(groups, 3)).toEqual(groups);
- });
-
- it("truncates the group that crosses the limit", () => {
- const result = getLimitedTaskGroups([group("a", 2), group("b", 3)], 4);
-
- expect(result).toHaveLength(2);
- expect(result[0].tasks).toHaveLength(2);
- expect(result[1].tasks).toHaveLength(2);
- });
-
- it("stops once the limit is reached instead of emitting empty groups", () => {
- const result = getLimitedTaskGroups([group("a", 3), group("b", 2)], 3);
-
- expect(result).toHaveLength(1);
- expect(result[0].title).toBe("a");
- });
-
- it("omits groups that have no tasks to show", () => {
- // Without the `tasksToShow.length > 0` guard an empty group would be
- // emitted with an empty task list.
- const result = getLimitedTaskGroups([group("empty", 0), group("b", 1)], 3);
-
- expect(result).toHaveLength(1);
- expect(result[0].title).toBe("b");
- });
-
- it("returns nothing when the limit is zero", () => {
- expect(getLimitedTaskGroups([group("a", 2)], 0)).toEqual([]);
- });
-
- it("preserves non-task group fields while truncating", () => {
- const result = getLimitedTaskGroups([group("a", 5)], 1);
-
- expect(result[0].title).toBe("a");
- expect(result[0].tasks).toHaveLength(1);
- });
-
- it("does not mutate the input groups", () => {
- const groups = [group("a", 4)];
-
- getLimitedTaskGroups(groups, 1);
-
- expect(groups[0].tasks).toHaveLength(4);
- });
-});
-
-describe("getDisplayedTaskGroups", () => {
- it("returns nothing when there are no groups", () => {
- expect(getDisplayedTaskGroups(undefined, false)).toEqual([]);
- expect(getDisplayedTaskGroups(undefined, true)).toEqual([]);
- expect(getDisplayedTaskGroups([], true)).toEqual([]);
- });
-
- it("returns every group when expanded", () => {
- const groups = [group("a", 5), group("b", 5)];
-
- expect(getDisplayedTaskGroups(groups, true)).toBe(groups);
- });
-
- it("limits collapsed output to three tasks", () => {
- const groups = [group("a", 5), group("b", 5)];
- const result = getDisplayedTaskGroups(groups, false);
-
- expect(getTotalTaskCount(result)).toBe(3);
- });
-});
-
-describe("getConversationStatusLabel", () => {
- it.each([
- { status: "STOPPED" as ConversationStatus, expected: "COMMON$STOPPED" },
- { status: "RUNNING" as ConversationStatus, expected: "COMMON$RUNNING" },
- { status: "STARTING" as ConversationStatus, expected: "COMMON$STARTING" },
- { status: "ERROR" as ConversationStatus, expected: "COMMON$ERROR" },
- { status: "ARCHIVED" as ConversationStatus, expected: "COMMON$ARCHIVED" },
- ])("maps $status to $expected", ({ status, expected }) => {
- expect(getConversationStatusLabel(status)).toBe(expected);
- });
-
- it.each([
- "PAUSED",
- "AWAITING_USER_INPUT",
- "FINISHED",
- ] as ConversationStatus[])("falls back to UNKNOWN for %s", (status) => {
- expect(getConversationStatusLabel(status)).toBe("COMMON$UNKNOWN");
- });
-});
-
-describe("getStatusIcon", () => {
- it.each([
- { status: "todo", expected: "⏳" },
- { status: "in_progress", expected: "πŸ”„" },
- { status: "done", expected: "βœ…" },
- { status: "cancelled", expected: "❓" },
- { status: "", expected: "❓" },
- ])("maps $status to $expected", ({ status, expected }) => {
- expect(getStatusIcon(status)).toBe(expected);
- });
-});
-
-describe("getStatusClassName", () => {
- it("styles done and in_progress distinctly from every other status", () => {
- expect(getStatusClassName("done")).toBe("bg-green-800 text-green-200");
- expect(getStatusClassName("in_progress")).toBe(
- "bg-yellow-800 text-yellow-200",
- );
- expect(getStatusClassName("todo")).toBe("bg-tertiary text-text-tertiary");
- expect(getStatusClassName("")).toBe("bg-tertiary text-text-tertiary");
- });
-});
-
-describe("shouldIncludeRepository", () => {
- it("includes every repository when the query is blank", () => {
- expect(shouldIncludeRepository(repository("owner/repo"), "")).toBe(true);
- expect(shouldIncludeRepository(repository("owner/repo"), " ")).toBe(true);
- });
-
- it("matches on a substring of the full name", () => {
- expect(shouldIncludeRepository(repository("owner/repo"), "own")).toBe(true);
- expect(shouldIncludeRepository(repository("owner/repo"), "repo")).toBe(
- true,
- );
- });
-
- it("ignores case", () => {
- expect(shouldIncludeRepository(repository("Owner/Repo"), "OWNER")).toBe(
- true,
- );
- });
-
- it("matches when the query is a full clone URL", () => {
- expect(
- shouldIncludeRepository(
- repository("owner/repo"),
- "https://github.com/owner/repo.git",
- ),
- ).toBe(true);
- });
-
- it("excludes repositories that do not contain the query", () => {
- expect(shouldIncludeRepository(repository("owner/repo"), "other")).toBe(
- false,
- );
- });
-});
-
-describe("getOpenHandsQuery", () => {
- it.each(["gitlab", "azure_devops"] as Provider[])(
- "uses openhands-config for %s",
- (provider) => {
- expect(getOpenHandsQuery(provider)).toBe("openhands-config");
- },
- );
-
- it.each([
- "github",
- "bitbucket",
- "bitbucket_data_center",
- "forgejo",
- ] as Provider[])("uses .openhands for %s", (provider) => {
- expect(getOpenHandsQuery(provider)).toBe(".openhands");
- });
-
- it("uses .openhands when no provider is selected", () => {
- expect(getOpenHandsQuery(null)).toBe(".openhands");
- });
-});
-
-describe("hasOpenHandsSuffix", () => {
- it("requires the suffix to be its own path segment", () => {
- expect(hasOpenHandsSuffix(repository("owner/.openhands"), "github")).toBe(
- true,
- );
- expect(hasOpenHandsSuffix(repository("owner/my.openhands"), "github")).toBe(
- false,
- );
- });
-
- it("uses the provider-specific suffix", () => {
- expect(
- hasOpenHandsSuffix(repository("group/openhands-config"), "gitlab"),
- ).toBe(true);
- expect(hasOpenHandsSuffix(repository("group/.openhands"), "gitlab")).toBe(
- false,
- );
- });
-
- it("falls back to the default suffix when no provider is selected", () => {
- expect(hasOpenHandsSuffix(repository("owner/.openhands"), null)).toBe(true);
- });
-});
-
-describe("buildSessionHeaders", () => {
- it("adds the session header when a key is present", () => {
- expect(buildSessionHeaders("secret")).toEqual({
- "X-Session-API-Key": "secret",
- });
- });
-
- it.each([null, undefined, ""])(
- "omits the header entirely when the key is %j",
- (sessionApiKey) => {
- expect(buildSessionHeaders(sessionApiKey)).toEqual({});
- },
- );
-
- it("returns a fresh object on each call", () => {
- const first = buildSessionHeaders("a");
- const second = buildSessionHeaders("b");
-
- expect(first).not.toBe(second);
- expect(first).toEqual({ "X-Session-API-Key": "a" });
- });
});
describe("isTaskPolling", () => {
diff --git a/__tests__/utils/sdk-settings-schema.test.ts b/__tests__/utils/sdk-settings-schema.test.ts
index 439b5fb7fa..b039afae43 100644
--- a/__tests__/utils/sdk-settings-schema.test.ts
+++ b/__tests__/utils/sdk-settings-schema.test.ts
@@ -6,12 +6,10 @@ import {
buildSdkSettingsPayloadForView,
coerceFieldValue,
getAgentSettingValue,
- getConversationSettingValue,
getSettingValue,
getVisibleSettingsSections,
hasCriticalSettings,
hasAdvancedSettings,
- hasAdvancedSettingsOverrides,
hasMinorSettings,
inferInitialView,
isSettingsFieldVisible,
@@ -210,7 +208,6 @@ describe("sdk settings schema helpers", () => {
});
it("detects advanced overrides from non-default values", () => {
- expect(hasAdvancedSettingsOverrides(BASE_SETTINGS)).toBe(false);
expect(inferInitialView(BASE_SETTINGS)).toBe("basic");
const withMinorOverride: Settings = {
@@ -224,7 +221,6 @@ describe("sdk settings schema helpers", () => {
},
},
};
- expect(hasAdvancedSettingsOverrides(withMinorOverride)).toBe(true);
expect(inferInitialView(withMinorOverride)).toBe("all");
});
@@ -449,9 +445,6 @@ describe("sdk settings schema helpers", () => {
expect(getAgentSettingValue(settings, "llm.enabled")).toBe(false);
expect(getAgentSettingValue(settings, "llm.retries")).toBe(0);
expect(getAgentSettingValue(settings, "empty")).toBe("");
- expect(getConversationSettingValue(settings, "llm.model")).toBe(
- "conversation-model",
- );
expect(
getSettingValue(settings, "llm.model", "conversation_settings"),
).toBe("conversation-model");
@@ -472,7 +465,9 @@ describe("sdk settings schema helpers", () => {
expect(getAgentSettingValue(settings, "llm.model")).toBeNull();
expect(getAgentSettingValue(settings, "nullable.child")).toBeNull();
expect(getAgentSettingValue(settings, "text.length")).toBeNull();
- expect(getConversationSettingValue(settings, "llm.model")).toBeNull();
+ expect(
+ getSettingValue(settings, "llm.model", "conversation_settings"),
+ ).toBeNull();
});
});
diff --git a/__tests__/utils/settings-utils.test.ts b/__tests__/utils/settings-utils.test.ts
index fdfed11dea..17496f3599 100644
--- a/__tests__/utils/settings-utils.test.ts
+++ b/__tests__/utils/settings-utils.test.ts
@@ -1,52 +1,5 @@
import { describe, it, expect } from "vitest";
-import { parseMaxBudgetPerTask, extractSettings } from "#/utils/settings-utils";
-
-describe("parseMaxBudgetPerTask", () => {
- it("should return null for empty string", () => {
- expect(parseMaxBudgetPerTask("")).toBeNull();
- });
-
- it("should return null for whitespace-only string", () => {
- expect(parseMaxBudgetPerTask(" ")).toBeNull();
- });
-
- it("should return null for non-numeric string", () => {
- expect(parseMaxBudgetPerTask("abc")).toBeNull();
- });
-
- it("should return null for values less than 1", () => {
- expect(parseMaxBudgetPerTask("0")).toBeNull();
- expect(parseMaxBudgetPerTask("0.5")).toBeNull();
- expect(parseMaxBudgetPerTask("-1")).toBeNull();
- expect(parseMaxBudgetPerTask("-10.5")).toBeNull();
- });
-
- it("should return the parsed value for valid numbers >= 1", () => {
- expect(parseMaxBudgetPerTask("1")).toBe(1);
- expect(parseMaxBudgetPerTask("1.0")).toBe(1);
- expect(parseMaxBudgetPerTask("1.5")).toBe(1.5);
- expect(parseMaxBudgetPerTask("10")).toBe(10);
- expect(parseMaxBudgetPerTask("100.99")).toBe(100.99);
- });
-
- it("should handle string numbers with leading/trailing whitespace", () => {
- expect(parseMaxBudgetPerTask(" 1 ")).toBe(1);
- expect(parseMaxBudgetPerTask(" 10.5 ")).toBe(10.5);
- });
-
- it("should return null for edge cases", () => {
- expect(parseMaxBudgetPerTask("0.999")).toBeNull();
- expect(parseMaxBudgetPerTask("NaN")).toBeNull();
- expect(parseMaxBudgetPerTask("Infinity")).toBeNull();
- expect(parseMaxBudgetPerTask("-Infinity")).toBeNull();
- });
-
- it("should handle scientific notation", () => {
- expect(parseMaxBudgetPerTask("1e0")).toBe(1);
- expect(parseMaxBudgetPerTask("1.5e1")).toBe(15);
- expect(parseMaxBudgetPerTask("5e-1")).toBeNull(); // 0.5, which is < 1
- });
-});
+import { extractSettings } from "#/utils/settings-utils";
describe("extractSettings", () => {
it("should preserve model name case when extracting settings", () => {
diff --git a/__tests__/utils/settings-value-pickers.test.ts b/__tests__/utils/settings-value-pickers.test.ts
index 2ba246c582..1cd111072b 100644
--- a/__tests__/utils/settings-value-pickers.test.ts
+++ b/__tests__/utils/settings-value-pickers.test.ts
@@ -1,36 +1,11 @@
import { describe, expect, it } from "vitest";
import {
- isNonEmptyString,
pickFirstBoolean,
pickFirstNumber,
- pickFirstString,
pickNullableString,
} from "#/utils/settings-value-pickers";
describe("settings value selection", () => {
- describe("non-empty strings", () => {
- it.each([
- ["a non-empty string", "configured", true],
- ["an empty string", "", false],
- ["null", null, false],
- ["a non-string with a length", { length: 1 }, false],
- ["a number", 42, false],
- ])("identifies %s", (_description, value, expected) => {
- expect(isNonEmptyString(value)).toBe(expected);
- });
-
- it("returns the first non-empty string and skips other values", () => {
- expect(pickFirstString(undefined, "", false, "first", "second")).toBe(
- "first",
- );
- });
-
- it("returns undefined when no non-empty string is available", () => {
- expect(pickFirstString(undefined, null, false, 0, "")).toBeUndefined();
- expect(pickFirstString()).toBeUndefined();
- });
- });
-
describe("booleans", () => {
it("preserves false and returns the first boolean", () => {
expect(pickFirstBoolean("false", 0, false, true)).toBe(false);
diff --git a/__tests__/utils/workspace-relative-path.test.ts b/__tests__/utils/workspace-relative-path.test.ts
deleted file mode 100644
index 352bf05604..0000000000
--- a/__tests__/utils/workspace-relative-path.test.ts
+++ /dev/null
@@ -1,59 +0,0 @@
-import { describe, expect, it } from "vitest";
-import { toWorkspaceRelativePath } from "#/utils/workspace-relative-path";
-
-describe("toWorkspaceRelativePath", () => {
- it("strips the conversation working directory prefix from absolute paths", () => {
- expect(
- toWorkspaceRelativePath(
- "/workspace/project/report.md",
- "/workspace/project",
- ),
- ).toBe("report.md");
- expect(
- toWorkspaceRelativePath(
- "/workspace/project/src/index.ts",
- "/workspace/project",
- ),
- ).toBe("src/index.ts");
- });
-
- it("leaves already-relative paths unchanged", () => {
- expect(toWorkspaceRelativePath("canvas.md", "/workspace/project")).toBe(
- "canvas.md",
- );
- expect(toWorkspaceRelativePath("./docs/a.md", "/workspace/project")).toBe(
- "docs/a.md",
- );
- });
-
- it("falls back to DEFAULT_WORKING_DIR when workingDir is omitted", () => {
- expect(toWorkspaceRelativePath("/workspace/project/canvas.md")).toBe(
- "canvas.md",
- );
- });
-
- it("strips a nested working dir before the generic /workspace/<name>/ fallback", () => {
- const workingDir = "/workspace/project/packages/app";
- expect(
- toWorkspaceRelativePath(
- "/workspace/project/packages/app/src/index.ts",
- workingDir,
- ),
- ).toBe("src/index.ts");
- expect(
- toWorkspaceRelativePath(
- "/workspace/project/packages/app/src/index.ts:12",
- workingDir,
- ),
- ).toBe("src/index.ts");
- expect(toWorkspaceRelativePath(workingDir, workingDir)).toBe("");
- });
-
- it("strips editor line suffixes from POSIX and Windows paths", () => {
- expect(toWorkspaceRelativePath("src/a.ts:12")).toBe("src/a.ts");
- expect(toWorkspaceRelativePath("src/a.ts:12-40")).toBe("src/a.ts");
- expect(toWorkspaceRelativePath("C:\\repo\\src\\a.ts:12", "C:\\repo")).toBe(
- "src/a.ts",
- );
- });
-});
diff --git a/src/api/agent-server-adapter.ts b/src/api/agent-server-adapter.ts
index 33902dd13b..4b1a0e93e9 100644
--- a/src/api/agent-server-adapter.ts
+++ b/src/api/agent-server-adapter.ts
@@ -240,13 +240,6 @@ async function fetchBackendServerInfo(): Promise<AgentServerInfo | null> {
}
}
-export async function fetchBackendRuntimeServicesInfo(): Promise<RuntimeServicesInfo | null> {
- const serverInfo = await fetchBackendServerInfo();
- return parseRuntimeServicesInfo(
- (serverInfo as { runtime_services?: unknown } | null)?.runtime_services,
- );
-}
-
export async function fetchBackendExecutionRuntime(): Promise<
AgentServerInfo["execution_runtime"]
> {
diff --git a/src/api/agent-server-client-options.ts b/src/api/agent-server-client-options.ts
index c22cf9d50b..d28934c70f 100644
--- a/src/api/agent-server-client-options.ts
+++ b/src/api/agent-server-client-options.ts
@@ -28,15 +28,6 @@ export class NoBackendAvailableError extends Error {
}
}
-export const isNoBackendAvailableError = (
- error: unknown,
-): error is NoBackendAvailableError =>
- error instanceof NoBackendAvailableError ||
- (typeof error === "object" &&
- error !== null &&
- "name" in error &&
- error.name === "NoBackendAvailableError");
-
function normalizeHost(host: string): string {
return host.replace(/\/+$/, "");
}
diff --git a/src/api/agent-server-compatibility.test.ts b/src/api/agent-server-compatibility.test.ts
index c21f576187..7685e7e0b7 100644
--- a/src/api/agent-server-compatibility.test.ts
+++ b/src/api/agent-server-compatibility.test.ts
@@ -7,10 +7,8 @@ import {
AgentServerUnsupportedVersionError,
assertAgentServerVersionIsSupported,
getDisplayAgentServerVersion,
- getDisplayAgentServerSdkVersion,
isAgentServerAuthError,
isAgentServerUnavailableError,
- isAgentServerUnknownVersionError,
isAgentServerUnsupportedVersionError,
isSdkHttpError,
isSdkHttpStatusError,
@@ -200,22 +198,6 @@ describe("agent-server compatibility errors", () => {
])("rejects unsupported-version lookalike %#", (error) => {
expect(isAgentServerUnsupportedVersionError(error)).toBe(false);
});
-
- it.each([
- new AgentServerUnknownVersionError("dev-build"),
- { code: AGENT_SERVER_UNKNOWN_VERSION_ERROR_CODE },
- ])("recognizes unknown-version error %#", (error) => {
- expect(isAgentServerUnknownVersionError(error)).toBe(true);
- });
-
- it.each([
- null,
- "AGENT_SERVER_UNKNOWN_VERSION",
- {},
- { code: "ANOTHER_ERROR" },
- ])("rejects unknown-version lookalike %#", (error) => {
- expect(isAgentServerUnknownVersionError(error)).toBe(false);
- });
});
describe("SDK HTTP error classification", () => {
@@ -261,22 +243,4 @@ describe("SDK HTTP error classification", () => {
),
).not.toThrow();
});
-
- it("reports the dedicated agent-server SDK version when present", () => {
- expect(
- getDisplayAgentServerSdkVersion(serverInfo("1.36.0", "1.36.1")),
- ).toBe("1.36.1");
- expect(getDisplayAgentServerSdkVersion(serverInfo("1.36.0"))).toBe(
- "1.36.0",
- );
- });
});
-
-it.each([undefined, "unknown"])(
- "does not display an absent or unknown SDK version: %s",
- (version) => {
- expect(
- getDisplayAgentServerSdkVersion(serverInfo(version, version)),
- ).toBeNull();
- },
-);
diff --git a/src/api/agent-server-compatibility.ts b/src/api/agent-server-compatibility.ts
index 8222a3660b..7ad8a9e0d5 100644
--- a/src/api/agent-server-compatibility.ts
+++ b/src/api/agent-server-compatibility.ts
@@ -114,15 +114,6 @@ export const isAgentServerUnsupportedVersionError = (
"code" in error &&
error.code === AGENT_SERVER_UNSUPPORTED_VERSION_ERROR_CODE);
-export const isAgentServerUnknownVersionError = (
- error: unknown,
-): error is AgentServerUnknownVersionError =>
- error instanceof AgentServerUnknownVersionError ||
- (typeof error === "object" &&
- error !== null &&
- "code" in error &&
- error.code === AGENT_SERVER_UNKNOWN_VERSION_ERROR_CODE);
-
/**
* Returns true when the agent-server probe failed with HTTP 401.
* In public mode this means the stored key is stale (server restarted
@@ -200,26 +191,6 @@ export function getDisplayAgentServerVersion(
return version;
}
-export function getDisplayAgentServerSdkVersion(
- serverInfo: AgentServerInfo,
-): string | null {
- const version =
- getRawAgentServerSdkVersion(serverInfo) ??
- getComparableAgentServerVersion(serverInfo);
- if (!version || version.toLowerCase() === UNKNOWN_AGENT_SERVER_VERSION) {
- return null;
- }
- return version;
-}
-
-export function getCachedAgentServerSdkVersion(
- host?: string | null,
-): string | null {
- if (!cachedAgentServerInfo) return null;
- if (host && getEffectiveLocalBackend()?.host !== host) return null;
- return getDisplayAgentServerSdkVersion(cachedAgentServerInfo);
-}
-
export function getCachedAgentServerVersion(
host?: string | null,
): string | null {
diff --git a/src/api/backend-registry/last-conversation-store.ts b/src/api/backend-registry/last-conversation-store.ts
index ccf7bcf416..9598446adc 100644
--- a/src/api/backend-registry/last-conversation-store.ts
+++ b/src/api/backend-registry/last-conversation-store.ts
@@ -45,13 +45,6 @@ function writeMap(map: StoredMap): void {
}
}
-export function getLastConversationId(
- backendId: string,
- orgId: string | null,
-): string | null {
- return readMap()[selectionKey(backendId, orgId)] ?? null;
-}
-
export function setLastConversationId(
backendId: string,
orgId: string | null,
diff --git a/src/api/cloud/types.ts b/src/api/cloud/types.ts
index 808b7ba575..4f88bbab23 100644
--- a/src/api/cloud/types.ts
+++ b/src/api/cloud/types.ts
@@ -49,19 +49,6 @@ export interface CloudApiKeyMetadata {
auth_type: string;
}
-/**
- * Response from `GET /api/v1/users/git-info`. Identifies the currently
- * authenticated user across the connected git providers.
- */
-export interface CloudGitUser {
- id: string;
- login: string;
- avatar_url: string;
- company: string | null;
- name: string | null;
- email: string | null;
-}
-
/**
* Server-derived Super Admin setup-guide steps, from
* `GET /api/admin/setup-state` on an OpenHands Enterprise backend.
diff --git a/src/api/conversation-service/agent-server-conversation-service.types.ts b/src/api/conversation-service/agent-server-conversation-service.types.ts
index fe1d1cd17f..a555cfb5e7 100644
--- a/src/api/conversation-service/agent-server-conversation-service.types.ts
+++ b/src/api/conversation-service/agent-server-conversation-service.types.ts
@@ -131,11 +131,6 @@ export interface SendMessageResponse {
content: MessageContent[];
}
-export interface AppConversationStartTaskPage {
- items: AppConversationStartTask[];
- next_page_id: string | null;
-}
-
export interface ConversationWorkspace {
working_dir: string | null;
}
@@ -256,10 +251,6 @@ export interface Skill {
disable_model_invocation?: boolean;
}
-export interface GetSkillsResponse {
- skills: Skill[];
-}
-
export interface HookDefinition {
type: string; // 'command', 'prompt' or 'agent'
command: string; // Empty for prompt and agent hooks
diff --git a/src/api/device-flow-client.ts b/src/api/device-flow-client.ts
index 63dbd5344c..d886c83fd3 100644
--- a/src/api/device-flow-client.ts
+++ b/src/api/device-flow-client.ts
@@ -34,5 +34,4 @@ export function pollForToken(
export type {
DeviceAuthorizationResponse,
DeviceTokenResponse,
- PollDeviceTokenOptions as PollOptions,
} from "@openhands/typescript-client/client/device-flow-client";
diff --git a/src/api/open-hands.types.ts b/src/api/open-hands.types.ts
index e9796d6162..a18cecc901 100644
--- a/src/api/open-hands.types.ts
+++ b/src/api/open-hands.types.ts
@@ -2,44 +2,11 @@ import { ConversationStatus } from "#/types/conversation-status";
import { RuntimeStatus } from "#/types/runtime-status";
import { Provider } from "#/types/settings";
-export interface ErrorResponse {
- error: string;
-}
-
-export interface SaveFileSuccessResponse {
- message: string;
-}
-
export interface FileUploadSuccessResponse {
uploaded_files: string[];
skipped_files: { name: string; reason: string }[];
}
-export interface FeedbackBodyResponse {
- message: string;
- feedback_id: string;
- password: string;
-}
-
-export interface FeedbackResponse {
- statusCode: number;
- body: FeedbackBodyResponse;
-}
-
-export interface AuthenticationResponse {
- message: string;
- login?: string; // Only present when allow list is enabled
-}
-
-export interface Feedback {
- version: string;
- email: string;
- token: string;
- polarity: "positive" | "negative";
- permissions: "public" | "private";
- trajectory: unknown[];
-}
-
export interface GetVSCodeUrlResponse {
vscode_url: string | null;
error?: string;
@@ -83,11 +50,6 @@ export interface Conversation {
llm_model?: string | null;
}
-export interface ResultSet<T> {
- results: T[];
- next_page_id: string | null;
-}
-
/**
* @deprecated Use AgentServerGitChangeStatus for new code. This type is maintained for backward compatibility with V0 API.
*/
@@ -122,19 +84,3 @@ export interface GitCommitsPage {
commits: GitCommit[];
hasMore: boolean;
}
-
-export interface InputMetadata {
- name: string;
- description: string;
-}
-
-export interface IOption<T> {
- label: string;
- value: T;
-}
-
-export type GetFilesResponse = string[];
-
-export interface GetFileResponse {
- code: string;
-}
diff --git a/src/components/conversation-events/chat/event-message-components/index.ts b/src/components/conversation-events/chat/event-message-components/index.ts
deleted file mode 100644
index 4da5c75b3d..0000000000
--- a/src/components/conversation-events/chat/event-message-components/index.ts
+++ /dev/null
@@ -1,8 +0,0 @@
-export { UserAssistantEventMessage } from "./user-assistant-event-message";
-export { ErrorEventMessage } from "./error-event-message";
-export { FinishEventMessage } from "./finish-event-message";
-export { GenericEventMessageWrapper } from "./generic-event-message-wrapper";
-export { ThoughtEventMessage } from "./thought-event-message";
-export { HookExecutionEventMessage } from "./hook-execution-event-message";
-export { EventGroup } from "./event-group";
-export { CriticResultDisplay } from "./critic-result-display";
diff --git a/src/components/conversation-events/chat/hooks/use-plan-preview-events.ts b/src/components/conversation-events/chat/hooks/use-plan-preview-events.ts
index 2c639534e8..a7dde1ba81 100644
--- a/src/components/conversation-events/chat/hooks/use-plan-preview-events.ts
+++ b/src/components/conversation-events/chat/hooks/use-plan-preview-events.ts
@@ -62,12 +62,6 @@ function findLastPlanningObservationInPhase(
return null;
}
-export interface PlanPreviewEventInfo {
- eventId: string;
- /** Index of this plan preview in the conversation (1st, 2nd, etc.) */
- phaseIndex: number;
-}
-
/**
* Hook to determine which PlanningFileEditorObservation events should render PlanPreview.
*
diff --git a/src/components/conversation-events/chat/index.ts b/src/components/conversation-events/chat/index.ts
deleted file mode 100644
index bce6a75795..0000000000
--- a/src/components/conversation-events/chat/index.ts
+++ /dev/null
@@ -1,8 +0,0 @@
-export { Messages } from "./messages";
-export { EventMessage } from "./event-message";
-export * from "./event-message-components";
-export { getEventContent } from "./event-content-helpers/get-event-content";
-export {
- shouldRenderEvent,
- hasUserEvent,
-} from "./event-content-helpers/should-render-event";
diff --git a/src/components/features/automations/automation-health-badge.tsx b/src/components/features/automations/automation-health-badge.tsx
deleted file mode 100644
index cf00cc561d..0000000000
--- a/src/components/features/automations/automation-health-badge.tsx
+++ /dev/null
@@ -1,43 +0,0 @@
-import {
- HEALTH_LABEL_KEYS,
- type AutomationHealth,
-} from "#/manifests/automation-insights";
-import type { InterfaceListInsights } from "#/manifests/types";
-import { cn } from "#/utils/utils";
-
-/**
- * The states and their colors are the host's; the captions come from the
- * manifest's `insights.health` block.
- */
-const HEALTH_STYLES: Record<AutomationHealth, string> = {
- healthy:
- "border-semantic-success/50 bg-semantic-success/10 text-semantic-success",
- failing: "border-semantic-danger/50 bg-semantic-danger/10 text-danger",
- running: "border-border bg-surface-raised text-muted",
- disabled: "border-border bg-surface-raised text-muted",
- "never-run": "border-warning/50 bg-warning/10 text-warning",
- unknown: "border-border bg-surface-raised text-muted",
-};
-
-interface AutomationHealthBadgeProps {
- health: AutomationHealth;
- labels: InterfaceListInsights["health"];
-}
-
-export function AutomationHealthBadge({
- health,
- labels,
-}: AutomationHealthBadgeProps) {
- return (
- <span
- data-testid="automation-health-badge"
- className={cn(
- "inline-flex items-center gap-1.5 whitespace-nowrap rounded-full border px-2 py-0.5 text-[11px] font-medium",
- HEALTH_STYLES[health],
- )}
- >
- <span className="size-1.5 rounded-full bg-current" aria-hidden />
- {labels[HEALTH_LABEL_KEYS[health]]}
- </span>
- );
-}
diff --git a/src/components/features/automations/automation-run-insights.tsx b/src/components/features/automations/automation-run-insights.tsx
index ec92bcca30..aa94fdcffd 100644
--- a/src/components/features/automations/automation-run-insights.tsx
+++ b/src/components/features/automations/automation-run-insights.tsx
@@ -3,26 +3,6 @@ import {
type RunSummaryState,
} from "#/manifests/automation-insights";
import type { InterfaceListInsights } from "#/manifests/types";
-import { formatTimeDelta } from "#/utils/format-time-delta";
-
-/** `formatTimeDelta` renders seconds as `<n>s`; anything under a minute reads as "just now". */
-const SECONDS_DELTA_PATTERN = /^\d+s$/;
-
-/**
- * "Never", "Just now", or a localized "<delta> ago". The captions are the
- * manifest's; the delta and its "ago" suffix are the host's translations.
- */
-export function lastRunText(
- startedAt: string | null | undefined,
- copy: InterfaceListInsights["lastRun"],
- agoSuffix: string,
-): string {
- if (!startedAt) return copy.never;
- const delta = formatTimeDelta(startedAt);
- return SECONDS_DELTA_PATTERN.test(delta)
- ? copy.justNow
- : `${delta} ${agoSuffix}`;
-}
export function runCountDisplay(state: RunSummaryState | undefined): string {
if (state?.summary) return state.summary.total.toLocaleString();
diff --git a/src/components/features/automations/detail/edit-automation-modal.tsx b/src/components/features/automations/detail/edit-automation-modal.tsx
deleted file mode 100644
index 910dbd3338..0000000000
--- a/src/components/features/automations/detail/edit-automation-modal.tsx
+++ /dev/null
@@ -1,562 +0,0 @@
-import { AutomationAgentProfileSelector } from "../agent-profile-selector";
-import { useEffect, useMemo, useState } from "react";
-import { useTranslation } from "react-i18next";
-import { I18nKey } from "#/i18n/declaration";
-import type { Automation } from "#/types/automation";
-import { useUpdateAutomation } from "#/hooks/query/use-automations";
-import { useLlmProfiles } from "#/hooks/query/use-llm-profiles";
-import { SettingsInput } from "#/components/features/settings/settings-input";
-import { SettingsDropdownInput } from "#/components/features/settings/settings-dropdown-input";
-import { BrandButton } from "#/components/features/settings/brand-button";
-import {
- displaySuccessToast,
- displayErrorToast,
-} from "#/utils/custom-toast-handlers";
-import { getApiErrorMessage } from "#/utils/api-error-message";
-import { modalTitleLgMediumClassName } from "#/utils/modal-classes";
-import {
- parseCronSchedule,
- buildCronSchedule,
- formatTimeOfDay,
- parseTimeOfDay,
- formatEventOn,
- validateCronSchedule,
- CRON_EXPRESSION_EXAMPLE,
- type SchedulePresetKind,
-} from "#/utils/automation-schedule";
-import {
- validateAutomationTimeout,
- AUTOMATION_TIMEOUT_DEFAULT_SECONDS,
-} from "#/utils/automation-timeout";
-import { useDeploymentCapabilities } from "#/hooks/query/use-manifest-capabilities";
-import {
- getAttributeSpec,
- getInterfaceCopy,
-} from "#/manifests/automation-interface";
-import { cn } from "#/utils/utils";
-import {
- formControlMultilineFieldClassName,
- formControlSettingsFieldClassName,
-} from "#/utils/form-control-classes";
-import XMarkIcon from "#/icons/x-mark.svg?react";
-
-interface EditAutomationModalProps {
- automation: Automation;
- isOpen: boolean;
- onClose: () => void;
-}
-
-type FrequencyKey = SchedulePresetKind | "custom";
-
-// Sentinel key for the "Active profile" picker option. Real profile names must
-// start with an alphanumeric (backend MODEL_PROFILE_PATTERN), so this cannot
-// collide with a stored profile name. Maps to an empty `form.model` (= use the
-// active/default profile).
-const ACTIVE_PROFILE_KEY = "__active__";
-
-const WEEKDAY_KEYS: I18nKey[] = [
- I18nKey.AUTOMATIONS$WEEKDAY_SUN,
- I18nKey.AUTOMATIONS$WEEKDAY_MON,
- I18nKey.AUTOMATIONS$WEEKDAY_TUE,
- I18nKey.AUTOMATIONS$WEEKDAY_WED,
- I18nKey.AUTOMATIONS$WEEKDAY_THU,
- I18nKey.AUTOMATIONS$WEEKDAY_FRI,
- I18nKey.AUTOMATIONS$WEEKDAY_SAT,
-];
-
-interface FormState {
- agentProfileId: string | null;
- name: string;
- prompt: string;
- model: string;
- frequency: FrequencyKey;
- weekday: number;
- timeOfDay: string;
- isCustomSchedule: boolean;
- rawSchedule: string;
- timeout: string;
-}
-
-function buildInitialState(automation: Automation): FormState {
- const timeout = automation.timeout != null ? String(automation.timeout) : "";
- if (automation.trigger.type === "event") {
- return {
- name: automation.name,
- prompt: automation.prompt ?? "",
- agentProfileId: automation.agent_profile_id ?? null,
- model: automation.model ?? "",
- frequency: "custom",
- weekday: 1,
- timeOfDay: "",
- isCustomSchedule: true,
- rawSchedule: "",
- timeout,
- };
- }
- const parsed = parseCronSchedule(automation.trigger.schedule);
- if (parsed.kind === "custom") {
- return {
- name: automation.name,
- prompt: automation.prompt ?? "",
- agentProfileId: automation.agent_profile_id ?? null,
- model: automation.model ?? "",
- frequency: "custom",
- weekday: 1,
- timeOfDay:
- parsed.hour !== undefined && parsed.minute !== undefined
- ? formatTimeOfDay(parsed.hour, parsed.minute)
- : "",
- isCustomSchedule: true,
- rawSchedule: parsed.raw,
- timeout,
- };
- }
- return {
- name: automation.name,
- prompt: automation.prompt ?? "",
- agentProfileId: automation.agent_profile_id ?? null,
- model: automation.model ?? "",
- frequency: parsed.kind,
- weekday: parsed.kind === "weekly" ? (parsed.weekday ?? 1) : 1,
- timeOfDay: formatTimeOfDay(parsed.hour, parsed.minute),
- isCustomSchedule: false,
- rawSchedule: automation.trigger.schedule ?? "",
- timeout,
- };
-}
-
-export function EditAutomationModal({
- automation,
- isOpen,
- onClose,
-}: EditAutomationModalProps) {
- const { t } = useTranslation("openhands");
- const updateMutation = useUpdateAutomation();
- // Which attributes the dialog offers, and their copy, come from the
- // interface manifest; absent one, the host defaults reproduce today's form.
- const editTitle = getInterfaceCopy().editTitle;
- const nameSpec = getAttributeSpec("name");
- const promptSpec = getAttributeSpec("prompt");
- const modelSpec = getAttributeSpec("model");
- const timeoutSpec = getAttributeSpec("timeout");
- const scheduleSpec = getAttributeSpec("schedule");
- const { data: capabilities } = useDeploymentCapabilities();
- const serviceTimeoutMax = capabilities?.maxAutomationTimeoutSeconds;
- // The deployment owns the absolute ceiling. A manifest may narrow it, never
- // expand it; without discovery, leave maximum enforcement to the service.
- const timeoutMax =
- serviceTimeoutMax === undefined
- ? undefined
- : Math.min(serviceTimeoutMax, timeoutSpec.max ?? serviceTimeoutMax);
- const { data: profilesData, isLoading: isLoadingProfiles } = useLlmProfiles();
- const profiles = profilesData?.profiles ?? [];
- const modelItems = [
- { key: ACTIVE_PROFILE_KEY, label: t(I18nKey.COMMON$ACTIVE_PROFILE) },
- ...profiles.map((p) => ({ key: p.name, label: p.name })),
- ];
-
- const initial = useMemo(() => buildInitialState(automation), [automation]);
- const [form, setForm] = useState<FormState>(initial);
- const [nameError, setNameError] = useState<string | null>(null);
- const [timeoutError, setTimeoutError] = useState<string | null>(null);
- const [scheduleError, setScheduleError] = useState<string | null>(null);
-
- useEffect(() => {
- if (isOpen) {
- setForm(initial);
- setNameError(null);
- setTimeoutError(null);
- setScheduleError(null);
- }
- }, [isOpen, initial]);
-
- if (!isOpen) return null;
-
- const frequencyItems = [
- {
- key: "daily",
- label: t(I18nKey.AUTOMATIONS$FREQUENCY_DAILY),
- },
- {
- key: "weekdays",
- label: t(I18nKey.AUTOMATIONS$FREQUENCY_WEEKDAYS),
- },
- {
- key: "weekly",
- label: t(I18nKey.AUTOMATIONS$FREQUENCY_WEEKLY),
- },
- ...(form.isCustomSchedule
- ? [
- {
- key: "custom",
- label: t(I18nKey.AUTOMATIONS$FREQUENCY_CUSTOM),
- },
- ]
- : []),
- ];
-
- const weekdayItems = WEEKDAY_KEYS.map((key, index) => ({
- key: String(index),
- label: t(key),
- }));
-
- const handleSubmit = (e: React.FormEvent<HTMLFormElement>) => {
- e.preventDefault();
-
- const trimmedName = form.name.trim();
- if (!trimmedName) {
- setNameError(t(I18nKey.AUTOMATIONS$NAME_REQUIRED));
- return;
- }
- setNameError(null);
-
- const timeoutResult = validateAutomationTimeout(form.timeout, timeoutMax);
- if ("errorKey" in timeoutResult) {
- setTimeoutError(t(timeoutResult.errorKey, { max: timeoutMax }));
- return;
- }
- setTimeoutError(null);
-
- const body: Partial<Automation> = {};
-
- if (trimmedName !== automation.name) {
- body.name = trimmedName;
- }
-
- const trimmedPrompt = form.prompt.trim();
- const initialPrompt = automation.prompt ?? "";
- if (trimmedPrompt !== initialPrompt.trim()) {
- body.prompt = trimmedPrompt.length === 0 ? null : trimmedPrompt;
- }
-
- if (form.agentProfileId !== (automation.agent_profile_id ?? null)) {
- body.agent_profile_id = form.agentProfileId;
- }
- const selectedModel = form.agentProfileId ? "" : form.model.trim();
- const initialModel = automation.model ?? "";
- if (selectedModel !== initialModel) {
- body.model = selectedModel === "" ? null : selectedModel;
- }
-
- if ((timeoutResult.value ?? null) !== (automation.timeout ?? null)) {
- body.timeout = timeoutResult.value;
- }
-
- if (automation.trigger.type !== "event" && form.isCustomSchedule) {
- // An untouched schedule is the service's business, not the form's.
- const trimmedSchedule = form.rawSchedule.trim();
- if (trimmedSchedule !== (automation.trigger.schedule ?? "").trim()) {
- const scheduleResult = validateCronSchedule(form.rawSchedule);
- if ("errorKey" in scheduleResult) {
- setScheduleError(t(scheduleResult.errorKey));
- return;
- }
- body.trigger = {
- ...automation.trigger,
- schedule: scheduleResult.schedule,
- };
- }
- setScheduleError(null);
- } else if (!form.isCustomSchedule && form.frequency !== "custom") {
- const parsedTime = parseTimeOfDay(form.timeOfDay);
- if (parsedTime) {
- const newSchedule = buildCronSchedule({
- kind: form.frequency,
- hour: parsedTime.hour,
- minute: parsedTime.minute,
- weekday: form.frequency === "weekly" ? form.weekday : undefined,
- });
- if (newSchedule !== automation.trigger.schedule) {
- body.trigger = {
- ...automation.trigger,
- schedule: newSchedule,
- };
- }
- }
- }
-
- if (Object.keys(body).length === 0) {
- onClose();
- return;
- }
-
- updateMutation.mutate(
- { id: automation.id, body },
- {
- onSuccess: () => {
- displaySuccessToast(t(I18nKey.AUTOMATIONS$EDIT_SUCCESS));
- onClose();
- },
- onError: (error) => {
- displayErrorToast(
- getApiErrorMessage(error, t(I18nKey.AUTOMATIONS$EDIT_ERROR)),
- );
- },
- },
- );
- };
-
- // Stay open while a save is in flight: the save's error toast is the
- // dialog's own, and it is dropped if the dialog unmounts first.
- const dismiss = () => {
- if (!updateMutation.isPending) onClose();
- };
-
- return (
- <div className="fixed inset-0 z-50 flex items-center justify-center">
- <div
- className="absolute inset-0 bg-black/60"
- onClick={dismiss}
- onKeyDown={(e) => {
- if (e.key === "Escape") dismiss();
- }}
- role="presentation"
- />
- <div className="relative w-full max-w-md rounded-xl border border-border bg-surface p-6">
- <button
- type="button"
- onClick={dismiss}
- disabled={updateMutation.isPending}
- className="absolute right-4 top-4 text-muted hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50"
- aria-label={t(I18nKey.AUTOMATIONS$CANCEL)}
- >
- <XMarkIcon className="size-5" />
- </button>
-
- <h2 className={modalTitleLgMediumClassName}>{editTitle}</h2>
-
- <form
- onSubmit={handleSubmit}
- noValidate
- className="mt-4 flex flex-col gap-4"
- aria-label={editTitle}
- >
- {nameSpec.present && (
- <SettingsInput
- testId="edit-automation-name"
- name="name"
- type="text"
- label={nameSpec.label}
- value={form.name}
- onChange={(value) => setForm((f) => ({ ...f, name: value }))}
- error={nameError ?? undefined}
- showRequiredTag={nameSpec.required}
- />
- )}
-
- {promptSpec.present && (
- <label className="flex flex-col gap-2.5 w-full min-w-0">
- <span className="text-sm">{promptSpec.label}</span>
- <textarea
- data-testid="edit-automation-prompt"
- name="prompt"
- value={form.prompt}
- onChange={(e) =>
- setForm((f) => ({ ...f, prompt: e.target.value }))
- }
- rows={4}
- className={cn(
- formControlMultilineFieldClassName,
- "placeholder:italic",
- )}
- />
- {promptSpec.help !== null && (
- <span className="text-xs text-muted">{promptSpec.help}</span>
- )}
- </label>
- )}
-
- {capabilities?.features.includes("agentProfiles") && (
- <AutomationAgentProfileSelector
- value={form.agentProfileId}
- onChange={(agentProfileId) =>
- setForm((current) => ({ ...current, agentProfileId }))
- }
- />
- )}
- {!form.agentProfileId &&
- modelSpec.present &&
- (isLoadingProfiles || profiles.length > 0) && (
- <SettingsDropdownInput
- testId="edit-automation-model"
- name="model"
- label={modelSpec.label}
- items={modelItems}
- selectedKey={form.model || ACTIVE_PROFILE_KEY}
- isLoading={isLoadingProfiles}
- placeholder={t(I18nKey.COMMON$ACTIVE_PROFILE)}
- onSelectionChange={(key) =>
- setForm((f) => ({
- ...f,
- model: key && key !== ACTIVE_PROFILE_KEY ? String(key) : "",
- }))
- }
- />
- )}
-
- {timeoutSpec.present && (
- <div className="flex flex-col gap-2.5 w-full min-w-0">
- <SettingsInput
- testId="edit-automation-timeout"
- name="timeout"
- type="number"
- label={timeoutSpec.label}
- value={form.timeout}
- onChange={(value) => setForm((f) => ({ ...f, timeout: value }))}
- error={timeoutError ?? undefined}
- showOptionalTag
- min={timeoutSpec.min ?? 1}
- max={timeoutMax}
- step={1}
- placeholder={String(AUTOMATION_TIMEOUT_DEFAULT_SECONDS)}
- />
- {timeoutSpec.help !== null && (
- <span
- data-testid="edit-automation-timeout-hint"
- className="text-xs text-muted"
- >
- {timeoutSpec.help}
- </span>
- )}
- </div>
- )}
-
- {automation.trigger.type === "event" ? (
- <div className="flex flex-col gap-3 rounded-lg bg-surface-raised p-3">
- <div className="flex items-center gap-2">
- <span className="text-xs font-medium text-muted">
- {t(I18nKey.AUTOMATIONS$DETAIL$TRIGGER)}
- </span>
- <span className="text-sm text-content">
- {t(I18nKey.AUTOMATIONS$DETAIL$TRIGGER_EVENT)}
- </span>
- </div>
- {automation.trigger.source && (
- <div className="flex items-center gap-2">
- <span className="text-xs font-medium text-muted">
- {t(I18nKey.AUTOMATIONS$DETAIL$EVENT_SOURCE)}
- </span>
- <span className="text-sm text-content">
- {automation.trigger.source}
- </span>
- </div>
- )}
- {automation.trigger.on && (
- <div className="flex items-center gap-2">
- <span className="text-xs font-medium text-muted">
- {t(I18nKey.AUTOMATIONS$DETAIL$EVENT_TYPE)}
- </span>
- <code className="text-xs font-mono text-content">
- {formatEventOn(automation.trigger.on)}
- </code>
- </div>
- )}
- {automation.trigger.filter && (
- <div className="flex flex-col gap-1">
- <span className="text-xs font-medium text-muted">
- {t(I18nKey.AUTOMATIONS$DETAIL$EVENT_FILTER)}
- </span>
- <code className="text-xs font-mono text-content break-all">
- {automation.trigger.filter}
- </code>
- </div>
- )}
- </div>
- ) : scheduleSpec.present ? (
- <>
- <SettingsDropdownInput
- testId="edit-automation-frequency"
- name="frequency"
- label={scheduleSpec.label}
- items={frequencyItems}
- selectedKey={form.frequency}
- isDisabled={form.isCustomSchedule}
- onSelectionChange={(key) => {
- if (!key || form.isCustomSchedule) return;
- setForm((f) => ({ ...f, frequency: key as FrequencyKey }));
- }}
- />
-
- {form.frequency === "weekly" && !form.isCustomSchedule && (
- <SettingsDropdownInput
- testId="edit-automation-weekday"
- name="weekday"
- label={t(I18nKey.AUTOMATIONS$WEEKDAY)}
- items={weekdayItems}
- selectedKey={String(form.weekday)}
- onSelectionChange={(key) => {
- if (key === null) return;
- setForm((f) => ({ ...f, weekday: Number(key) }));
- }}
- />
- )}
-
- <label className="flex flex-col gap-2.5 w-full min-w-0">
- <span className="text-sm">
- {t(I18nKey.AUTOMATIONS$TIME_OF_DAY)}
- </span>
- <input
- data-testid="edit-automation-time"
- name="timeOfDay"
- type="time"
- value={form.timeOfDay}
- onChange={(e) =>
- setForm((f) => ({ ...f, timeOfDay: e.target.value }))
- }
- disabled={form.isCustomSchedule}
- className={cn(
- formControlSettingsFieldClassName,
- "disabled:bg-surface-raised",
- )}
- />
- {automation.timezone && (
- <span className="text-xs text-muted">
- {t(I18nKey.AUTOMATIONS$TIMEZONE)}: {automation.timezone}
- </span>
- )}
- </label>
-
- {form.isCustomSchedule && (
- <SettingsInput
- testId="edit-automation-cron"
- name="cron"
- type="text"
- label={t(I18nKey.AUTOMATIONS$CRON_EXPRESSION)}
- value={form.rawSchedule}
- onChange={(value) =>
- setForm((f) => ({ ...f, rawSchedule: value }))
- }
- error={scheduleError ?? undefined}
- placeholder={CRON_EXPRESSION_EXAMPLE}
- />
- )}
- </>
- ) : null}
-
- <div className="mt-2 flex justify-end gap-3">
- <BrandButton
- testId="edit-automation-cancel"
- type="button"
- variant="secondary"
- onClick={onClose}
- isDisabled={updateMutation.isPending}
- >
- {t(I18nKey.AUTOMATIONS$CANCEL)}
- </BrandButton>
- <BrandButton
- testId="edit-automation-save"
- type="submit"
- variant="primary"
- isDisabled={updateMutation.isPending}
- aria-busy={updateMutation.isPending}
- >
- {updateMutation.isPending
- ? t(I18nKey.AUTOMATIONS$SAVING)
- : t(I18nKey.AUTOMATIONS$SAVE)}
- </BrandButton>
- </div>
- </form>
- </div>
- </div>
- );
-}
diff --git a/src/components/features/chat/custom-chat-input.tsx b/src/components/features/chat/custom-chat-input.tsx
index 400700ecbe..3888c0a710 100644
--- a/src/components/features/chat/custom-chat-input.tsx
+++ b/src/components/features/chat/custom-chat-input.tsx
@@ -81,13 +81,8 @@ export function CustomChatInput({
}, [submittedMessage, disabled, setSubmittedMessage]);
// Custom hooks
- const {
- chatInputRef,
- messageToSend,
- checkIsContentEmpty,
- clearEmptyContentHandler,
- saveDraft,
- } = useChatInputLogic();
+ const { chatInputRef, messageToSend, checkIsContentEmpty, saveDraft } =
+ useChatInputLogic();
const syncCanSubmit = React.useCallback(() => {
const text = chatInputRef.current?.innerText ?? "";
@@ -140,7 +135,6 @@ export function CustomChatInput({
smartResize,
increaseHeightForEmptyContent,
checkIsContentEmpty,
- clearEmptyContentHandler,
onFocus,
onBlur,
);
diff --git a/src/components/features/chat/utils/chat-input.utils.ts b/src/components/features/chat/utils/chat-input.utils.ts
index b591875082..3020e00cdf 100644
--- a/src/components/features/chat/utils/chat-input.utils.ts
+++ b/src/components/features/chat/utils/chat-input.utils.ts
@@ -32,13 +32,6 @@ export function normalizePastedFile(file: File): File {
});
}
-/** Matches names assigned by {@link normalizePastedFile} for clipboard screenshots. */
-export const PASTED_CLIPBOARD_IMAGE_NAME = /^pasted-image-\d+\.[a-z0-9]+$/i;
-
-export function isPastedClipboardImage(file: File): boolean {
- return PASTED_CLIPBOARD_IMAGE_NAME.test(file.name);
-}
-
export function partitionImagesForUpload(
images: File[],
markedUploadAsFileNames: readonly string[],
diff --git a/src/components/features/command-menu/index.ts b/src/components/features/command-menu/index.ts
deleted file mode 100644
index 18cfdad17a..0000000000
--- a/src/components/features/command-menu/index.ts
+++ /dev/null
@@ -1,2 +0,0 @@
-export { CommandMenu } from "./command-menu";
-export { CommandMenuTrigger } from "./command-menu-trigger";
diff --git a/src/components/features/conversation/conversation-overview-panel.constants.ts b/src/components/features/conversation/conversation-overview-panel.constants.ts
index b153006fcc..a8e643ad8c 100644
--- a/src/components/features/conversation/conversation-overview-panel.constants.ts
+++ b/src/components/features/conversation/conversation-overview-panel.constants.ts
@@ -1,7 +1,3 @@
-export const CONVERSATION_OVERVIEW_AUTOMATIONS_PATH = "/automations";
-export const CONVERSATION_OVERVIEW_SKILLS_PATH = "/skills";
-export const CONVERSATION_OVERVIEW_MCP_PATH = "/mcp";
-
export const CONVERSATION_OVERVIEW_PANEL_WIDTH_PX = 240;
export const CONVERSATION_OVERVIEW_COLUMN_MIN_GAP_PX = 8;
/** Horizontal padding on the overview column (`pl-3` + `pr-4`). */
@@ -30,25 +26,3 @@ export function hasEnoughOverviewLayoutSpace(containerWidth: number): boolean {
CONVERSATION_OVERVIEW_MIN_THREAD_WIDTH_PX
);
}
-
-export const CONVERSATION_OVERVIEW_ADD_QUERY_PARAM = "add";
-export const CONVERSATION_OVERVIEW_ADD_QUERY_VALUE = "1";
-
-export const CONVERSATION_OVERVIEW_AUTOMATIONS_ADD_PATH =
- "/automations/dashboard?add=1";
-export const CONVERSATION_OVERVIEW_SKILLS_ADD_PATH = "/skills?add=1";
-export const CONVERSATION_OVERVIEW_MCP_ADD_PATH = "/mcp?add=1";
-
-export function buildConversationOverviewAddPath(path: string): string {
- const separator = path.includes("?") ? "&" : "?";
- return `${path}${separator}${CONVERSATION_OVERVIEW_ADD_QUERY_PARAM}=${CONVERSATION_OVERVIEW_ADD_QUERY_VALUE}`;
-}
-
-export function hasConversationOverviewAddIntent(search: string): boolean {
- const normalized = search.startsWith("?") ? search.slice(1) : search;
- const params = new URLSearchParams(normalized);
- return (
- params.get(CONVERSATION_OVERVIEW_ADD_QUERY_PARAM) ===
- CONVERSATION_OVERVIEW_ADD_QUERY_VALUE
- );
-}
diff --git a/src/components/features/diff-viewer/empty-changes-message.tsx b/src/components/features/diff-viewer/empty-changes-message.tsx
deleted file mode 100644
index 1af6d17c8c..0000000000
--- a/src/components/features/diff-viewer/empty-changes-message.tsx
+++ /dev/null
@@ -1,14 +0,0 @@
-import { useTranslation } from "react-i18next";
-import { I18nKey } from "#/i18n/declaration";
-import { ConversationTabEmptyState } from "#/components/features/conversation/conversation-tab-empty-state";
-import { DiffDrawerIcon } from "./diff-drawer-icon";
-
-export function EmptyChangesMessage() {
- const { t } = useTranslation("openhands");
-
- return (
- <ConversationTabEmptyState icon={<DiffDrawerIcon />}>
- {t(I18nKey.DIFF_VIEWER$NO_CHANGES)}
- </ConversationTabEmptyState>
- );
-}
diff --git a/src/components/features/home/featured-automations/automation-run-health.ts b/src/components/features/home/featured-automations/automation-run-health.ts
index 15b6abbd0b..eee562d195 100644
--- a/src/components/features/home/featured-automations/automation-run-health.ts
+++ b/src/components/features/home/featured-automations/automation-run-health.ts
@@ -131,10 +131,6 @@ export function shouldShowAutomationRunSummaryHovercard(
return summary.trim().replace(/\s+/g, " ") !== shortSummary;
}
-export const shortenAutomationErrorDetail = shortenAutomationRunSummary;
-export const shouldShowAutomationErrorHovercard =
- shouldShowAutomationRunSummaryHovercard;
-
/**
* Timestamp to show as the run's "last run" moment, or null when the run
* has no usable timestamp yet. The backend leaves started_at unset
diff --git a/src/components/features/sidebar/sidebar-layout.ts b/src/components/features/sidebar/sidebar-layout.ts
index b1bd4d0649..1e24be7a48 100644
--- a/src/components/features/sidebar/sidebar-layout.ts
+++ b/src/components/features/sidebar/sidebar-layout.ts
@@ -12,9 +12,6 @@ export const SIDEBAR_ICON_SLOT_CLASS =
export const SIDEBAR_COLLAPSED_ICON_SLOT_CLASS =
"relative h-9 min-h-9 max-h-9 w-full shrink-0";
-export const SIDEBAR_HEADER_ROW_CLASS =
- "flex h-10 min-h-10 shrink-0 items-center gap-2 pl-2.5 pr-2.5 w-full";
-
export function sidebarHeaderRowClassName(collapsed: boolean): string {
return cn(
"flex h-10 min-h-10 shrink-0 items-center w-full",
diff --git a/src/components/features/skills/skill-type-badge.tsx b/src/components/features/skills/skill-type-badge.tsx
index 21812ebf9d..79c6bb1429 100644
--- a/src/components/features/skills/skill-type-badge.tsx
+++ b/src/components/features/skills/skill-type-badge.tsx
@@ -22,10 +22,6 @@ const TYPE_CONFIG: Record<SkillType, { labelKey: I18nKey }> = {
},
};
-export function getSkillTypeLabelKey(type: SkillType): I18nKey {
- return TYPE_CONFIG[type].labelKey;
-}
-
export function SkillTypeBadge({ type }: SkillTypeBadgeProps) {
const { t } = useTranslation("openhands");
const config = TYPE_CONFIG[type];
diff --git a/src/fixtures/home-automations-demo.ts b/src/fixtures/home-automations-demo.ts
index 9ad98cb36e..59cd33c7e1 100644
--- a/src/fixtures/home-automations-demo.ts
+++ b/src/fixtures/home-automations-demo.ts
@@ -34,8 +34,6 @@ const DEMO_HISTORY_PATTERN: AutomationRunStatus[] = [
*/
export const HOME_AUTOMATIONS_FORCE_DEMO = false;
-export const HOME_AUTOMATIONS_DEMO_KEY = "oh:home-automations-demo";
-
export function isHomeAutomationsDemoEnabled(): boolean {
if (HOME_AUTOMATIONS_FORCE_DEMO) return true;
return import.meta.env.VITE_HOME_AUTOMATIONS_DEMO === "true";
diff --git a/src/hooks/chat/use-chat-input-events.ts b/src/hooks/chat/use-chat-input-events.ts
index b9dde91024..8b1ce4de60 100644
--- a/src/hooks/chat/use-chat-input-events.ts
+++ b/src/hooks/chat/use-chat-input-events.ts
@@ -14,7 +14,6 @@ export const useChatInputEvents = (
smartResize: () => void,
increaseHeightForEmptyContent: () => void,
checkIsContentEmpty: () => boolean,
- clearEmptyContentHandler: () => void,
onFocus?: () => void,
onBlur?: () => void,
) => {
diff --git a/src/hooks/chat/use-chat-input-logic.ts b/src/hooks/chat/use-chat-input-logic.ts
index 77b25f9f52..e32b4e8abc 100644
--- a/src/hooks/chat/use-chat-input-logic.ts
+++ b/src/hooks/chat/use-chat-input-logic.ts
@@ -1,7 +1,6 @@
import { useRef, useCallback, useEffect } from "react";
import {
isContentEmpty,
- clearEmptyContent,
getTextContent,
} from "#/components/features/chat/utils/chat-input.utils";
import {
@@ -97,11 +96,6 @@ export const useChatInputLogic = () => {
[],
);
- // Helper function to properly clear contentEditable for placeholder display
- const clearEmptyContentHandler = useCallback((): void => {
- clearEmptyContent(chatInputRef.current);
- }, []);
-
// Get current message text
const getCurrentMessage = useCallback(
(): string => getTextContent(chatInputRef.current),
@@ -112,7 +106,6 @@ export const useChatInputLogic = () => {
chatInputRef,
messageToSend,
checkIsContentEmpty,
- clearEmptyContentHandler,
getCurrentMessage,
saveDraft,
clearDraft,
diff --git a/src/hooks/query/query-keys.ts b/src/hooks/query/query-keys.ts
index 2015c8c221..375e05c1b4 100644
--- a/src/hooks/query/query-keys.ts
+++ b/src/hooks/query/query-keys.ts
@@ -142,5 +142,3 @@ export const CONFIG_CACHE_OPTIONS = {
staleTime: 1000 * 60 * 5, // 5 minutes
gcTime: 1000 * 60 * 15, // 15 minutes
} as const;
-
-export type QueryKeys = (typeof QUERY_KEYS)[keyof typeof QUERY_KEYS];
diff --git a/src/hooks/query/use-automations.ts b/src/hooks/query/use-automations.ts
index b363fd9f5e..707942c21d 100644
--- a/src/hooks/query/use-automations.ts
+++ b/src/hooks/query/use-automations.ts
@@ -12,7 +12,6 @@ import { useActiveBackend } from "#/contexts/active-backend-context";
import { useTracking } from "#/hooks/use-tracking";
import { uniqueById } from "#/utils/unique-by-id";
import type {
- Automation,
AutomationCreatedByFilter,
AutomationSpec,
AutomationsResponse,
@@ -213,23 +212,6 @@ export function useImportAutomation() {
});
}
-export function useUpdateAutomation() {
- const queryClient = useQueryClient();
- const active = useActiveBackend();
- const { trackAutomationEdited } = useTracking();
- return useMutation({
- mutationFn: ({ id, body }: { id: string; body: Partial<Automation> }) =>
- AutomationService.updateAutomation(id, body),
- // Callers toast the API message themselves; skip the generic global toast.
- meta: { disableToast: true },
- onSuccess: () => {
- queryClient.invalidateQueries({ queryKey: AUTOMATIONS_QUERY_KEY });
- queryClient.invalidateQueries({ queryKey: AUTOMATION_DETAIL_QUERY_KEY });
- trackAutomationEdited({ backendKind: active.backend.kind });
- },
- });
-}
-
export function useDeleteAutomation() {
const queryClient = useQueryClient();
const active = useActiveBackend();
diff --git a/src/hooks/query/use-has-git-commits.ts b/src/hooks/query/use-has-git-commits.ts
deleted file mode 100644
index 9bd45ffa66..0000000000
--- a/src/hooks/query/use-has-git-commits.ts
+++ /dev/null
@@ -1,87 +0,0 @@
-import { useQuery } from "@tanstack/react-query";
-
-import AgentServerRuntimeService from "#/api/runtime-service/agent-server-runtime-service";
-import { useActiveBackend } from "#/contexts/active-backend-context";
-import { useActiveConversation } from "#/hooks/query/use-active-conversation";
-import { useRuntimeIsReady } from "#/hooks/use-runtime-is-ready";
-
-/**
- * Probes whether the conversation's working-directory git repository has
- * at least one commit reachable from HEAD.
- *
- * Local-only by design: we deliberately avoid driving
- * `/api/bash/execute_bash_command` from the frontend on cloud backends.
- * On cloud, `hasCommits` stays `null` and the Files tab keeps its
- * optimistic diff-view default β€” fine in practice since cloud
- * conversations almost always have an attached repo with commits.
- *
- * Used by the Files tab to decide whether the diff view is a sensible
- * default: an attached source (repo or local workspace) with no commits
- * β€” e.g. a brand-new empty GitHub repo, a freshly `git init`-ed
- * workspace, or a plain non-git workspace β€” has no diff base to compare
- * against, so the file viewer is a better landing experience.
- *
- * Returns `hasCommits: null` while the probe is in-flight so callers can
- * distinguish "still loading" from a definitive "no commits".
- */
-export function useHasGitCommits(options?: { enabled?: boolean }): {
- hasCommits: boolean | null;
- isLoading: boolean;
-} {
- const { data: conversation } = useActiveConversation();
- const runtimeIsReady = useRuntimeIsReady();
- const { backend } = useActiveBackend();
- const isLocalBackend = backend.kind === "local";
-
- const conversationId = conversation?.id;
- const conversationUrl = conversation?.conversation_url;
- const sessionApiKey = conversation?.session_api_key;
- const workingDir = conversation?.workspace?.working_dir?.trim();
-
- const enabled =
- (options?.enabled ?? true) &&
- isLocalBackend &&
- runtimeIsReady &&
- !!conversationId &&
- !!workingDir;
-
- const query = useQuery<boolean>({
- queryKey: [
- "has-git-commits",
- conversationId,
- conversationUrl,
- sessionApiKey,
- workingDir,
- ],
- queryFn: async () => {
- // `git rev-parse --verify HEAD` exits 0 iff HEAD resolves to a
- // real commit. Returns non-zero in three cases that all collapse
- // to "no diff base, show files view":
- // - unborn branch (`git init` with no commits)
- // - not a git repository at all (plain workspace directory)
- // - other git error
- // Callers gate this hook on the user having attached a source
- // (see `useHasAttachedSource`) so we don't shell out for the
- // unattached-conversation case where the answer is moot.
- const result = await AgentServerRuntimeService.executeCommand(
- conversationUrl,
- sessionApiKey,
- "git rev-parse --verify HEAD",
- workingDir,
- 10,
- conversationId,
- );
- return result.exit_code === 0;
- },
- enabled,
- retry: false,
- staleTime: 60_000,
- gcTime: 5 * 60_000,
- meta: { disableToast: true },
- });
-
- return {
- hasCommits: query.data ?? null,
- isLoading: query.isLoading,
- };
-}
diff --git a/src/hooks/use-conversation-overview-add-intent.ts b/src/hooks/use-conversation-overview-add-intent.ts
deleted file mode 100644
index 11bd8d48a6..0000000000
--- a/src/hooks/use-conversation-overview-add-intent.ts
+++ /dev/null
@@ -1,28 +0,0 @@
-import { useEffect, useRef } from "react";
-import { useSearchParams } from "react-router";
-import {
- CONVERSATION_OVERVIEW_ADD_QUERY_PARAM,
- hasConversationOverviewAddIntent,
-} from "#/components/features/conversation/conversation-overview-panel.constants";
-
-export function useConversationOverviewAddIntent(onOpen: () => void): void {
- const [searchParams, setSearchParams] = useSearchParams();
- const onOpenRef = useRef(onOpen);
-
- useEffect(() => {
- onOpenRef.current = onOpen;
- }, [onOpen]);
-
- useEffect(() => {
- const search = searchParams.toString();
- if (!hasConversationOverviewAddIntent(search)) {
- return;
- }
-
- onOpenRef.current();
-
- const nextParams = new URLSearchParams(searchParams);
- nextParams.delete(CONVERSATION_OVERVIEW_ADD_QUERY_PARAM);
- setSearchParams(nextParams, { replace: true });
- }, [searchParams, setSearchParams]);
-}
diff --git a/src/hooks/use-has-attached-source.ts b/src/hooks/use-has-attached-source.ts
deleted file mode 100644
index 0c7b002a08..0000000000
--- a/src/hooks/use-has-attached-source.ts
+++ /dev/null
@@ -1,32 +0,0 @@
-import { getStoredConversationMetadata } from "#/api/conversation-metadata-store";
-import { useActiveConversation } from "#/hooks/query/use-active-conversation";
-
-/**
- * Returns whether the user explicitly attached a "source" to the active
- * conversation β€” i.e. picked a repository on the home page *or* picked a
- * local workspace folder. From the Files tab's point of view those two
- * cases are equivalent: both mean there's an existing working tree the
- * user came in to inspect, so the diff view is the more useful default.
- *
- * We deliberately do *not* probe the filesystem here β€” the agent-server
- * can initialise conversations without an explicit selection in generated git
- * worktrees, so a positive `git status` does not by itself imply the user
- * attached a real source. That's why we read the explicit selection signals
- * (`selected_repository` on the conversation, `selected_workspace` from the
- * conversation-metadata store) instead.
- */
-export function useHasAttachedSource(): {
- hasAttachedSource: boolean;
- isLoading: boolean;
-} {
- const { data: conversation, isLoading } = useActiveConversation();
- const storedMetadata = conversation?.id
- ? getStoredConversationMetadata(conversation.id)
- : null;
- return {
- hasAttachedSource:
- !!conversation?.selected_repository ||
- !!storedMetadata?.selected_workspace,
- isLoading,
- };
-}
diff --git a/src/manifests/automation-insights.ts b/src/manifests/automation-insights.ts
index 870a1c1f29..8733d0ccea 100644
--- a/src/manifests/automation-insights.ts
+++ b/src/manifests/automation-insights.ts
@@ -26,7 +26,6 @@ import type {
DashboardSortValue,
DashboardStatusValue,
DashboardTriggerValue,
- InterfaceListInsights,
OverviewMetric,
} from "./types";
@@ -38,19 +37,6 @@ export type AutomationHealth =
| "never-run"
| "unknown";
-/** Which caption of the manifest's `insights.health` block names each state. */
-export const HEALTH_LABEL_KEYS: Record<
- AutomationHealth,
- keyof InterfaceListInsights["health"]
-> = {
- healthy: "healthy",
- failing: "failing",
- running: "running",
- disabled: "disabled",
- "never-run": "neverRun",
- unknown: "checking",
-};
-
export interface AutomationRunSummary {
/** Lifetime run count, from the response β€” not the sample's length. */
total: number;
diff --git a/src/manifests/automation-interface.ts b/src/manifests/automation-interface.ts
index 18b04ab70e..a349fa7cab 100644
--- a/src/manifests/automation-interface.ts
+++ b/src/manifests/automation-interface.ts
@@ -20,7 +20,6 @@ import { AUTOMATION_CATALOG } from "@openhands/extensions/automations";
import { validateInterfaceManifest } from "./interface-validation";
import { AUTOMATION_INTERFACE_CANDIDATE } from "./manifest-sources";
import type {
- AutomationAttributeName,
InterfaceDashboardFilter,
InterfaceDashboardSort,
InterfaceEndpointName,
@@ -178,39 +177,6 @@ export function getInterfaceCopy(): InterfaceCopy {
};
}
-export interface AttributeSpec {
- present: boolean;
- label: string;
- /** Null when the manifest states no help text for the attribute. */
- help: string | null;
- required: boolean;
- min: number | null;
- max: number | null;
-}
-
-/** An attribute the manifest does not declare is not offered at all. */
-const ABSENT_ATTRIBUTE: AttributeSpec = {
- present: false,
- label: "",
- help: null,
- required: false,
- min: null,
- max: null,
-};
-
-export function getAttributeSpec(name: AutomationAttributeName): AttributeSpec {
- const attribute = requireInterface().attributes[name];
- if (!attribute) return ABSENT_ATTRIBUTE;
- return {
- present: true,
- label: attribute.label,
- help: attribute.help ?? null,
- required: attribute.required,
- min: attribute.constraints?.min ?? null,
- max: attribute.constraints?.max ?? null,
- };
-}
-
export function getImportExportSpec(): InterfaceImportExport {
return requireInterface().importExport;
}
diff --git a/src/manifests/types.ts b/src/manifests/types.ts
index f18fc8aa2d..e15919fb03 100644
--- a/src/manifests/types.ts
+++ b/src/manifests/types.ts
@@ -155,11 +155,6 @@ export interface SetupActions {
upload?: SetupUploadAction;
}
-export type SetupAction =
- | SetupPromptAction
- | SetupPluginAction
- | SetupUploadAction;
-
export interface SetupBlock {
version: typeof SETUP_VERSION;
mode: SetupMode;
diff --git a/src/mocks/settings-handlers.ts b/src/mocks/settings-handlers.ts
index b17ea5aba3..4a31c6a16e 100644
--- a/src/mocks/settings-handlers.ts
+++ b/src/mocks/settings-handlers.ts
@@ -47,23 +47,6 @@ const DEFAULT_MODEL =
? llmDefaults.model
: "openhands/claude-opus-4-5-20251101";
-export const createMockWebClientConfig = (
- overrides: Partial<WebClientConfig> = {},
-): WebClientConfig => ({
- feature_flags: {
- hide_llm_settings: false,
- hide_users_page: false,
- ...overrides.feature_flags,
- },
- providers_configured: [],
- maintenance_start_time: null,
- recaptcha_site_key: null,
- faulty_models: [],
- error_message: null,
- updated_at: new Date().toISOString(),
- ...overrides,
-});
-
const MOCK_AGENT_SETTINGS_SCHEMA: NonNullable<
Settings["agent_settings_schema"]
> = {
diff --git a/src/services/settings.ts b/src/services/settings.ts
index 4236abc369..ef2f9e9031 100644
--- a/src/services/settings.ts
+++ b/src/services/settings.ts
@@ -1,7 +1,5 @@
import { Settings } from "#/types/settings";
-export const LATEST_SETTINGS_VERSION = 5;
-
export const DEFAULT_SETTINGS: Settings = {
llm_model: "openai/gpt-5.6-sol",
llm_base_url: "",
@@ -57,8 +55,3 @@ export const DEFAULT_SETTINGS: Settings = {
security_analyzer: "llm",
},
};
-
-/**
- * Get the default settings
- */
-export const getDefaultSettings = (): Settings => DEFAULT_SETTINGS;
diff --git a/src/services/telemetry.ts b/src/services/telemetry.ts
index 6085ff843f..9cf5807aec 100644
--- a/src/services/telemetry.ts
+++ b/src/services/telemetry.ts
@@ -901,17 +901,6 @@ export async function trackEvent(
posthog.capture(eventName, properties);
}
-/** Track an exception through the same consent-aware client as custom events. */
-export async function trackException(
- error: unknown,
- properties: Record<string, unknown> = {},
-): Promise<void> {
- const posthog = await getPostHogForConsentedCapture();
- if (!posthog) return;
-
- posthog.captureException(error, properties);
-}
-
/**
* Clear all telemetry data (for privacy/GDPR requests)
*/
diff --git a/src/types/mcp-auth.ts b/src/types/mcp-auth.ts
index f8c6333041..f8f841cd33 100644
--- a/src/types/mcp-auth.ts
+++ b/src/types/mcp-auth.ts
@@ -10,7 +10,6 @@ export type {
} from "@openhands/typescript-client";
export type MCPAuthenticationConfig = MCPOAuthAuthentication;
-export type MCPOAuthAuthenticationConfig = MCPOAuthAuthentication;
export type MCPOAuthClientAuthMethod = NonNullable<
MCPOAuthAuthentication["client_auth_method"]
>;
diff --git a/src/types/settings.ts b/src/types/settings.ts
index 15e21ef337..d2128a5656 100644
--- a/src/types/settings.ts
+++ b/src/types/settings.ts
@@ -14,11 +14,6 @@ export const ProviderOptions = {
export type Provider = keyof typeof ProviderOptions;
-export type ProviderToken = {
- token: string;
- host: string | null;
-};
-
export type SettingsChoiceValue = boolean | number | string;
export type SettingsChoice = {
diff --git a/src/utils/automation-draft-tags.ts b/src/utils/automation-draft-tags.ts
index d17e766de3..10e717fe1b 100644
--- a/src/utils/automation-draft-tags.ts
+++ b/src/utils/automation-draft-tags.ts
@@ -13,13 +13,6 @@ export function getAutomationDraftIdFromTags(
return draftId || null;
}
-export function getAutomationMaterializedDraftIdFromTags(
- tags: Record<string, string> | null | undefined,
-): string | null {
- const draftId = tags?.[AUTOMATION_MATERIALIZED_DRAFT_ID_TAG_KEY]?.trim();
- return draftId || null;
-}
-
export function getAutomationEditIdFromTags(
tags: Record<string, string> | null | undefined,
): string | null {
diff --git a/src/utils/automation-schedule.ts b/src/utils/automation-schedule.ts
index 8186a663cd..174ffe3801 100644
--- a/src/utils/automation-schedule.ts
+++ b/src/utils/automation-schedule.ts
@@ -66,203 +66,18 @@ export function parseCronSchedule(
return { kind: "custom", raw, hour, minute };
}
-export function buildCronSchedule(input: PresetSchedule): string {
- const { kind, hour, minute, weekday } = input;
- switch (kind) {
- case "daily":
- return `${minute} ${hour} * * *`;
- case "weekdays":
- return `${minute} ${hour} * * 1-5`;
- case "weekly":
- return `${minute} ${hour} * * ${weekday ?? 1}`;
- default: {
- const _exhaustive: never = kind;
- return _exhaustive;
- }
- }
-}
-
export function formatTimeOfDay(hour: number, minute: number): string {
const hh = String(hour).padStart(2, "0");
const mm = String(minute).padStart(2, "0");
return `${hh}:${mm}`;
}
-export function parseTimeOfDay(
- value: string,
-): { hour: number; minute: number } | null {
- const match = value.match(/^(\d{1,2}):(\d{2})$/);
- if (!match) return null;
- const hour = Number(match[1]);
- const minute = Number(match[2]);
- if (
- Number.isNaN(hour) ||
- Number.isNaN(minute) ||
- hour < 0 ||
- hour > 23 ||
- minute < 0 ||
- minute > 59
- ) {
- return null;
- }
- return { hour, minute };
-}
-
export function formatEventOn(on: string | string[] | undefined): string {
if (!on) return "β€”";
if (Array.isArray(on)) return on.join(", ");
return on;
}
-/** Example expression shown when the cron field is empty. */
-export const CRON_EXPRESSION_EXAMPLE = "*/10 * * * *";
-
-// The service validates with croniter, so this must accept everything croniter
-// does: five fields, optionally plus seconds and then year, or an alias.
-const CRON_ALIASES = new Set([
- "@yearly",
- "@annually",
- "@monthly",
- "@weekly",
- "@daily",
- "@midnight",
- "@hourly",
-]);
-
-const CRON_MIN_FIELDS = 5;
-const CRON_MAX_FIELDS = 7;
-
-// Seconds and year are appended after these, so the positions always hold.
-const CRON_FIELD_BOUNDS: readonly (readonly [number, number])[] = [
- [0, 59], // minute
- [0, 23], // hour
- [1, 31], // day of month
- [1, 12], // month
- [0, 7], // day of week β€” croniter spells Sunday 0 and 7
-];
-
-const DAY_OF_MONTH_INDEX = 2;
-const MONTH_INDEX = 3;
-
-// Indexed from 1. February is 29: the 29th does fire, in leap years.
-const MAX_DAYS_IN_MONTH = [0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
-
-const MONTH_NAMES = "JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC";
-const DAY_NAMES = "SUN|MON|TUE|WED|THU|FRI|SAT";
-
-// croniter does not bound the step: `*/90` is accepted.
-const NUMERIC_TERM = /^(\*|\d+(?:-\d+)?)(?:\/(\d+))?$/;
-
-/** Vocabulary beyond plain numbers, matched but not expanded. */
-const EXTRA_TERM_PATTERNS: readonly (RegExp | null)[] = [
- null, // minute
- null, // hour
- /^(?:\?|L|\d+W)$/i, // `?`, `L`, `15W`
- new RegExp(`^(?:${MONTH_NAMES})(?:-(?:${MONTH_NAMES}))?(?:/\\d+)?$`, "i"),
- // `SUN`, `MON-FRI#2`, `5#3`, `?` β€” but no `L`, which croniter rejects here.
- new RegExp(
- `^(?:(?:${DAY_NAMES}|\\d+)(?:-(?:${DAY_NAMES}|\\d+))?(?:/\\d+)?(?:#\\d+)?|\\?)$`,
- "i",
- ),
-];
-
-type CronFieldParse =
- | { kind: "invalid" }
- /** Well-formed, but not expanded, so it constrains nothing. */
- | { kind: "unmodelled" }
- | { kind: "values"; values: number[] };
-
-function parseCronField(
- field: string,
- [min, max]: readonly [number, number],
- extraPattern: RegExp | null,
-): CronFieldParse {
- const values = new Set<number>();
-
- for (const term of field.split(",")) {
- const match = term.match(NUMERIC_TERM);
- if (!match) {
- if (extraPattern?.test(term)) return { kind: "unmodelled" };
- return { kind: "invalid" };
- }
-
- const [, rangePart, stepPart] = match;
- const step = stepPart === undefined ? 1 : Number(stepPart);
- if (step < 1) return { kind: "invalid" };
-
- if (rangePart === "*") {
- for (let value = min; value <= max; value += step) values.add(value);
- continue;
- }
-
- const [startPart, endPart] = rangePart.split("-");
- const start = parseSingleInt(startPart, min, max);
- if (start === null) return { kind: "invalid" };
- if (endPart === undefined) {
- if (stepPart === undefined) {
- values.add(start);
- continue;
- }
- // croniter reads `n/m` as `n-max/m`: step from the start value up to the
- // field maximum, not a single hit at the start.
- for (let value = start; value <= max; value += step) values.add(value);
- continue;
- }
- const end = parseSingleInt(endPart, min, max);
- if (end === null) return { kind: "invalid" };
- // croniter wraps a reversed range like `5-1`; that wrap is not modelled.
- if (end < start) return { kind: "unmodelled" };
- for (let value = start; value <= end; value += step) values.add(value);
- }
-
- return { kind: "values", values: [...values] };
-}
-
export type CronScheduleValidation =
| { schedule: string }
| { errorKey: I18nKey };
-
-/**
- * Validate a raw cron expression from the edit form β€” `parseCronSchedule` only
- * classifies against the presets, reporting arbitrary text as `custom`.
- *
- * One-sided by design: rejects only what croniter certainly rejects, and defers
- * on anything it does not model.
- */
-export function validateCronSchedule(raw: string): CronScheduleValidation {
- const schedule = raw.trim();
- if (!schedule) return { errorKey: I18nKey.AUTOMATIONS$ERROR_CRON_INVALID };
-
- if (schedule.startsWith("@")) {
- return CRON_ALIASES.has(schedule.toLowerCase())
- ? { schedule }
- : { errorKey: I18nKey.AUTOMATIONS$ERROR_CRON_INVALID };
- }
-
- const fields = schedule.split(/\s+/);
- if (fields.length < CRON_MIN_FIELDS || fields.length > CRON_MAX_FIELDS) {
- return { errorKey: I18nKey.AUTOMATIONS$ERROR_CRON_INVALID };
- }
-
- const parsed = CRON_FIELD_BOUNDS.map((bounds, index) =>
- parseCronField(fields[index], bounds, EXTRA_TERM_PATTERNS[index]),
- );
- if (parsed.some((field) => field.kind === "invalid")) {
- return { errorKey: I18nKey.AUTOMATIONS$ERROR_CRON_INVALID };
- }
-
- // croniter parses `0 0 31 2 *` and then finds no fire time for it.
- const days = parsed[DAY_OF_MONTH_INDEX];
- const months = parsed[MONTH_INDEX];
- if (
- days.kind === "values" &&
- months.kind === "values" &&
- !months.values.some((month) =>
- days.values.some((day) => day <= MAX_DAYS_IN_MONTH[month]),
- )
- ) {
- return { errorKey: I18nKey.AUTOMATIONS$ERROR_CRON_UNREACHABLE };
- }
-
- return { schedule };
-}
diff --git a/src/utils/automation-timeout.ts b/src/utils/automation-timeout.ts
deleted file mode 100644
index 8fd5f7548d..0000000000
--- a/src/utils/automation-timeout.ts
+++ /dev/null
@@ -1,37 +0,0 @@
-import { I18nKey } from "#/i18n/declaration";
-
-/**
- * Per-automation run timeout defaults. The deployment reports the maximum it
- * enforces through capability discovery.
- */
-export const AUTOMATION_TIMEOUT_DEFAULT_SECONDS = 600; // 10 minutes
-
-export type AutomationTimeoutValidation =
- | { value: number | null }
- | { errorKey: I18nKey };
-
-/**
- * Validate a raw timeout string from the edit form. A blank string means "use
- * the server default" (resolved as `null`). Otherwise the value must be a
- * positive integer. When capability discovery supplies a ceiling, values above
- * it are rejected before the request reaches the service.
- */
-export function validateAutomationTimeout(
- raw: string,
- maxSeconds?: number,
-): AutomationTimeoutValidation {
- const trimmed = raw.trim();
- if (!trimmed) return { value: null };
-
- const seconds = Number(trimmed);
- if (!Number.isInteger(seconds)) {
- return { errorKey: I18nKey.AUTOMATIONS$ERROR_TIMEOUT_INVALID_NUMBER };
- }
- if (seconds <= 0) {
- return { errorKey: I18nKey.AUTOMATIONS$ERROR_TIMEOUT_POSITIVE };
- }
- if (maxSeconds !== undefined && seconds > maxSeconds) {
- return { errorKey: I18nKey.AUTOMATIONS$ERROR_TIMEOUT_MAX_EXCEEDED };
- }
- return { value: seconds };
-}
diff --git a/src/utils/conversation-overview-project-scope.ts b/src/utils/conversation-overview-project-scope.ts
index d0a1aa8205..3478a4a27d 100644
--- a/src/utils/conversation-overview-project-scope.ts
+++ b/src/utils/conversation-overview-project-scope.ts
@@ -1,4 +1,3 @@
-import type { Automation } from "#/types/automation";
import type { SkillInfo } from "#/types/settings";
import {
getSkillScope,
@@ -14,30 +13,6 @@ export const CONVERSATION_OVERVIEW_PROJECT_SCOPE = {
export type ConversationOverviewProjectScope =
(typeof CONVERSATION_OVERVIEW_PROJECT_SCOPE)[keyof typeof CONVERSATION_OVERVIEW_PROJECT_SCOPE];
-export function normalizeRepositoryName(
- repository: string | null | undefined,
-): string | null {
- if (!repository?.trim()) {
- return null;
- }
- return repository
- .trim()
- .toLowerCase()
- .replace(/\.git$/, "");
-}
-
-export function isAutomationForRepository(
- automation: Pick<Automation, "repository">,
- repository: string | null | undefined,
-): boolean {
- const target = normalizeRepositoryName(repository);
- const automationRepo = normalizeRepositoryName(automation.repository);
- if (!target || !automationRepo) {
- return false;
- }
- return automationRepo === target;
-}
-
export function isSkillForProject(
skill: SkillInfo,
projectDir?: string | null,
@@ -45,19 +20,6 @@ export function isSkillForProject(
return getSkillScope(skill, projectDir) === "project";
}
-export function filterAutomationsByProjectScope(
- automations: Automation[],
- scope: ConversationOverviewProjectScope,
- repository: string | null | undefined,
-): Automation[] {
- if (scope === CONVERSATION_OVERVIEW_PROJECT_SCOPE.all) {
- return automations;
- }
- return automations.filter((automation) =>
- isAutomationForRepository(automation, repository),
- );
-}
-
export function filterSkillsByProjectScope(
skills: SkillInfo[],
scope: ConversationOverviewProjectScope,
@@ -69,20 +31,6 @@ export function filterSkillsByProjectScope(
return skills.filter((skill) => isSkillForProject(skill, projectDir));
}
-export function sortAutomationsByProjectRelevance(
- automations: Automation[],
- repository: string | null | undefined,
-): Automation[] {
- return [...automations].sort((left, right) => {
- const leftMatch = isAutomationForRepository(left, repository) ? 0 : 1;
- const rightMatch = isAutomationForRepository(right, repository) ? 0 : 1;
- if (leftMatch !== rightMatch) {
- return leftMatch - rightMatch;
- }
- return left.name.localeCompare(right.name);
- });
-}
-
export function sortSkillsByProjectRelevance(
skills: SkillInfo[],
projectDir?: string | null,
@@ -98,19 +46,3 @@ export function sortSkillsByProjectRelevance(
return left.name.localeCompare(right.name);
});
}
-
-export function countAutomationsForRepository(
- automations: readonly Automation[],
- repository: string | null | undefined,
-): number {
- return automations.filter((automation) =>
- isAutomationForRepository(automation, repository),
- ).length;
-}
-
-export function countSkillsForProject(
- skills: readonly SkillInfo[],
- projectDir?: string | null,
-): number {
- return skills.filter((skill) => isSkillForProject(skill, projectDir)).length;
-}
diff --git a/src/utils/dropdown-classes.ts b/src/utils/dropdown-classes.ts
index 60c3c92677..9fbdb171b8 100644
--- a/src/utils/dropdown-classes.ts
+++ b/src/utils/dropdown-classes.ts
@@ -62,16 +62,6 @@ export const dropdownFilterTriggerClassName = cn(
dropdownInstantColorClassName,
);
-/**
- * Scroll cap for the switch-profile menu: four two-line rows
- * (p-2 + leading-5 title + gap-0.5 + leading-4 subtitle) plus list gaps.
- */
-export const switchProfileMenuListScrollClassName = cn(
- dropdownMenuListClassName,
- "overflow-y-auto custom-scrollbar-always",
- "max-h-[13.875rem]",
-);
-
/**
* Tall sidebar/context menus: cap height to the viewport and scroll with the
* custom scrollbar when content overflows (no scrollbar when everything fits).
diff --git a/src/utils/file-priority.ts b/src/utils/file-priority.ts
deleted file mode 100644
index 49d2ad55ec..0000000000
--- a/src/utils/file-priority.ts
+++ /dev/null
@@ -1,106 +0,0 @@
-/**
- * Utilities for ranking workspace files by "importance" so that the file-tab
- * top-row surfaces the entry points (`index.html`, `README.md`, `package.json`,
- * etc.) ahead of nested utility modules.
- */
-
-/**
- * File basenames (lowercased) that are almost always the entrypoint for a
- * project. Lower index = higher priority.
- */
-const HIGH_PRIORITY_BASENAMES: string[] = [
- "index.html",
- "index.htm",
- "readme.md",
- "readme",
- "main.html",
- "app.html",
- "index.js",
- "index.ts",
- "index.tsx",
- "index.jsx",
- "main.py",
- "app.py",
- "main.go",
- "main.rs",
- "main.java",
- "main.c",
- "main.cpp",
- "package.json",
- "pyproject.toml",
- "cargo.toml",
- "go.mod",
- "pom.xml",
- "dockerfile",
- "makefile",
-];
-
-/**
- * Filenames that are useful but typically of secondary interest compared to
- * the entrypoints above.
- */
-const SECONDARY_BASENAMES: string[] = [
- "license",
- "license.md",
- "license.txt",
- "changelog.md",
- "agents.md",
- "tsconfig.json",
- ".env.sample",
- ".env.example",
-];
-
-function getBasename(path: string): string {
- const idx = path.lastIndexOf("/");
- return (idx === -1 ? path : path.slice(idx + 1)).toLowerCase();
-}
-
-function pathDepth(path: string): number {
- // Filter empty segments so leading/trailing/double slashes don't inflate
- // depth (e.g. `/src/index.html`, `src//index.html`, `src/` should all
- // count the same as `src/index.html`). Matches the convention already
- // used by `buildFileTree` in `file-tree.ts`.
- return path.split("/").filter(Boolean).length - 1;
-}
-
-/**
- * Rank a path *within its own depth bucket*: high-priority entrypoints
- * first (in the order listed), then secondary supporting files, then
- * everything else. Depth is the primary sort axis applied by
- * {@link sortFilesByPriority}; this score is the tie-breaker for paths at
- * the same depth.
- */
-export function filePriorityScore(path: string): number {
- const base = getBasename(path);
-
- const highIdx = HIGH_PRIORITY_BASENAMES.indexOf(base);
- if (highIdx !== -1) return highIdx;
-
- const secondaryIdx = SECONDARY_BASENAMES.indexOf(base);
- if (secondaryIdx !== -1) return 1000 + secondaryIdx;
-
- return 10000;
-}
-
-/**
- * Returns a copy of `paths` sorted so the most likely "landing files" come
- * first.
- *
- * Sort order:
- * 1. Shallower paths beat deeper ones, unconditionally. A top-level
- * `README.md` outranks `foo/bar/index.html` even though `index.html`
- * is a more "important" basename β€” the user almost always cares more
- * about top-level files when they first open a project.
- * 2. Within the same depth, basenames are ordered by importance
- * (`index.html` before `README.md` before random utility modules).
- * 3. Final tie-breaker is alphabetical.
- */
-export function sortFilesByPriority(paths: string[]): string[] {
- return [...paths].sort((a, b) => {
- const depthDiff = pathDepth(a) - pathDepth(b);
- if (depthDiff !== 0) return depthDiff;
- const scoreDiff = filePriorityScore(a) - filePriorityScore(b);
- if (scoreDiff !== 0) return scoreDiff;
- return a.localeCompare(b);
- });
-}
diff --git a/src/utils/form-control-classes.ts b/src/utils/form-control-classes.ts
index f9bade75af..eedfed7dad 100644
--- a/src/utils/form-control-classes.ts
+++ b/src/utils/form-control-classes.ts
@@ -129,14 +129,6 @@ export const formControlButtonClassName = cn(
/** Helper text under a left-aligned {@link SettingsSwitch} (40px track + gap-2). */
export const formControlSwitchDescriptionClassName = "pl-12";
-/** Filter / enum dropdown triggers beside search toolbars. */
-export const formControlFilterTriggerClassName = cn(
- formControlButtonClassName,
- formControlBorderClassName,
- formControlSurfaceClassName,
- "shrink-0 text-contrast",
-);
-
/** Outlined back navigation control with tertiary hover fill (settings sub-pages, detail views). */
export const formControlBackNavButtonClassName = cn(
formControlHeightClassName,
diff --git a/src/utils/format-model-name.ts b/src/utils/format-model-name.ts
index b2789a73de..0344a27a45 100644
--- a/src/utils/format-model-name.ts
+++ b/src/utils/format-model-name.ts
@@ -11,8 +11,6 @@ export const FREE_OPENHANDS_MODELS = {
"openhands/deepseek-v4-flash": "OpenHands DeepSeek V4 Flash",
} as const;
-export const FREE_OPENHANDS_MODEL_IDS = Object.keys(FREE_OPENHANDS_MODELS);
-
/**
* Set of free ``provider/model`` ids. The frontend no longer hardcodes which
* OpenHands models are free β€” the set is sourced from the backend model list
@@ -50,16 +48,6 @@ export function formatModelNameForDisplay(
return appendFreeSuffix(model, isFreeOpenHandsModel(model, freeModels));
}
-export function formatProviderModelNameForDisplay(
- provider: string | null | undefined,
- model: string | null | undefined,
- freeModels: FreeModelSet = EMPTY_FREE_MODELS,
-): string | null {
- if (!model) return null;
- const fullModel = provider ? `${provider}/${model}` : model;
- return appendFreeSuffix(model, isFreeOpenHandsModel(fullModel, freeModels));
-}
-
/**
* Format a native (OpenHands-kind) routing model string for display, stripping
* the provider route prefix (e.g. ``"anthropic/claude-sonnet-4-5-20250929"`` β†’
diff --git a/src/utils/git-status-mapper.ts b/src/utils/git-status-mapper.ts
index 44e5228671..6d36b42753 100644
--- a/src/utils/git-status-mapper.ts
+++ b/src/utils/git-status-mapper.ts
@@ -27,9 +27,3 @@ export function mapAnyGitStatusToClientStatus(
return "M";
}
}
-
-export function mapAgentServerToClientGitStatus(
- agentServerStatus: AgentServerGitChangeStatus,
-): GitChangeStatus {
- return mapAnyGitStatusToClientStatus(agentServerStatus);
-}
diff --git a/src/utils/mobile-section-nav.ts b/src/utils/mobile-section-nav.ts
index bbbe756b7e..4905956e7f 100644
--- a/src/utils/mobile-section-nav.ts
+++ b/src/utils/mobile-section-nav.ts
@@ -50,13 +50,3 @@ export function getMobileTopBarState(pathname: string): MobileTopBarState {
return { mode: "menu" };
}
-
-export function isExtensionsSectionPath(pathname: string): boolean {
- return (
- pathname === CUSTOMIZE_HUB ||
- pathname === APPS_MANAGEMENT_PATH ||
- EXTENSIONS_DETAIL_PATHS.some(
- (path) => pathname === path || pathname.startsWith(`${path}/`),
- )
- );
-}
diff --git a/src/utils/sanitize-query.ts b/src/utils/sanitize-query.ts
deleted file mode 100644
index 565fdc67a3..0000000000
--- a/src/utils/sanitize-query.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-export const sanitizeQuery = (query: string) =>
- query
- .trim()
- .replace(/https?:\/\//, "")
- .replace(/github.com\//, "")
- .replace(/\.git$/, "")
- .toLowerCase();
diff --git a/src/utils/sdk-settings-field-metadata.test.ts b/src/utils/sdk-settings-field-metadata.test.ts
index 6b4f051e72..dd6451e9a1 100644
--- a/src/utils/sdk-settings-field-metadata.test.ts
+++ b/src/utils/sdk-settings-field-metadata.test.ts
@@ -5,7 +5,6 @@ import {
toSchemaTranslationKey,
resolveSchemaFieldLabel,
resolveSchemaFieldDescription,
- resolveSchemaFieldSectionLabel,
resolveSchemaChoiceLabel,
getSettingsFieldConstraints,
} from "./sdk-settings-field-metadata";
@@ -139,32 +138,6 @@ describe("resolveSchemaFieldDescription", () => {
});
});
-describe("resolveSchemaFieldSectionLabel", () => {
- it("returns translated section label when conventional key exists", () => {
- const mockT = vi.fn((key: string, options?: { defaultValue: string }) => {
- if (key === "SCHEMA$LLM$SECTION_LABEL") return "Language Model";
- return options?.defaultValue ?? key;
- }) as unknown as TFunction;
-
- const result = resolveSchemaFieldSectionLabel(mockT, "llm", "LLM");
- expect(result).toBe("Language Model");
- });
-
- it("returns schema value when no translation exists", () => {
- const mockT = vi.fn(
- (key: string, options?: { defaultValue: string }) =>
- options?.defaultValue ?? key,
- ) as unknown as TFunction;
-
- const result = resolveSchemaFieldSectionLabel(
- mockT,
- "custom_section",
- "Custom Section",
- );
- expect(result).toBe("Custom Section");
- });
-});
-
describe("resolveSchemaChoiceLabel", () => {
it("returns translated choice label when conventional key exists", () => {
const mockT = vi.fn((key: string, options?: { defaultValue: string }) => {
diff --git a/src/utils/sdk-settings-field-metadata.ts b/src/utils/sdk-settings-field-metadata.ts
index deea62c2e5..46a11f1abd 100644
--- a/src/utils/sdk-settings-field-metadata.ts
+++ b/src/utils/sdk-settings-field-metadata.ts
@@ -130,20 +130,6 @@ export function resolveSchemaFieldDescription(
return resolveSchemaFieldText(t, fieldKey, "DESCRIPTION", schemaValue);
}
-/**
- * Resolves a section label using the i18n fallback chain.
- * @see resolveSchemaFieldText for the fallback chain details.
- */
-export function resolveSchemaFieldSectionLabel(
- t: TFunction,
- sectionKey: string,
- schemaValue: string,
-): string {
- return (
- resolveSchemaFieldText(t, sectionKey, "SECTION_LABEL", schemaValue) ?? ""
- );
-}
-
/**
* Resolves a choice label for select fields using the i18n fallback chain.
* Convention: SCHEMA$<FIELD_PATH>$CHOICE$<CHOICE_VALUE>
diff --git a/src/utils/sdk-settings-schema.ts b/src/utils/sdk-settings-schema.ts
index 1086c62679..65e1063780 100644
--- a/src/utils/sdk-settings-schema.ts
+++ b/src/utils/sdk-settings-schema.ts
@@ -112,13 +112,6 @@ export function getAgentSettingValue(
return getSettingValue(settings, key, "agent_settings");
}
-export function getConversationSettingValue(
- settings: Settings,
- key: string,
-): SettingsValue {
- return getSettingValue(settings, key, "conversation_settings");
-}
-
function isChoiceField(field: SettingsFieldSchema): boolean {
return field.choices.length > 0;
}
@@ -325,12 +318,6 @@ export function inferInitialView(
return "basic";
}
-/** Determine which view tier to default to based on whether the user has
- * overridden any non-critical settings. */
-export function hasAdvancedSettingsOverrides(settings: Settings): boolean {
- return inferInitialView(settings) !== "basic";
-}
-
export function isSettingsFieldVisible(
field: SettingsFieldSchema,
values: SettingsFormValues,
diff --git a/src/utils/settings-utils.ts b/src/utils/settings-utils.ts
index 7742f02d64..1d0f76bc37 100644
--- a/src/utils/settings-utils.ts
+++ b/src/utils/settings-utils.ts
@@ -15,17 +15,6 @@ const extractBasicFormData = (formData: FormData) => {
};
};
-export const parseMaxBudgetPerTask = (value: string): number | null => {
- if (!value) {
- return null;
- }
-
- const parsedValue = parseFloat(value);
- return parsedValue && parsedValue >= 1 && Number.isFinite(parsedValue)
- ? parsedValue
- : null;
-};
-
export const extractSettings = (
formData: FormData,
): Partial<Settings> & Record<string, unknown> => {
diff --git a/src/utils/settings-value-pickers.ts b/src/utils/settings-value-pickers.ts
index 97162ca3a2..1d68101b90 100644
--- a/src/utils/settings-value-pickers.ts
+++ b/src/utils/settings-value-pickers.ts
@@ -1,9 +1,3 @@
-export const isNonEmptyString = (value: unknown): value is string =>
- typeof value === "string" && value.length > 0;
-
-export const pickFirstString = (...values: unknown[]): string | undefined =>
- values.find(isNonEmptyString);
-
export const pickFirstBoolean = (...values: unknown[]): boolean | undefined =>
values.find((value): value is boolean => typeof value === "boolean");
diff --git a/src/utils/table-row-classes.ts b/src/utils/table-row-classes.ts
deleted file mode 100644
index 768de4be32..0000000000
--- a/src/utils/table-row-classes.ts
+++ /dev/null
@@ -1,23 +0,0 @@
-/** Bordered table container on base-secondary surfaces. */
-export const tableContainerClassName =
- "overflow-hidden rounded-md border border-border bg-base-secondary";
-
-/** Fixed 44px row height for compact data tables (secrets, automations, MCP). */
-const tableRowHeightClassName = "h-11";
-
-const tableRowClassName = [
- tableRowHeightClassName,
- "border-t border-border transition-colors",
-].join(" ");
-
-/** Subtle row highlight on base-secondary tables. */
-const tableRowHoverClassName =
- "hover:bg-interactive-hover-low outline-none focus:outline-none focus-visible:outline-none focus-visible:bg-interactive-hover-low";
-
-export const tableCellClassName = "px-3 align-middle";
-
-export const tableRowInteractiveClassName = [
- tableRowClassName,
- tableRowHoverClassName,
- "cursor-pointer",
-].join(" ");
diff --git a/src/utils/types.ts b/src/utils/types.ts
index dd2a9e6962..450c6699ed 100644
--- a/src/utils/types.ts
+++ b/src/utils/types.ts
@@ -13,8 +13,3 @@ export interface SuggestedTask {
title: string;
task_type: SuggestedTaskType;
}
-
-export interface SuggestedTaskGroup {
- title: string;
- tasks: SuggestedTask[];
-}
diff --git a/src/utils/user-facing-error.test.ts b/src/utils/user-facing-error.test.ts
index 410eca8feb..e0f821dd23 100644
--- a/src/utils/user-facing-error.test.ts
+++ b/src/utils/user-facing-error.test.ts
@@ -2,7 +2,6 @@ import { describe, expect, it, vi } from "vitest";
import {
BACKEND_REQUEST_TIMEOUT_MESSAGE,
CORS_OR_NETWORK_ERROR_MESSAGE,
- getRawErrorMessage,
getUserFacingConnectionErrorMessage,
isBackendRequestTimeoutMessage,
isCorsOrNetworkError,
@@ -89,10 +88,16 @@ describe("user-facing connection errors", () => {
message: "outer",
cause: { message: "Failed to fetch" },
};
- expect(getRawErrorMessage(wrapped)).toBe("outer");
+ expect(getUserFacingConnectionErrorMessage(wrapped)).toBe(
+ CORS_OR_NETWORK_ERROR_MESSAGE,
+ );
expect(isCorsOrNetworkError(wrapped)).toBe(true);
- expect(getRawErrorMessage("plain string")).toBe("plain string");
- expect(getRawErrorMessage({ message: 42, cause: "nested" })).toBe("nested");
+ expect(getUserFacingConnectionErrorMessage("plain string")).toBe(
+ "plain string",
+ );
+ expect(
+ getUserFacingConnectionErrorMessage({ message: 42, cause: "nested" }),
+ ).toBe("nested");
});
it("ignores callable values with error-like properties", () => {
@@ -100,19 +105,19 @@ describe("user-facing connection errors", () => {
message: "Failed to fetch",
});
- expect(getRawErrorMessage(callable)).toBeNull();
+ expect(getUserFacingConnectionErrorMessage(callable)).toBeNull();
});
it("handles empty, primitive, cyclic, and deeply nested causes", () => {
- expect(getRawErrorMessage(undefined)).toBeNull();
- expect(getRawErrorMessage(42)).toBeNull();
- expect(getRawErrorMessage("")).toBeNull();
- expect(getRawErrorMessage(new Error(""))).toBeNull();
- expect(getRawErrorMessage({ message: "" })).toBeNull();
+ expect(getUserFacingConnectionErrorMessage(undefined)).toBeNull();
+ expect(getUserFacingConnectionErrorMessage(42)).toBeNull();
+ expect(getUserFacingConnectionErrorMessage("")).toBeNull();
+ expect(getUserFacingConnectionErrorMessage(new Error(""))).toBeNull();
+ expect(getUserFacingConnectionErrorMessage({ message: "" })).toBeNull();
const cyclic: { message: string; cause?: unknown } = { message: "cycle" };
cyclic.cause = cyclic;
- expect(getRawErrorMessage(cyclic)).toBe("cycle");
+ expect(getUserFacingConnectionErrorMessage(cyclic)).toBe("cycle");
const tooDeep = {
message: "one",
diff --git a/src/utils/user-facing-error.ts b/src/utils/user-facing-error.ts
index 50615d8620..d1c5fb232f 100644
--- a/src/utils/user-facing-error.ts
+++ b/src/utils/user-facing-error.ts
@@ -40,10 +40,6 @@ function collectErrorMessages(error: unknown): string[] {
return messages;
}
-export function getRawErrorMessage(error: unknown): string | null {
- return collectErrorMessages(error)[0] ?? null;
-}
-
export function isCorsOrNetworkErrorMessage(
message: string | null | undefined,
): boolean {
diff --git a/src/utils/utils.ts b/src/utils/utils.ts
index 23bb300cb9..b7e0a1353f 100644
--- a/src/utils/utils.ts
+++ b/src/utils/utils.ts
@@ -1,11 +1,6 @@
import { type ClassValue, clsx } from "clsx";
import { twMerge } from "tailwind-merge";
import { Provider } from "#/types/settings";
-import { SuggestedTaskGroup } from "#/utils/types";
-import { ConversationStatus } from "#/types/conversation-status";
-import { GitRepository } from "#/types/git";
-import { sanitizeQuery } from "#/utils/sanitize-query";
-import { PRODUCT_URL } from "#/utils/constants";
import { AgentState } from "#/types/agent-state";
import { I18nKey } from "#/i18n/declaration";
import { getTaskStatusI18nKey } from "#/utils/status";
@@ -103,70 +98,6 @@ export const isMobileDevice = (): boolean => {
return true;
};
-/**
- * Checks if the current domain is the production domain
- * @returns True if the current domain matches the production URL
- */
-export const isProductionDomain = (): boolean =>
- window.location.origin === PRODUCT_URL.PRODUCTION;
-
-interface EventActionHistory {
- args?: {
- LLM_API_KEY?: string;
- [key: string]: unknown;
- };
- extras?: {
- open_page_urls: string[];
- active_page_index: number;
- dom_object: Record<string, unknown>;
- axtree_object: Record<string, unknown>;
- extra_element_properties: Record<string, unknown>;
- last_browser_action: string;
- last_browser_action_error: unknown;
- focused_element_bid: string;
- };
- [key: string]: unknown;
-}
-
-export const removeUnwantedKeys = (
- data: EventActionHistory[],
-): EventActionHistory[] => {
- const UNDESIRED_KEYS = [
- "open_page_urls",
- "active_page_index",
- "dom_object",
- "axtree_object",
- "extra_element_properties",
- "last_browser_action",
- "last_browser_action_error",
- "focused_element_bid",
- ];
-
- return data
- .filter((item) => {
- // Skip items that have a status key
- if ("status" in item) {
- return false;
- }
- return true;
- })
- .map((item) => {
- // Create a shallow copy of item
- const newItem = { ...item };
-
- // Check if extras exists and delete it from a new extras object
- if (newItem.extras) {
- const newExtras = { ...newItem.extras };
- UNDESIRED_KEYS.forEach((key) => {
- delete newExtras[key as keyof typeof newExtras];
- });
- newItem.extras = newExtras;
- }
-
- return newItem;
- });
-};
-
/**
* Get file extension from file name in uppercase format
* @param fileName The file name to extract extension from
@@ -446,17 +377,6 @@ export const getCreatePRPrompt = (gitProvider: Provider): string => {
return `Please push the changes to ${providerName} and open a ${pr}. If you're on a default branch (e.g., main, master, deploy), create a new branch with a descriptive name otherwise use the current branch. If a ${pr} template exists in the repository, please follow it when creating the ${prShort} description.`;
};
-/**
- * Generate a push to existing PR prompt
- * @param gitProvider The git provider
- * @returns The push to PR prompt
- */
-export const getPushToPRPrompt = (gitProvider: Provider): string => {
- const pr = getPR(gitProvider === "gitlab");
-
- return `Please push the latest changes to the existing ${pr}.`;
-};
-
/**
* Generate a create new branch prompt
* @returns The create new branch prompt
@@ -464,175 +384,6 @@ export const getPushToPRPrompt = (gitProvider: Provider): string => {
export const getCreateNewBranchPrompt = (): string =>
"Please create a new branch with a descriptive name related to the work you plan to do.";
-// Helper functions
-export function getTotalTaskCount(
- suggestedTasks: SuggestedTaskGroup[] | undefined,
-): number {
- if (!suggestedTasks) return 0;
- return suggestedTasks.flatMap((group) => group.tasks).length;
-}
-
-export function getLimitedTaskGroups(
- suggestedTasks: SuggestedTaskGroup[],
- maxTasks: number,
-): SuggestedTaskGroup[] {
- const limitedGroups: SuggestedTaskGroup[] = [];
- let taskCount = 0;
-
- for (const group of suggestedTasks) {
- if (taskCount >= maxTasks) break;
-
- const remainingTasksNeeded = maxTasks - taskCount;
- const tasksToShow = group.tasks.slice(0, remainingTasksNeeded);
-
- if (tasksToShow.length > 0) {
- limitedGroups.push({
- ...group,
- tasks: tasksToShow,
- });
- taskCount += tasksToShow.length;
- }
- }
-
- return limitedGroups;
-}
-
-export function getDisplayedTaskGroups(
- suggestedTasks: SuggestedTaskGroup[] | undefined,
- isExpanded: boolean,
-): SuggestedTaskGroup[] {
- if (!suggestedTasks || suggestedTasks.length === 0) {
- return [];
- }
-
- if (isExpanded) {
- return suggestedTasks;
- }
-
- return getLimitedTaskGroups(suggestedTasks, 3);
-}
-
-/**
- * Get the label for a conversation status
- * @param status The conversation status
- * @returns The localized label for the status
- */
-export const getConversationStatusLabel = (
- status: ConversationStatus,
-): string => {
- switch (status) {
- case "STOPPED":
- return "COMMON$STOPPED";
- case "RUNNING":
- return "COMMON$RUNNING";
- case "STARTING":
- return "COMMON$STARTING";
- case "ERROR":
- return "COMMON$ERROR";
- case "ARCHIVED":
- return "COMMON$ARCHIVED"; // Use STOPPED for archived conversations
- default:
- return "COMMON$UNKNOWN";
- }
-};
-
-// Task Tracking Utility Functions
-
-/**
- * Get the status icon for a task status
- * @param status The task status
- * @returns The emoji icon for the status
- */
-export const getStatusIcon = (status: string) => {
- switch (status) {
- case "todo":
- return "⏳";
- case "in_progress":
- return "πŸ”„";
- case "done":
- return "βœ…";
- default:
- return "❓";
- }
-};
-
-/**
- * Get the CSS class names for a task status badge
- * @param status The task status
- * @returns The CSS class names for styling the status badge
- */
-export const getStatusClassName = (status: string) => {
- if (status === "done") {
- return "bg-green-800 text-green-200";
- }
- if (status === "in_progress") {
- return "bg-yellow-800 text-yellow-200";
- }
- return "bg-tertiary text-text-tertiary";
-};
-
-/**
- * Helper function to apply client-side filtering based on search query
- * @param repo The Git repository to check
- * @param searchQuery The search query string
- * @returns True if the repository should be included based on the search query
- */
-export const shouldIncludeRepository = (
- repo: GitRepository,
- searchQuery: string,
-): boolean => {
- if (!searchQuery.trim()) {
- return true;
- }
-
- const sanitizedQuery = sanitizeQuery(searchQuery);
- const sanitizedRepoName = sanitizeQuery(repo.full_name);
- return sanitizedRepoName.includes(sanitizedQuery);
-};
-
-/**
- * Get the OpenHands query string based on the provider
- * @param provider The git provider
- * @returns The query string for searching OpenHands repositories
- */
-export const getOpenHandsQuery = (provider: Provider | null): string => {
- const providerRepositorySuffix: Record<string, string> = {
- gitlab: "openhands-config",
- azure_devops: "openhands-config",
- default: ".openhands",
- } as const;
-
- return provider && provider in providerRepositorySuffix
- ? providerRepositorySuffix[provider]
- : providerRepositorySuffix.default;
-};
-
-/**
- * Check if a repository has the OpenHands suffix based on the provider
- * @param repo The Git repository to check
- * @param provider The git provider
- * @returns True if the repository has the OpenHands suffix
- */
-export const hasOpenHandsSuffix = (
- repo: GitRepository,
- provider: Provider | null,
-): boolean => repo.full_name.endsWith(`/${getOpenHandsQuery(provider)}`);
-
-/**
- * Build headers for V1 API requests that require session authentication
- * @param sessionApiKey Session API key for authentication
- * @returns Headers object with X-Session-API-Key if provided
- */
-export const buildSessionHeaders = (
- sessionApiKey?: string | null,
-): Record<string, string> => {
- const headers: Record<string, string> = {};
- if (sessionApiKey) {
- headers["X-Session-API-Key"] = sessionApiKey;
- }
- return headers;
-};
-
/**
* Check if a task is currently being polled (loading state)
* @param taskStatus The task status string (e.g., "WORKING", "ERROR", "READY")
diff --git a/src/utils/workspace-relative-path.ts b/src/utils/workspace-relative-path.ts
deleted file mode 100644
index 0c93afd031..0000000000
--- a/src/utils/workspace-relative-path.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-/**
- * Workspace-relative path helpers for Files drawer / workspace file APIs.
- *
- * Implementation lives in path-utils (`toFilesTabPath`) so chat links,
- * canvas_ui navigation, and markdown artifact View share one normalizer.
- */
-export { toFilesTabPath as toWorkspaceRelativePath } from "./path-utils";
diff --git a/vite.config.ts b/vite.config.ts
index 09fee03233..7b3ab2a08c 100644
--- a/vite.config.ts
+++ b/vite.config.ts
@@ -110,12 +110,6 @@ export default defineConfig(({ mode }) => {
VITE_BASE_PATH,
VITE_VSCODE_BASE_PATH,
VITE_VSCODE_TARGET,
- // Runtime-services metadata for the dev server, passed by launchers that
- // run the Vite dev server directly (e.g. dev:minimal). Unlike
- // ingress/static-server, the Vite proxy cannot post-process the upstream
- // /server_info response, so the launcher serializes the info here and the
- // middleware below merges it into the proxied response.
- VITE_RUNTIME_SERVICES_INFO,
} = loadEnv(mode, process.cwd());
const isLibraryBuild = process.env.BUILD_LIB === "true";