Skip to content

🙌 OpenHands: AI-Driven Development

feat: offer one-click restart to activate chat-installed skills (#1830)

Hiep Le389562d00203
diff --git a/__tests__/components/features/chat/skill-install-restart-banner.test.tsx b/__tests__/components/features/chat/skill-install-restart-banner.test.tsx
new file mode 100644
index 0000000000..de4c36f2ec
--- /dev/null
+++ b/__tests__/components/features/chat/skill-install-restart-banner.test.tsx
@@ -0,0 +1,185 @@
+import { act, screen, waitFor } from "@testing-library/react";
+import userEvent from "@testing-library/user-event";
+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
+import { renderWithProviders } from "test-utils";
+import { SkillInstallRestartBanner } from "#/components/features/chat/skill-install-restart-banner";
+import AgentServerConversationService from "#/api/conversation-service/agent-server-conversation-service.api";
+import { useEventStore } from "#/stores/use-event-store";
+import {
+ __resetActiveStoreForTests,
+ setActiveSelection,
+ setRegisteredBackends,
+} from "#/api/backend-registry/active-store";
+import { ActiveBackendProvider } from "#/contexts/active-backend-context";
+import type {
+ CmdOutputMetadata,
+ ExecuteBashObservation,
+ ObservationEvent,
+} from "#/types/agent-server/core";
+
+// The restart mutation resolves the launch profile through these services
+// before creating the conversation; stub them so it deterministically takes
+// the legacy agent_settings path (their absence is a supported fallback).
+vi.mock("#/api/agent-profiles-service/agent-profiles-service.api", () => ({
+ __esModule: true,
+ default: { listProfiles: vi.fn().mockRejectedValue(new Error("n/a")) },
+ WELL_KNOWN_DEFAULT_AGENT_PROFILE_NAME: "default",
+}));
+vi.mock("#/api/profiles-service/profiles-service.api", () => ({
+ __esModule: true,
+ default: {
+ listProfiles: vi
+ .fn()
+ .mockResolvedValue({ profiles: [], active_profile: null }),
+ },
+}));
+vi.mock("#/api/plugins-management-service", () => ({
+ __esModule: true,
+ default: { listInstalledPlugins: vi.fn().mockResolvedValue([]) },
+}));
+
+const CONVERSATION_ID = "test-conversation-id";
+
+const makeInstallEvent = (
+ id: string,
+ skill = "codereview",
+ workspace = "/tmp/demo-ws",
+): ObservationEvent<ExecuteBashObservation> => ({
+ id,
+ timestamp: new Date().toISOString(),
+ source: "environment",
+ tool_name: "execute_bash",
+ tool_call_id: `call-${id}`,
+ action_id: `action-${id}`,
+ observation: {
+ kind: "ExecuteBashObservation",
+ content: [
+ {
+ type: "text",
+ text: `✅ Successfully installed '${skill}' to ${workspace}/.agents/skills/${skill}`,
+ },
+ ],
+ command: "python3 fetch_skill.py",
+ exit_code: 0,
+ error: false,
+ timeout: false,
+ metadata: {} as CmdOutputMetadata,
+ },
+});
+
+const addInstallEvent = (id: string) =>
+ act(() => {
+ useEventStore.getState().addEvent(makeInstallEvent(id));
+ });
+
+const renderBanner = () =>
+ renderWithProviders(
+ <SkillInstallRestartBanner conversationId={CONVERSATION_ID} />,
+ );
+
+describe("SkillInstallRestartBanner", () => {
+ beforeEach(() => {
+ // Load the conversation into the (global) event store so installs are
+ // attributed to the rendered conversation.
+ useEventStore.getState().clearEventsForConversation(CONVERSATION_ID);
+ });
+
+ afterEach(() => {
+ __resetActiveStoreForTests();
+ });
+
+ it("renders nothing when the conversation has no skill installs", () => {
+ renderBanner();
+
+ expect(
+ screen.queryByTestId("skill-install-restart-banner"),
+ ).not.toBeInTheDocument();
+ });
+
+ it("shows the banner after a successful skill install observation", async () => {
+ renderBanner();
+
+ addInstallEvent("evt-1");
+
+ expect(
+ await screen.findByTestId("skill-install-restart-banner"),
+ ).toBeInTheDocument();
+ });
+
+ it("hides the banner when dismissed", async () => {
+ renderBanner();
+ addInstallEvent("evt-1");
+ await screen.findByTestId("skill-install-restart-banner");
+
+ await userEvent.click(screen.getByTestId("skill-install-restart-dismiss"));
+
+ expect(
+ screen.queryByTestId("skill-install-restart-banner"),
+ ).not.toBeInTheDocument();
+ });
+
+ it("resurfaces the banner when a new install happens after a dismissal", async () => {
+ renderBanner();
+ addInstallEvent("evt-1");
+ await screen.findByTestId("skill-install-restart-banner");
+ await userEvent.click(screen.getByTestId("skill-install-restart-dismiss"));
+
+ addInstallEvent("evt-2");
+
+ expect(
+ await screen.findByTestId("skill-install-restart-banner"),
+ ).toBeInTheDocument();
+ });
+
+ it("renders nothing on a cloud backend", () => {
+ setRegisteredBackends([
+ {
+ id: "cloud-1",
+ name: "Cloud",
+ host: "https://app.all-hands.dev",
+ apiKey: "key",
+ kind: "cloud",
+ },
+ ]);
+ setActiveSelection({ backendId: "cloud-1" });
+ renderWithProviders(
+ <ActiveBackendProvider>
+ <SkillInstallRestartBanner conversationId={CONVERSATION_ID} />
+ </ActiveBackendProvider>,
+ );
+
+ addInstallEvent("evt-1");
+
+ expect(
+ screen.queryByTestId("skill-install-restart-banner"),
+ ).not.toBeInTheDocument();
+ });
+
+ it("starts a new conversation in the install workspace and navigates to it", async () => {
+ const createConversationSpy = vi
+ .spyOn(AgentServerConversationService, "createConversation")
+ .mockResolvedValue({
+ id: "task-1",
+ app_conversation_id: "new-conv-1",
+ agent_server_url: null,
+ } as never);
+ const navigate = vi.fn();
+ renderWithProviders(
+ <SkillInstallRestartBanner conversationId={CONVERSATION_ID} />,
+ { navigation: { navigate } },
+ );
+ addInstallEvent("evt-1");
+ await screen.findByTestId("skill-install-restart-banner");
+
+ await userEvent.click(screen.getByTestId("skill-install-restart-action"));
+
+ await waitFor(() => {
+ const call = createConversationSpy.mock.lastCall;
+ // Positional contract of createConversation: workingDir is #5 and
+ // workspaceMode #6 — the parsed install root, reused directly.
+ expect(call?.[4]).toBe("/tmp/demo-ws");
+ expect(call?.[5]).toBe("local_repo");
+ expect(navigate).toHaveBeenCalledWith("/conversations/new-conv-1");
+ });
+ });
+});
diff --git a/__tests__/utils/skill-install-events.test.ts b/__tests__/utils/skill-install-events.test.ts
new file mode 100644
index 0000000000..835626f025
--- /dev/null
+++ b/__tests__/utils/skill-install-events.test.ts
@@ -0,0 +1,119 @@
+import { describe, expect, it } from "vitest";
+import { detectSkillInstalls } from "#/utils/skill-install-events";
+import type {
+ CmdOutputMetadata,
+ ExecuteBashObservation,
+ ObservationEvent,
+} from "#/types/agent-server/core";
+import { createUserMessageEvent } from "test-utils";
+
+const successLine = (skill: string, dest: string) =>
+ `Fetching skill '${skill}'...\n✅ Successfully installed '${skill}' to ${dest}`;
+
+const makeBashObservationEvent = (
+ id: string,
+ text: string,
+ overrides: Partial<ExecuteBashObservation> = {},
+): ObservationEvent<ExecuteBashObservation> => ({
+ id,
+ timestamp: new Date().toISOString(),
+ source: "environment",
+ tool_name: "execute_bash",
+ tool_call_id: `call-${id}`,
+ action_id: `action-${id}`,
+ observation: {
+ kind: "ExecuteBashObservation",
+ content: [{ type: "text", text }],
+ command:
+ 'python3 /skills/add-skill/scripts/fetch_skill.py "https://github.com/o/r/tree/main/skills/s" "/ws"',
+ exit_code: 0,
+ error: false,
+ timeout: false,
+ metadata: {} as CmdOutputMetadata,
+ ...overrides,
+ },
+});
+
+describe("detectSkillInstalls", () => {
+ it("detects a successful install and extracts the skill name, workspace, and event id", () => {
+ const events = [
+ createUserMessageEvent("evt-msg"),
+ makeBashObservationEvent(
+ "evt-install",
+ successLine("codereview", "/tmp/demo-ws/.agents/skills/codereview"),
+ ),
+ ];
+
+ const installs = detectSkillInstalls(events);
+
+ expect(installs).toEqual([
+ {
+ eventId: "evt-install",
+ skillName: "codereview",
+ workspacePath: "/tmp/demo-ws",
+ },
+ ]);
+ });
+
+ it("ignores bash output without the success marker", () => {
+ const events = [
+ makeBashObservationEvent(
+ "evt-fail",
+ "❌ No SKILL.md found in 'skills/broken' - not a valid skill",
+ { exit_code: 1, error: true },
+ ),
+ ];
+
+ expect(detectSkillInstalls(events)).toEqual([]);
+ });
+
+ it("ignores a success line whose destination is not a .agents/skills path", () => {
+ const events = [
+ makeBashObservationEvent(
+ "evt-odd",
+ successLine("codereview", "/tmp/elsewhere/codereview"),
+ ),
+ ];
+
+ expect(detectSkillInstalls(events)).toEqual([]);
+ });
+
+ it("detects an install on a soft-timeout continuation observation", () => {
+ const events = [
+ makeBashObservationEvent(
+ "evt-timeout",
+ successLine("codereview", "/tmp/demo-ws/.agents/skills/codereview"),
+ { command: "", exit_code: -1 },
+ ),
+ ];
+
+ expect(detectSkillInstalls(events)).toHaveLength(1);
+ });
+
+ it("keeps only the latest event for a re-installed skill", () => {
+ const dest = "/tmp/demo-ws/.agents/skills/codereview";
+ const events = [
+ makeBashObservationEvent("evt-first", successLine("codereview", dest)),
+ makeBashObservationEvent("evt-second", successLine("codereview", dest)),
+ ];
+
+ const installs = detectSkillInstalls(events);
+
+ expect(installs).toEqual([
+ expect.objectContaining({ eventId: "evt-second" }),
+ ]);
+ });
+
+ it("normalizes Windows-style destination paths", () => {
+ const events = [
+ makeBashObservationEvent(
+ "evt-win",
+ successLine("codereview", "C:\\ws\\.agents\\skills\\codereview"),
+ ),
+ ];
+
+ expect(detectSkillInstalls(events)).toEqual([
+ expect.objectContaining({ workspacePath: "C:/ws" }),
+ ]);
+ });
+});
diff --git a/src/components/features/chat/chat-interface.tsx b/src/components/features/chat/chat-interface.tsx
index 4ae3971665..4f5db98fe1 100644
--- a/src/components/features/chat/chat-interface.tsx
+++ b/src/components/features/chat/chat-interface.tsx
@@ -32,6 +32,7 @@ import { useErrorMessageStore } from "#/stores/error-message-store";
import { useOptimisticUserMessageStore } from "#/stores/optimistic-user-message-store";
import { SERVER_CONNECTION_ERROR_MESSAGE } from "#/constants/server-connection-error";
import { ErrorMessageBanner } from "./error-message-banner";
+import { SkillInstallRestartBanner } from "./skill-install-restart-banner";
import { LlmNotConfiguredBanner } from "#/components/features/home/llm-not-configured-banner";
import { useLlmConfigured } from "#/hooks/use-llm-configured";
import { Messages } from "#/components/conversation-events/chat/messages";
@@ -563,6 +564,7 @@ export function ChatInterface() {
</div>
<div className="flex shrink-0 flex-col gap-[6px] pb-4">
+ <SkillInstallRestartBanner conversationId={conversationId} />
<BtwMessages conversationId={conversationId} />
{errorMessage && (
<ErrorMessageBanner
diff --git a/src/components/features/chat/skill-install-restart-banner.tsx b/src/components/features/chat/skill-install-restart-banner.tsx
new file mode 100644
index 0000000000..30243ec432
--- /dev/null
+++ b/src/components/features/chat/skill-install-restart-banner.tsx
@@ -0,0 +1,102 @@
+import { useTranslation } from "react-i18next";
+import { X } from "lucide-react";
+import { I18nKey } from "#/i18n/declaration";
+import { useSkillInstalls } from "#/hooks/use-skill-installs";
+import { useCreateConversation } from "#/hooks/mutation/use-create-conversation";
+import { useIsCreatingConversation } from "#/hooks/use-is-creating-conversation";
+import { useNavigation } from "#/context/navigation-context";
+import { useActiveConversation } from "#/hooks/query/use-active-conversation";
+import { useActiveBackend } from "#/contexts/active-backend-context";
+import { displayErrorToast } from "#/utils/custom-toast-handlers";
+
+export interface SkillInstallRestartBannerProps {
+ conversationId: string | null | undefined;
+}
+
+/**
+ * Pinned notice shown after the agent installs a skill via the bundled
+ * add-skill flow. The SDK loads skills once at conversation start, so a
+ * chat-installed skill can't activate in the running conversation — this
+ * banner says so and offers one action: start a new conversation in the
+ * directory the skill was installed to.
+ */
+export function SkillInstallRestartBanner({
+ conversationId,
+}: SkillInstallRestartBannerProps) {
+ const { t } = useTranslation("openhands");
+ const { installs, dismissAll } = useSkillInstalls(conversationId);
+ const { backend } = useActiveBackend();
+ const { mutate: createConversation, isPending } = useCreateConversation();
+ const isCreatingElsewhere = useIsCreatingConversation();
+ const { navigate } = useNavigation();
+ const { data: conversation } = useActiveConversation();
+
+ // Local-only: the cloud create path ignores workingDir entirely.
+ if (backend.kind !== "local" || installs.length === 0) return null;
+
+ const latest = installs[installs.length - 1];
+ const skillNames = installs
+ .filter((install) => install.workspacePath === latest.workspacePath)
+ .map((install) => install.skillName);
+
+ const handleRestart = () => {
+ if (isPending || isCreatingElsewhere) return;
+ createConversation(
+ {
+ // The agent's real install root, parsed from the fetch_skill.py
+ // success line — correct even for worktree conversations where
+ // selected_workspace would point elsewhere.
+ workingDir: latest.workspacePath,
+ // new_worktree would start from a fresh worktree without the
+ // freshly installed .agents/skills/ directory.
+ workspaceMode: "local_repo",
+ repository:
+ conversation?.selected_repository && conversation?.git_provider
+ ? {
+ name: conversation.selected_repository,
+ gitProvider: conversation.git_provider,
+ branch: conversation.selected_branch ?? undefined,
+ }
+ : undefined,
+ entryPoint: "skill_install_restart_banner",
+ },
+ {
+ onSuccess: (data) => navigate(`/conversations/${data.conversation_id}`),
+ onError: (error) => displayErrorToast(error.message),
+ },
+ );
+ };
+
+ return (
+ <div
+ className="flex w-full items-start gap-2 rounded-lg border border-[var(--oh-border)] bg-[var(--oh-surface-raised)] p-2 text-[var(--oh-foreground)]"
+ data-testid="skill-install-restart-banner"
+ >
+ <div className="min-w-0 flex-1">
+ <p className="text-sm text-[var(--oh-foreground)]">
+ {t(I18nKey.SKILLS$INSTALL_BANNER_MESSAGE, {
+ skills: skillNames.join(", "),
+ })}
+ </p>
+ <button
+ type="button"
+ onClick={handleRestart}
+ disabled={isPending || isCreatingElsewhere}
+ className="mt-2 cursor-pointer rounded-md border border-[var(--oh-border)] px-2 py-1 text-xs font-normal text-[var(--oh-foreground)] hover:bg-[var(--oh-interactive-hover)] disabled:cursor-not-allowed disabled:opacity-50"
+ data-testid="skill-install-restart-action"
+ >
+ {t(I18nKey.SKILLS$INSTALL_BANNER_ACTION)}
+ </button>
+ </div>
+ <button
+ type="button"
+ onClick={dismissAll}
+ className="shrink-0 cursor-pointer rounded-md p-1 text-[var(--oh-muted)] hover:bg-[var(--oh-interactive-hover)] hover:text-[var(--oh-foreground)]"
+ aria-label={t(I18nKey.BUTTON$CLOSE)}
+ data-testid="skill-install-restart-dismiss"
+ >
+ <X className="h-4 w-4" aria-hidden />
+ </button>
+ </div>
+ );
+}
diff --git a/src/hooks/use-skill-installs.ts b/src/hooks/use-skill-installs.ts
new file mode 100644
index 0000000000..cbb4b57b3c
--- /dev/null
+++ b/src/hooks/use-skill-installs.ts
@@ -0,0 +1,33 @@
+import { useCallback, useMemo } from "react";
+import { useEventStore } from "#/stores/use-event-store";
+import { useSkillInstallBannerStore } from "#/stores/skill-install-banner-store";
+import { detectSkillInstalls } from "#/utils/skill-install-events";
+
+/**
+ * Skill installs performed by the agent in this conversation (via the
+ * bundled add-skill flow), minus the ones the user dismissed. The event
+ * store is global, so results are scoped to the conversation it currently
+ * holds — a mismatched id (remount race) yields no installs.
+ */
+export const useSkillInstalls = (conversationId: string | null | undefined) => {
+ const events = useEventStore((s) => s.events);
+ const loadedConversationId = useEventStore((s) => s.loadedConversationId);
+ const dismissedEventIds = useSkillInstallBannerStore(
+ (s) => s.dismissedEventIds,
+ );
+ const dismiss = useSkillInstallBannerStore((s) => s.dismiss);
+
+ const installs = useMemo(() => {
+ if (!conversationId || conversationId !== loadedConversationId) return [];
+ return detectSkillInstalls(events).filter(
+ (install) => !dismissedEventIds[install.eventId],
+ );
+ }, [conversationId, loadedConversationId, events, dismissedEventIds]);
+
+ const dismissAll = useCallback(
+ () => dismiss(installs.map((install) => install.eventId)),
+ [dismiss, installs],
+ );
+
+ return { installs, dismissAll };
+};
diff --git a/src/i18n/translation.json b/src/i18n/translation.json
index 8bb1dbefd8..fff215e409 100644
--- a/src/i18n/translation.json
+++ b/src/i18n/translation.json
@@ -20059,6 +20059,40 @@
"uk": "Знання викликаних навичок:",
"ca": "Coneixement d'habilitats invocades:"
},
+ "SKILLS$INSTALL_BANNER_MESSAGE": {
+ "en": "Installed to this workspace: {{skills}}. Skills load when a conversation starts, so this conversation can't use them yet.",
+ "ja": "このワークスペースにインストールしました: {{skills}}。スキルは会話の開始時に読み込まれるため、この会話ではまだ使用できません。",
+ "zh-CN": "已安装到此工作区:{{skills}}。技能在会话开始时加载,因此本会话尚无法使用。",
+ "zh-TW": "已安裝到此工作區:{{skills}}。技能會在對話開始時載入,因此本對話尚無法使用。",
+ "ko-KR": "이 워크스페이스에 설치됨: {{skills}}. 스킬은 대화가 시작될 때 로드되므로 이 대화에서는 아직 사용할 수 없습니다.",
+ "no": "Installert i dette arbeidsområdet: {{skills}}. Ferdigheter lastes når en samtale starter, så denne samtalen kan ikke bruke dem ennå.",
+ "ar": "تم التثبيت في مساحة العمل هذه: {{skills}}. يتم تحميل المهارات عند بدء المحادثة، لذا لا يمكن لهذه المحادثة استخدامها بعد.",
+ "de": "In diesem Workspace installiert: {{skills}}. Skills werden beim Start einer Konversation geladen, daher kann diese Konversation sie noch nicht verwenden.",
+ "fr": "Installé dans cet espace de travail : {{skills}}. Les compétences se chargent au démarrage d'une conversation, cette conversation ne peut donc pas encore les utiliser.",
+ "it": "Installato in questo workspace: {{skills}}. Le competenze vengono caricate all'avvio di una conversazione, quindi questa conversazione non può ancora usarle.",
+ "pt": "Instalado neste workspace: {{skills}}. As habilidades são carregadas quando uma conversa começa, então esta conversa ainda não pode usá-las.",
+ "es": "Instalado en este espacio de trabajo: {{skills}}. Las habilidades se cargan al iniciar una conversación, por lo que esta conversación aún no puede usarlas.",
+ "tr": "Bu çalışma alanına kuruldu: {{skills}}. Beceriler bir sohbet başladığında yüklenir, bu nedenle bu sohbet henüz bunları kullanamaz.",
+ "uk": "Встановлено в цьому робочому просторі: {{skills}}. Навички завантажуються під час початку розмови, тому ця розмова ще не може їх використовувати.",
+ "ca": "Instal·lat en aquest espai de treball: {{skills}}. Les habilitats es carreguen quan comença una conversa, per la qual cosa aquesta conversa encara no les pot utilitzar."
+ },
+ "SKILLS$INSTALL_BANNER_ACTION": {
+ "en": "Start new conversation with this skill",
+ "ja": "このスキルで新しい会話を開始",
+ "zh-CN": "使用此技能开始新会话",
+ "zh-TW": "使用此技能開始新對話",
+ "ko-KR": "이 스킬로 새 대화 시작",
+ "no": "Start ny samtale med denne ferdigheten",
+ "ar": "بدء محادثة جديدة بهذه المهارة",
+ "de": "Neue Konversation mit diesem Skill starten",
+ "fr": "Démarrer une nouvelle conversation avec cette compétence",
+ "it": "Avvia una nuova conversazione con questa competenza",
+ "pt": "Iniciar nova conversa com esta habilidade",
+ "es": "Iniciar una nueva conversación con esta habilidad",
+ "tr": "Bu beceriyle yeni sohbet başlat",
+ "uk": "Почати нову розмову з цією навичкою",
+ "ca": "Inicia una conversa nova amb aquesta habilitat"
+ },
"COMMON$CONTENT": {
"en": "Content",
"ja": "コンテンツ",
@@ -32011,21 +32045,21 @@
"ca": "Afegir des d'una conversa"
},
"SETTINGS$SKILLS_ADD_MODAL_CHAT_BODY": {
- "en": "In any chat, send the <cmd>/add-skill</cmd> command with a GitHub URL that points to the skill. OpenHands downloads the files into your workspace and makes the skill available immediately.",
- "ja": "任意のチャットで、スキルを指す GitHub URL を付けて <cmd>/add-skill</cmd> コマンドを送信します。OpenHands がファイルをワークスペースにダウンロードし、すぐに利用できるようにします。",
- "zh-CN": "在任何对话中,发送带有指向技能的 GitHub URL 的 <cmd>/add-skill</cmd> 命令。OpenHands 会将文件下载到您的工作区并立即可用。",
- "zh-TW": "在任何對話中,傳送带有指向技能的 GitHub URL 的 <cmd>/add-skill</cmd> 指令。OpenHands 會將檔案下載到您的工作區並立即可用。",
- "ko-KR": "채팅에서 스킬을 가리키는 GitHub URL과 함께 <cmd>/add-skill</cmd> 명령을 보내세요. OpenHands가 파일을 워크스페이스에 다운로드하고 즉시 사용할 수 있게 합니다.",
- "no": "I en hvilken som helst chat, send <cmd>/add-skill</cmd>-kommandoen med en GitHub-URL som peker til ferdigheten. OpenHands laster ned filene til arbeidsområdet ditt og gjør ferdigheten tilgjengelig med en gang.",
- "ar": "في أي محادثة، أرسل أمر <cmd>/add-skill</cmd> مع عنوان URL على GitHub يشير إلى المهارة. يقوم OpenHands بتنزيل الملفات إلى مساحة عملك ويجعل المهارة متاحة فورًا.",
- "de": "Senden Sie in jedem Chat den Befehl <cmd>/add-skill</cmd> mit einer GitHub-URL, die auf den Skill verweist. OpenHands lädt die Dateien in Ihren Workspace herunter und stellt den Skill sofort bereit.",
- "fr": "Dans n'importe quelle conversation, envoyez la commande <cmd>/add-skill</cmd> avec une URL GitHub pointant vers la compétence. OpenHands télécharge les fichiers dans votre espace de travail et rend la compétence disponible immédiatement.",
- "it": "In qualsiasi chat, invia il comando <cmd>/add-skill</cmd> con un URL GitHub che punta alla competenza. OpenHands scarica i file nel tuo workspace e rende la competenza disponibile subito.",
- "pt": "Em qualquer conversa, envie o comando <cmd>/add-skill</cmd> com uma URL do GitHub que aponte para a habilidade. O OpenHands baixa os arquivos para seu workspace e disponibiliza a habilidade imediatamente.",
- "es": "En cualquier chat, envíe el comando <cmd>/add-skill</cmd> con una URL de GitHub que apunte a la habilidad. OpenHands descarga los archivos en su espacio de trabajo y la habilidad queda disponible de inmediato.",
- "tr": "Herhangi bir sohbette, beceriyi işaret eden bir GitHub URL'si ile <cmd>/add-skill</cmd> komutunu gönderin. OpenHands dosyaları çalışma alanınıza indirir ve beceriyi hemen kullanılabilir hale getirir.",
- "uk": "У будь-якій розмові надішліть команду <cmd>/add-skill</cmd> з URL GitHub, що вказує на навичку. OpenHands завантажить файли у ваш робочий простір і одразу зробить навичку доступною.",
- "ca": "En qualsevol conversa, envieu l'ordre <cmd>/add-skill</cmd> amb un URL de GitHub que apunti a l'habilitat. OpenHands baixa els fitxers al vostre espai de treball i la habilitat queda disponible immediatament."
+ "en": "In any chat, send the <cmd>/add-skill</cmd> command with a GitHub URL that points to the skill. OpenHands downloads the files into your workspace. New skills load when a conversation starts — Canvas will offer to start one for you.",
+ "ja": "任意のチャットで、スキルを指す GitHub URL を付けて <cmd>/add-skill</cmd> コマンドを送信します。OpenHands がファイルをワークスペースにダウンロードします。新しいスキルは会話の開始時に読み込まれます — Canvas が新しい会話の開始を提案します。",
+ "zh-CN": "在任何对话中,发送带有指向技能的 GitHub URL 的 <cmd>/add-skill</cmd> 命令。OpenHands 会将文件下载到您的工作区。新技能在会话开始时加载 — Canvas 会为您提供开始新会话的选项。",
+ "zh-TW": "在任何對話中,傳送带有指向技能的 GitHub URL 的 <cmd>/add-skill</cmd> 指令。OpenHands 會將檔案下載到您的工作區。新技能會在對話開始時載入 — Canvas 會為您提供開始新對話的選項。",
+ "ko-KR": "채팅에서 스킬을 가리키는 GitHub URL과 함께 <cmd>/add-skill</cmd> 명령을 보내세요. OpenHands가 파일을 워크스페이스에 다운로드합니다. 새 스킬은 대화가 시작될 때 로드되며, Canvas가 새 대화 시작을 제안합니다.",
+ "no": "I en hvilken som helst chat, send <cmd>/add-skill</cmd>-kommandoen med en GitHub-URL som peker til ferdigheten. OpenHands laster ned filene til arbeidsområdet ditt. Nye ferdigheter lastes når en samtale starter — Canvas tilbyr å starte en for deg.",
+ "ar": "في أي محادثة، أرسل أمر <cmd>/add-skill</cmd> مع عنوان URL على GitHub يشير إلى المهارة. يقوم OpenHands بتنزيل الملفات إلى مساحة عملك. يتم تحميل المهارات الجديدة عند بدء المحادثة — وسيعرض Canvas بدء محادثة جديدة لك.",
+ "de": "Senden Sie in jedem Chat den Befehl <cmd>/add-skill</cmd> mit einer GitHub-URL, die auf den Skill verweist. OpenHands lädt die Dateien in Ihren Workspace herunter. Neue Skills werden beim Start einer Konversation geladen — Canvas bietet Ihnen an, eine zu starten.",
+ "fr": "Dans n'importe quelle conversation, envoyez la commande <cmd>/add-skill</cmd> avec une URL GitHub pointant vers la compétence. OpenHands télécharge les fichiers dans votre espace de travail. Les nouvelles compétences se chargent au démarrage d'une conversation — Canvas vous proposera d'en démarrer une.",
+ "it": "In qualsiasi chat, invia il comando <cmd>/add-skill</cmd> con un URL GitHub che punta alla competenza. OpenHands scarica i file nel tuo workspace. Le nuove competenze vengono caricate all'avvio di una conversazione — Canvas ti proporrà di avviarne una.",
+ "pt": "Em qualquer conversa, envie o comando <cmd>/add-skill</cmd> com uma URL do GitHub que aponte para a habilidade. O OpenHands baixa os arquivos para seu workspace. Novas habilidades são carregadas quando uma conversa começa — o Canvas oferecerá iniciar uma para você.",
+ "es": "En cualquier chat, envíe el comando <cmd>/add-skill</cmd> con una URL de GitHub que apunte a la habilidad. OpenHands descarga los archivos en su espacio de trabajo. Las nuevas habilidades se cargan al iniciar una conversación — Canvas le ofrecerá iniciar una.",
+ "tr": "Herhangi bir sohbette, beceriyi işaret eden bir GitHub URL'si ile <cmd>/add-skill</cmd> komutunu gönderin. OpenHands dosyaları çalışma alanınıza indirir. Yeni beceriler bir sohbet başladığında yüklenir — Canvas sizin için yeni bir sohbet başlatmayı önerir.",
+ "uk": "У будь-якій розмові надішліть команду <cmd>/add-skill</cmd> з URL GitHub, що вказує на навичку. OpenHands завантажить файли у ваш робочий простір. Нові навички завантажуються під час початку розмови — Canvas запропонує почати нову.",
+ "ca": "En qualsevol conversa, envieu l'ordre <cmd>/add-skill</cmd> amb un URL de GitHub que apunti a l'habilitat. OpenHands baixa els fitxers al vostre espai de treball. Les habilitats noves es carreguen quan comença una conversa — Canvas us oferirà iniciar-ne una."
},
"SETTINGS$SKILLS_ADD_MODAL_EXAMPLE_LABEL": {
"en": "Example",
@@ -32113,21 +32147,21 @@
"ca": "Verifica la instal·lació"
},
"SETTINGS$SKILLS_ADD_MODAL_STEP_5": {
- "en": "Make the skill available for this project right away",
- "ja": "スキルをこのプロジェクトですぐに利用可能にする",
- "zh-CN": "立即使技能在此项目中可用",
- "zh-TW": "立即使技能在此專案中可用",
- "ko-KR": "이 프로젝트에서 바로 스킬 사용 가능",
- "no": "Gjør ferdigheten tilgjengelig for dette prosjektet med en gang",
- "ar": "جعل المهارة متاحة لهذا المشروع على الفور",
- "de": "Skill sofort für dieses Projekt verfügbar machen",
- "fr": "Rendre la compétence disponible immédiatement pour ce projet",
- "it": "Rende la competenza disponibile subito per questo progetto",
- "pt": "Disponibilizar a habilidade para este projeto imediatamente",
- "es": "Hacer que la habilidad esté disponible para este proyecto de inmediato",
- "tr": "Beceriyi bu proje için hemen kullanılabilir hale getirir",
- "uk": "Одразу робить навичку доступною для цього проєкту",
- "ca": "Fa que l'habilitat estigui disponible per a aquest projecte immediatament"
+ "en": "Offer to start a new conversation where the skill is active",
+ "ja": "スキルが有効な新しい会話の開始を提案する",
+ "zh-CN": "提议开始一个已启用该技能的新会话",
+ "zh-TW": "提議開始一個已啟用該技能的新對話",
+ "ko-KR": "스킬이 활성화된 새 대화 시작 제안",
+ "no": "Tilby å starte en ny samtale der ferdigheten er aktiv",
+ "ar": "عرض بدء محادثة جديدة تكون فيها المهارة مفعّلة",
+ "de": "Anbieten, eine neue Konversation zu starten, in der der Skill aktiv ist",
+ "fr": "Proposer de démarrer une nouvelle conversation où la compétence est active",
+ "it": "Propone di avviare una nuova conversazione in cui la competenza è attiva",
+ "pt": "Oferecer iniciar uma nova conversa em que a habilidade está ativa",
+ "es": "Ofrecer iniciar una nueva conversación donde la habilidad esté activa",
+ "tr": "Becerinin etkin olduğu yeni bir sohbet başlatmayı önerir",
+ "uk": "Пропонує почати нову розмову, у якій навичка активна",
+ "ca": "Ofereix iniciar una conversa nova on l'habilitat estigui activa"
},
"SETTINGS$SKILLS_ADD_MODAL_URL_FORMATS_TITLE": {
"en": "Supported URL formats",
diff --git a/src/stores/skill-install-banner-store.ts b/src/stores/skill-install-banner-store.ts
new file mode 100644
index 0000000000..5b6c66db26
--- /dev/null
+++ b/src/stores/skill-install-banner-store.ts
@@ -0,0 +1,38 @@
+import { create } from "zustand";
+import { devtools } from "zustand/middleware";
+
+interface SkillInstallBannerState {
+ /**
+ * Install observation event ids the user dismissed. Session-only by
+ * design: the "skill not active in this conversation" condition persists
+ * across reloads, so the banner truthfully reappearing then is fine. A
+ * new install (new event id) resurfaces the banner after a dismissal;
+ * replays of the same event stay dismissed.
+ */
+ dismissedEventIds: Record<string, true>;
+}
+
+interface SkillInstallBannerActions {
+ dismiss: (eventIds: string[]) => void;
+}
+
+type SkillInstallBannerStore = SkillInstallBannerState &
+ SkillInstallBannerActions;
+
+const initialState: SkillInstallBannerState = { dismissedEventIds: {} };
+
+export const useSkillInstallBannerStore = create<SkillInstallBannerStore>()(
+ devtools(
+ (set) => ({
+ ...initialState,
+ dismiss: (eventIds) =>
+ set((s) => ({
+ dismissedEventIds: {
+ ...s.dismissedEventIds,
+ ...Object.fromEntries(eventIds.map((id) => [id, true as const])),
+ },
+ })),
+ }),
+ { name: "SkillInstallBannerStore" },
+ ),
+);
diff --git a/src/utils/skill-install-events.ts b/src/utils/skill-install-events.ts
new file mode 100644
index 0000000000..1af157309a
--- /dev/null
+++ b/src/utils/skill-install-events.ts
@@ -0,0 +1,57 @@
+import { OpenHandsEvent } from "#/types/agent-server/core";
+import { isExecuteBashObservationEvent } from "#/types/agent-server/type-guards";
+
+export interface DetectedSkillInstall {
+ /** Id of the bash observation event carrying the success marker. */
+ eventId: string;
+ skillName: string;
+ /** Workspace root the skill was installed into (forward slashes). */
+ workspacePath: string;
+}
+
+/**
+ * Success marker printed by the bundled add-skill skill's fetch_skill.py:
+ * ✅ Successfully installed '<name>' to <workspace>/.agents/skills/<name>
+ * Failures exit 1 and never print this line. Matched on output alone —
+ * `command` can be "" and `exit_code` can be -1 on soft-timeout
+ * continuation observations that still carry the full output.
+ */
+const INSTALL_SUCCESS_PATTERN =
+ /^✅ Successfully installed '([^']+)' to (.+)$/m;
+
+/**
+ * Skills the agent installed during this conversation via the add-skill
+ * flow. The SDK loads skills once at conversation start, so these are on
+ * disk but inert until a new conversation starts in `workspacePath`.
+ * Deduped per workspace+skill; a re-install (--force) keeps the latest
+ * event id and moves the entry to the end.
+ */
+export function detectSkillInstalls(
+ events: OpenHandsEvent[],
+): DetectedSkillInstall[] {
+ const byKey = new Map<string, DetectedSkillInstall>();
+
+ for (const event of events) {
+ if (!isExecuteBashObservationEvent(event)) continue;
+
+ const text = event.observation.content
+ .filter((c) => c.type === "text")
+ .map((c) => c.text)
+ .join("\n");
+ const match = text.match(INSTALL_SUCCESS_PATTERN);
+ if (!match) continue;
+
+ const skillName = match[1];
+ const dest = match[2].replace(/\\/g, "/").replace(/\/+$/, "");
+ const suffix = `/.agents/skills/${skillName}`;
+ if (!dest.endsWith(suffix)) continue;
+ const workspacePath = dest.slice(0, -suffix.length);
+ if (!workspacePath) continue;
+
+ const key = `${workspacePath}::${skillName}`;
+ byKey.delete(key);
+ byKey.set(key, { eventId: event.id, skillName, workspacePath });
+ }
+
+ return [...byKey.values()];
+}