Skip to content

Open-source Grok Bot alternative with a virtual machine that bots can use

Let a bot turn its own skills on, off or delete them after the person approves

AdityaUmaled7912a07ebe6
diff --git a/server/drivers/agents-call.ts b/server/drivers/agents-call.ts
index 956b7ea26f..3f53b354ae 100644
--- a/server/drivers/agents-call.ts
+++ b/server/drivers/agents-call.ts
@@ -2,6 +2,7 @@
// per-turn limits are the harness's, since one proxy can serve many turns of a warm engine.
import { agentsCallMember, resolveAgentsCall } from "../../shared/agents-tool-names.ts";
import { CREDENTIAL_TARGETS, isCredentialTargetId } from "../../shared/credential-request.ts";
+import { isSkillSwitchAction, skillSwitchVerb } from "../../shared/skill-request.ts";
import { peerName } from "../peer-roster.ts";
import { callCardTool, CARD_TOOL_NAMES } from "./agents-call-cards.ts";
@@ -830,8 +831,22 @@ export async function callTool(called: string, input: Json, context: ToolCallCon
return { text: `Imported skills:\n${live}\n\nStaged (waiting for the user's decision):\n${pending}` };
}
if (name === "skill_manage") {
+ if (isSkillSwitchAction(args.action)) {
+ const skillName = typeof args.skill_name === "string" ? args.skill_name.trim() : "";
+ const verb = skillSwitchVerb(args.action);
+ if (!skillName) return { text: `skill_manage needs skill_name to ${verb} a skill. Copy the exact name from skills_list.`, isError: true };
+ const r = await api("/api/internal/skills/stage", {
+ method: "POST",
+ body: JSON.stringify({ fromBotId: BOT_ID, fromThreadId: THREAD_ID, action: args.action, skill_name: skillName }),
+ });
+ const completed = completedProposalResult(r, `a request to ${verb} skill “${skillName}”`);
+ if (completed) return completed;
+ return {
+ text: `A confirmation card is now visible to the user to ${verb} skill “${skillName}”. Nothing changes until they approve it. End this turn and wait for the decision.`,
+ };
+ }
if (args.action !== "create" && args.action !== "update") {
- return { text: 'skill_manage action must be "create" or "update".', isError: true };
+ return { text: 'skill_manage action must be "create", "update", "enable", "disable" or "delete".', isError: true };
}
const skillMd = typeof args.skill_md === "string" ? args.skill_md : "";
if (!skillMd.trim()) {
diff --git a/server/drivers/agents-catalog-goldens/full.tools-list.json b/server/drivers/agents-catalog-goldens/full.tools-list.json
index 7108d3c4dc..6a8ce05cd5 100644
--- a/server/drivers/agents-catalog-goldens/full.tools-list.json
+++ b/server/drivers/agents-catalog-goldens/full.tools-list.json
@@ -1806,7 +1806,7 @@
},
{
"name": "skill_manage",
- "description": "Submit a new or updated reusable SKILL.md. Never update unless the user explicitly asked to revise that named skill. If the result is pending, a create stays inactive and an update leaves the current version unchanged. Read the result: it applies immediately at every access level, and the person sees it with an Undo where possible. If applied, continue the work without another confirmation. Only a pending result (a Cloud conversation its owner did not drive) means ending the turn to wait for the owner. Never claim success without an applied result; report failures honestly. This does not elevate another bot's execution permissions.",
+ "description": "Submit a new or updated reusable SKILL.md, or turn one of your own skills on, off, or delete it (always after the person approves). Never change a skill unless the user explicitly asked for that named skill. If the result is pending, a create stays inactive and an update leaves the current version unchanged. Read the result: it applies immediately at every access level, and the person sees it with an Undo where possible. If applied, continue the work without another confirmation. Only a pending result (a Cloud conversation its owner did not drive) means ending the turn to wait for the owner. Never claim success without an applied result; report failures honestly. This does not elevate another bot's execution permissions.",
"inputSchema": {
"type": "object",
"additionalProperties": false,
@@ -1815,17 +1815,20 @@
"type": "string",
"enum": [
"create",
- "update"
+ "update",
+ "enable",
+ "disable",
+ "delete"
],
- "description": "Create a uniquely named skill, or update one existing learned skill."
+ "description": "Create a uniquely named skill, update a learned one, or switch or delete one of your own."
},
"skill_name": {
"type": "string",
- "description": "Required for update: the exact existing name from skills_list. Omit for create."
+ "description": "Required for every action but create: the exact existing name from skills_list."
},
"skill_md": {
"type": "string",
- "description": "The full SKILL.md including YAML frontmatter. Example: ---\\nname: file-expense\\ndescription: Files an expense in the company portal.\\n---\\n\\n# File expense\\n"
+ "description": "Create/update: the full SKILL.md including YAML frontmatter. Example: ---\\nname: file-expense\\ndescription: Files an expense in the company portal.\\n---\\n\\n# File expense\\n"
},
"references": {
"type": "array",
@@ -1860,13 +1863,11 @@
},
"source": {
"type": "string",
- "description": "Required provenance label: the URL, folder, or 'conversation' used to author the skill."
+ "description": "Create/update: provenance label: the URL, folder, or 'conversation' used to author the skill."
}
},
"required": [
- "action",
- "skill_md",
- "source"
+ "action"
]
}
},
diff --git a/server/drivers/agents-catalog-goldens/profiles.json b/server/drivers/agents-catalog-goldens/profiles.json
index e675d1b85f..2027424509 100644
--- a/server/drivers/agents-catalog-goldens/profiles.json
+++ b/server/drivers/agents-catalog-goldens/profiles.json
@@ -206,8 +206,8 @@
]
},
"skills": {
- "bytes": 61440,
- "sha256": "7df02eaea1be351da79576114922079c85d7ec1440a15ff0c11421660823579f",
+ "bytes": 61581,
+ "sha256": "6e8f4195f095ac2fe50a4880cc6b64cdc0180d367c7e5826436607a03fdc2c91",
"tools": [
"tool_result_read",
"list_room_targets",
@@ -258,8 +258,8 @@
]
},
"skills+voice": {
- "bytes": 62221,
- "sha256": "841143392c57424cb8dbf56772577776768b5124e09c44c68cbfbc2ba08fd920",
+ "bytes": 62362,
+ "sha256": "e990781cc6e9a45f9e3b4d4aa32e70de1114bbe079c01e82c771ea06993d0193",
"tools": [
"tool_result_read",
"list_room_targets",
@@ -311,8 +311,8 @@
]
},
"skills+shared": {
- "bytes": 63705,
- "sha256": "2acff5f29463e21f80a82b5a73faf60a8984898227bd7d0ae0433e0a48dc2abd",
+ "bytes": 63846,
+ "sha256": "7c5df56504db13dfe4e368012a9d6b4d991698f060ebbdc752cf321853e723a1",
"tools": [
"tool_result_read",
"list_shared_computers",
@@ -365,8 +365,8 @@
]
},
"skills+shared+voice": {
- "bytes": 64486,
- "sha256": "b851e02dda62dbc0369536da72c5375ca8aba4d83ad4bc303454b6d3120f3e51",
+ "bytes": 64627,
+ "sha256": "612f5e87f39894ace3040f43b39b3be7390c97277a0239db258ce4f20e5e32fb",
"tools": [
"tool_result_read",
"list_shared_computers",
@@ -598,8 +598,8 @@
]
},
"skills+non-chief": {
- "bytes": 52224,
- "sha256": "5f96581a7d30ceed3acf9eafff9af545d1227cd1bfc7c2090786e8c81d0f2b7a",
+ "bytes": 52365,
+ "sha256": "61db2ce824324616b821d2ff2af98030d91f52d2a088cbb91a98fdcc5ad72ea5",
"tools": [
"tool_result_read",
"list_room_targets",
@@ -643,8 +643,8 @@
]
},
"skills+voice+non-chief": {
- "bytes": 53005,
- "sha256": "c4e12a8bb0cdbdcc69fc6c5372b14ecd076320193be91935b04836aa7902449e",
+ "bytes": 53146,
+ "sha256": "31998337cc3c3bcf83353ed2094c3140ed9ca305708f0153d67816a62d099b52",
"tools": [
"tool_result_read",
"list_room_targets",
@@ -689,8 +689,8 @@
]
},
"skills+shared+non-chief": {
- "bytes": 54489,
- "sha256": "00002c0b2658e97091f835c82d14f87db273179e289a60c689b063907d171912",
+ "bytes": 54630,
+ "sha256": "253289864d07fcf05087793ed2d0c346b0aa661b58538ef693d4e97fe43d3175",
"tools": [
"tool_result_read",
"list_shared_computers",
@@ -736,8 +736,8 @@
]
},
"skills+shared+voice+non-chief": {
- "bytes": 55270,
- "sha256": "6a64d1aae34d1f756cb0a71b5afa5a9e726083bd8a53e341398b1694324f9429",
+ "bytes": 55411,
+ "sha256": "615aca75654b7836766f4d0a645a0b52a45970ca45aba3e2d6b24a129463258a",
"tools": [
"tool_result_read",
"list_shared_computers",
@@ -784,8 +784,8 @@
]
},
"skills+shared+voice+cloud-home": {
- "bytes": 64252,
- "sha256": "8108e48100409323640013bcd340208a0e6b526c95758a9f15d2c27aba7949cd",
+ "bytes": 64393,
+ "sha256": "f753c543275ef60e48940a930e892decdf869f139b4dfd1a2465d086bb75ff71",
"tools": [
"tool_result_read",
"list_shared_computers",
@@ -839,8 +839,8 @@
]
},
"skills+shared+voice+non-chief+cloud-home": {
- "bytes": 55036,
- "sha256": "0eb8789580a40b38b74928671b1ca36ec22fe3ce96f2e787a443807c34007c34",
+ "bytes": 55177,
+ "sha256": "af346fb96aa07cfc3357ff67a242b7fcb6c8763b480b2bfff32705189bb2dd5d",
"tools": [
"tool_result_read",
"list_shared_computers",
@@ -887,8 +887,8 @@
]
},
"skills+shared+voice+escalations": {
- "bytes": 65316,
- "sha256": "cc4f6d10936c02cb28310e1870be3de7f2c56196a6fe23eb42c81361218cd8f2",
+ "bytes": 65457,
+ "sha256": "516885fcb1aa705fd6c1e06b44093a5f00928976ea63e0e2694d1a9b63429530",
"tools": [
"tool_result_read",
"list_shared_computers",
@@ -943,8 +943,8 @@
]
},
"skills+shared+voice+escalations+x": {
- "bytes": 69155,
- "sha256": "5e2fda297b2ce62ee238cde94612a5021dcbdf33d0f5cb6946fa965aa00e9d58",
+ "bytes": 69296,
+ "sha256": "a805f3035208d757dd568eefe4b9ee663558ed54a7846ebf5d6447c1400ad73c",
"tools": [
"tool_result_read",
"list_shared_computers",
@@ -1003,8 +1003,8 @@
]
},
"skills+shared+voice+escalations+x+team": {
- "bytes": 69787,
- "sha256": "d88b85a85a38d86b121f0f6b26653fe43630b4a64122fd69e609efae636d7326",
+ "bytes": 69928,
+ "sha256": "178f2b6280272459e445524223168a218b1ad1dfdeba3a8cbc9b31e416e47114",
"tools": [
"tool_result_read",
"list_shared_computers",
@@ -1166,8 +1166,8 @@
]
},
"skills+shared+voice+mausbot": {
- "bytes": 65137,
- "sha256": "c2447a27197dde714f9d7b30d729a93ab53ac7cacb75788a478cfeb64d262fdd",
+ "bytes": 65278,
+ "sha256": "5798b8fc0d4fb9267dd94376de171e1e126d8673cec52a0b1cadd621216b0a49",
"tools": [
"tool_result_read",
"list_shared_computers",
diff --git a/server/drivers/agents-catalog-wire.test.ts b/server/drivers/agents-catalog-wire.test.ts
index 2facd4026f..e80db79c15 100644
--- a/server/drivers/agents-catalog-wire.test.ts
+++ b/server/drivers/agents-catalog-wire.test.ts
@@ -97,8 +97,8 @@ const BUDGET_BASELINE: Record<string, number> = {
"skills+voice+non-chief": 52793,
"skills+shared+non-chief": 53965,
"skills+shared+voice+non-chief": 55058,
- "skills+shared+voice+cloud-home": 63096,
- "skills+shared+voice+non-chief+cloud-home": 53961,
+ "skills+shared+voice+cloud-home": 64393,
+ "skills+shared+voice+non-chief+cloud-home": 55177,
"default+legacy-switches": 58250,
"default+mausbot": 58901,
"skills+shared+voice+mausbot": 64766,
diff --git a/server/drivers/agents-catalog.ts b/server/drivers/agents-catalog.ts
index 467c57b8b7..903bca9313 100644
--- a/server/drivers/agents-catalog.ts
+++ b/server/drivers/agents-catalog.ts
@@ -746,24 +746,24 @@ const TOOL_DEFINITIONS = [
{
name: "skill_manage",
description:
- "Submit a new or updated reusable SKILL.md. Never update unless the user explicitly asked to revise that named skill. If the result is pending, a create stays inactive and an update leaves the current version unchanged." + APPLIES_OUTCOME,
+ "Submit a new or updated reusable SKILL.md, or turn one of your own skills on, off, or delete it (always after the person approves). Never change a skill unless the user explicitly asked for that named skill. If the result is pending, a create stays inactive and an update leaves the current version unchanged." + APPLIES_OUTCOME,
inputSchema: {
type: "object",
additionalProperties: false,
properties: {
action: {
type: "string",
- enum: ["create", "update"],
- description: "Create a uniquely named skill, or update one existing learned skill.",
+ enum: ["create", "update", "enable", "disable", "delete"],
+ description: "Create a uniquely named skill, update a learned one, or switch or delete one of your own.",
},
skill_name: {
type: "string",
- description: "Required for update: the exact existing name from skills_list. Omit for create.",
+ description: "Required for every action but create: the exact existing name from skills_list.",
},
skill_md: {
type: "string",
description:
- "The full SKILL.md including YAML frontmatter. Example: ---\\nname: file-expense\\ndescription: Files an expense in the company portal.\\n---\\n\\n# File expense\\n",
+ "Create/update: the full SKILL.md including YAML frontmatter. Example: ---\\nname: file-expense\\ndescription: Files an expense in the company portal.\\n---\\n\\n# File expense\\n",
},
references: {
type: "array",
@@ -790,10 +790,10 @@ const TOOL_DEFINITIONS = [
},
source: {
type: "string",
- description: "Required provenance label: the URL, folder, or 'conversation' used to author the skill.",
+ description: "Create/update: provenance label: the URL, folder, or 'conversation' used to author the skill.",
},
},
- required: ["action", "skill_md", "source"],
+ required: ["action"],
},
},
{
diff --git a/server/drivers/agents-proxy.test.ts b/server/drivers/agents-proxy.test.ts
index 4ab807b526..7621b7cf07 100644
--- a/server/drivers/agents-proxy.test.ts
+++ b/server/drivers/agents-proxy.test.ts
@@ -2006,8 +2006,8 @@ describe("agents-proxy MCP surface", () => {
const list = await rpc("tools/list");
const manage = list.result.tools.find((t: { name: string }) => t.name === "skill_manage");
expect(JSON.stringify(manage.inputSchema)).not.toMatch(/"(oneOf|anyOf|allOf|const|format)":/);
- expect(manage.inputSchema.required).toEqual(["action", "skill_md", "source"]);
- expect(manage.inputSchema.properties.action.enum).toEqual(["create", "update"]);
+ expect(manage.inputSchema.required).toEqual(["action"]);
+ expect(manage.inputSchema.properties.action.enum).toEqual(["create", "update", "enable", "disable", "delete"]);
const listed = await callTool("skills_list", {});
expect(listed.result.content[0].text).toContain("file-expense");
@@ -2075,6 +2075,28 @@ describe("agents-proxy MCP surface", () => {
expect(missingTarget.result.isError).toBe(true);
expect(missingTarget.result.content[0].text).toContain("needs skill_name");
expect(lastSkillStageBody).toBeNull();
+
+ const missingSkillMd = await callTool("skill_manage", { action: "create", source: "conversation" });
+ expect(missingSkillMd.result.isError).toBe(true);
+ expect(missingSkillMd.result.content[0].text).toContain("needs skill_md");
+ expect(lastSkillStageBody).toBeNull();
+ });
+
+ it("asks the person before a skill is turned on, turned off or deleted", async () => {
+ for (const [action, verb] of [["enable", "turn on"], ["disable", "turn off"], ["delete", "delete"]] as const) {
+ lastSkillStageBody = null;
+ const switched = await callTool("skill_manage", { action, skill_name: " learned-expense " });
+ expect(lastSkillStageBody).toEqual({ fromBotId: "bot-asker", fromThreadId: "thread-asker-routine", action, skill_name: "learned-expense" });
+ expect(switched.result.isError).toBeFalsy();
+ expect(switched.result.content[0].text).toContain(`to ${verb} skill “learned-expense”`);
+ expect(switched.result.content[0].text).toContain("wait for the decision");
+ }
+
+ lastSkillStageBody = null;
+ const unnamed = await callTool("skill_manage", { action: "delete" });
+ expect(unnamed.result.isError).toBe(true);
+ expect(unnamed.result.content[0].text).toContain("needs skill_name to delete a skill");
+ expect(lastSkillStageBody).toBeNull();
});
});
diff --git a/server/host/skills-library.ts b/server/host/skills-library.ts
index ef305056ff..53cf2ac373 100644
--- a/server/host/skills-library.ts
+++ b/server/host/skills-library.ts
@@ -361,7 +361,7 @@ export function createSkillsLibraryHost(deps: SkillsLibraryHostDeps) {
shareFromBot,
- undoReceipt(botId: string, threadId: string, message: Message, request: SkillRequestCardData & { shared: SkillShareRecord }): UndoResult {
+ undoReceipt(botId: string, threadId: string, message: Message, request: SkillRequestCardData & { action: "create" | "update"; shared: SkillShareRecord }): UndoResult {
const undone = undoSharedLearnedSkill({
authorId: botId,
name: request.name,
diff --git a/server/index.test.ts b/server/index.test.ts
index 262094cf5a..b7c5b0c003 100644
--- a/server/index.test.ts
+++ b/server/index.test.ts
@@ -11824,6 +11824,76 @@ describe("harness HTTP API", () => {
}
});
+ it("turns a bot's own skill on, off or deletes it only after the person approves its card", async () => {
+ const bot = (await api("POST", "/api/bots", {})).body.bot;
+ try {
+ expect((await api("PATCH", `/api/bots/${bot.id}`, {
+ modelSelection: { instanceId: "claude", model: "claude-sonnet-5" },
+ })).status).toBe(200);
+ const token = await mintTestCapability(BASE, bot.id, bot.threadId, { skillAuthoring: true });
+ const post = (body: Record<string, unknown>) => fetch(`${BASE}/api/internal/skills/stage`, {
+ method: "POST",
+ headers: { authorization: `Bearer ${token}`, "content-type": "application/json" },
+ body: JSON.stringify({ fromBotId: bot.id, fromThreadId: bot.threadId, ...body }),
+ });
+ const latestCard = async (action: string) => {
+ const messages = (await api("GET", "/api/bots")).body.bots.find((candidate: { id: string }) => candidate.id === bot.id).messages;
+ return messages.filter((message: any) => message.card?.skillRequest?.name === "switch-me" && message.card.skillRequest.action === action).at(-1).card;
+ };
+ const skill = async () => (await api("GET", `/api/bots/${bot.id}/skills`)).body.skills.find((entry: { name: string }) => entry.name === "switch-me");
+ const respond = (body: Record<string, unknown>) => api("POST", `/api/threads/${bot.threadId}/respond`, body);
+ const stage = async (action: string) => {
+ const response = await post({ action, skill_name: "switch-me" });
+ expect(response.status).toBe(201);
+ expect(await response.json()).toMatchObject({ state: "pending", name: "switch-me", action });
+ return latestCard(action);
+ };
+
+ expect((await post({
+ action: "create",
+ source: "conversation",
+ skill_md: "---\nname: switch-me\ndescription: Keeps notes.\n---\n\n# Switch me\n",
+ })).status).toBe(201);
+ expect(await skill()).toMatchObject({ enabled: true });
+
+ // Even with Full Access, turning a skill off waits for the card.
+ const off = await stage("disable");
+ expect(off).toMatchObject({ title: "Turn off skill \"switch-me\"?", options: ["Turn off", "Deny"] });
+ expect(off.answered).toBeUndefined();
+ expect(off.skillRequest.preview).toContain("# Switch me");
+ expect(await skill()).toMatchObject({ enabled: true });
+ expect((await respond({ requestId: off.requestId, behavior: "allow", reviewedSha256: "0".repeat(64) })).status).toBe(409);
+ expect(await skill()).toMatchObject({ enabled: true });
+ expect((await respond({ requestId: off.requestId, behavior: "allow", reviewedSha256: off.skillRequest.sha256 })).status).toBe(200);
+ expect(await skill()).toMatchObject({ enabled: false });
+ expect(await latestCard("disable")).toMatchObject({ answered: "allow", title: "Skill \"switch-me\" turned off" });
+ expect((await post({ action: "disable", skill_name: "switch-me" })).status).toBe(422);
+
+ // Saying no changes nothing.
+ const on = await stage("enable");
+ expect((await respond({ requestId: on.requestId, behavior: "deny" })).status).toBe(200);
+ expect(await skill()).toMatchObject({ enabled: false });
+ expect(await latestCard("enable")).toMatchObject({ answered: "deny" });
+ const onAgain = await stage("enable");
+ expect((await respond({ requestId: onAgain.requestId, behavior: "allow", reviewedSha256: onAgain.skillRequest.sha256 })).status).toBe(200);
+ expect(await skill()).toMatchObject({ enabled: true });
+
+ const gone = await stage("delete");
+ expect(gone).toMatchObject({ title: "Delete skill \"switch-me\"?", options: ["Delete", "Deny"] });
+ expect(await skill()).toBeDefined();
+ expect((await respond({ requestId: gone.requestId, behavior: "allow", reviewedSha256: gone.skillRequest.sha256 })).status).toBe(200);
+ expect(await skill()).toBeUndefined();
+
+ const missing = await post({ action: "enable", skill_name: "switch-me" });
+ expect(missing.status).toBe(422);
+ expect(((await missing.json()) as { error: string }).error).toContain("no skill named");
+ expect((await post({ action: "delete" })).status).toBe(400);
+ } finally {
+ await api("POST", `/api/bots/${bot.id}/interrupt`);
+ await api("DELETE", `/api/bots/${bot.id}`);
+ }
+ });
+
it("applies a bot's own learned skill at once and undoes it from its receipt", async () => {
const bot = (await api("POST", "/api/bots", {})).body.bot;
try {
diff --git a/server/index.ts b/server/index.ts
index 8104d276fa..d168eefcf3 100644
--- a/server/index.ts
+++ b/server/index.ts
@@ -99,7 +99,7 @@ import { createDataRoutes } from "./data/routes.ts";
import { DataSheetRegistry } from "./data/sheet.ts";
import { DataFailure } from "./data/types.ts";
import { TeamComputers, teamComputerOwner, type TeamComputerRecord } from "./team-computers.ts";
-import { isEffortLevel, type CardAnswerer, type ResolvedSender, type SignInRequestCardData, type WireBot, type WireGroup, type WireTask } from "../shared/wire.ts";
+import { isEffortLevel, type CardAnswerer, type OptionCardData, type ResolvedSender, type SignInRequestCardData, type WireBot, type WireGroup, type WireTask } from "../shared/wire.ts";
import { isPersistentQuestionCard, shouldSettleRequestCard } from "../shared/ask-question.ts";
import { parseToolScope } from "../shared/tool-scope.ts";
import type { TeamComputersPayload } from "../shared/team-computer.ts";
@@ -384,7 +384,9 @@ import { pickBotName } from "./names.ts";
import { botSkillTemplateSchema, newBotDefaultsSchema } from "./new-bot-defaults.ts";
import { expandLearnTurnText, learnSource } from "./skill-learn.ts";
import { connectedAppsForSetup, expandSetupTurnText, setupModeActive, setupSystemPrompt, type SetupConnectedApps } from "./setup-mode.ts"; import { forgetSetupPresser, setupPresser, setupTurnText, takeSetupRequest } from "./setup-request.ts"; import { setupSuggestionsFor } from "./setup-suggestions.ts"; import { createSetupRequestRoutes } from "./routes/setup-request.ts";
-import type { SkillRequestCardData } from "../shared/skill-request.ts";
+import { isSkillSwitchAction, type SkillRequestCardData, type SkillSwitchAction } from "../shared/skill-request.ts";
+import { setImportedSkillEnabled } from "./imported-skills.ts";
+import { skillSwitchCardCopy, skillSwitchStillMatches, skillSwitchTarget, type SwitchableSkill, type SkillSwitchTarget } from "./skill-switch.ts";
import { checkSoulDrift, readSoulDrift, soulFile, writeSoulMirror } from "./bot-folder.ts";
import {
botPersona,
@@ -9569,11 +9571,14 @@ function undoSkillCard(botId: string, threadId: string, messageId: string): Undo
if (request.botId !== botId || request.threadId !== threadId) {
return { claimed: true, state: "invalid", error: "this skill request belongs to a different bot", status: 403 };
}
- if (request.shared) return skillsHost.undoReceipt(botId, threadId, message, { ...request, shared: request.shared });
+ const action = request.action;
+ // A switch or delete always waited for the person, so it never has an undo.
+ if (isSkillSwitchAction(action)) return { claimed: true, state: "invalid", error: "This change was approved on its card and can't be undone here.", status: 409 };
+ if (request.shared) return skillsHost.undoReceipt(botId, threadId, message, { ...request, action, shared: request.shared });
const undone = undoSkillWrite(botId, {
stagedId: request.stagedId,
name: request.name,
- action: request.action,
+ action,
...(request.previous ? { previous: { skillMd: request.previous.preview, source: request.previous.source, references: request.previous.references ?? [] } } : {}),
});
if ("stale" in undone) return { claimed: true, state: "invalid", error: UNDO_STALE, status: 409, stale: true };
@@ -11450,6 +11455,99 @@ function appendSkillRequestCard(args: {
};
}
+/** The skill a bot asked to turn on, turn off or delete, as it is now. */
+function switchableSkill(bot: BotRecord, name: string): SwitchableSkill | undefined {
+ const own = listSkills(bot.id).find((skill) => skill.name === name);
+ if (own) return { kind: "own", enabled: own.enabled, text: readSkillFile(bot.id, name), source: own.source, description: own.description };
+ const seen = listBotSkills(bot).find((skill) => skill.name === name);
+ if (!seen) return undefined;
+ const imported = (seen as { origin?: string }).origin === "imported";
+ return { kind: imported ? "imported" : "fixed", enabled: seen.enabled, text: imported ? readBotSkillFile(bot, name) : null, source: seen.source, description: seen.description };
+}
+
+/** Turning a skill on or off, or deleting it, always waits for the person, even with Full Access. */
+function stageSkillSwitch(res: ServerResponse, from: BotRecord, threadId: string, action: SkillSwitchAction, body: Record<string, unknown>) {
+ const name = typeof body.skill_name === "string" ? body.skill_name.trim() : "";
+ if (!name) return json(res, 400, { error: `skill_name is required when action is ${action}` });
+ const persistence = skillProposalPersistence(from.id, threadId);
+ if (!persistence.ok) return json(res, persistence.status, { error: persistence.error });
+ const target = skillSwitchTarget(name, action, switchableSkill(from, name));
+ if ("error" in target) return json(res, 422, { error: target.error });
+ const card = appendSkillSwitchCard({ botId: from.id, threadId, action, name, target });
+ appendDecision(DATA_DIR, { threadId, requestId: card.requestId, botId: from.id, botName: from.name,
+ tool: "stage_skill", summary: card.summary, decision: "card-shown", source: "skill" });
+ return json(res, 201, { state: "pending", name, action, gist: target.gist, warnings: [], summary: card.summary });
+}
+
+function appendSkillSwitchCard(args: { botId: string; threadId: string; action: SkillSwitchAction; name: string; target: SkillSwitchTarget }): { requestId: string; summary: string } {
+ const requestId = randomUUID();
+ const copy = skillSwitchCardCopy(args.action, args.name, args.target.gist);
+ const payload: SkillRequestCardData = {
+ version: 1,
+ requestId,
+ botId: args.botId,
+ threadId: args.threadId,
+ // Nothing is staged: approval binds to the current SKILL.md through sha256.
+ stagedId: `switch-${requestId}`,
+ action: args.action,
+ name: args.name,
+ gist: args.target.gist,
+ ...(args.target.source ? { source: args.target.source } : {}),
+ preview: args.target.preview,
+ sha256: args.target.sha256,
+ warnings: [],
+ createdAt: Date.now(),
+ };
+ const from = store.bot(args.botId);
+ store.appendMessage(args.threadId, {
+ role: "bot",
+ kind: "options",
+ from: from ? { botId: from.id, name: from.name, color: from.color } : undefined,
+ card: { title: copy.title, subtitle: copy.subtitle, options: [copy.option, "Deny"], requestId, tool: "stage_skill", skillRequest: payload },
+ });
+ return { requestId, summary: copy.title };
+}
+
+function resolveSkillSwitch(
+ args: Parameters<typeof resolveSkillRequest>[0],
+ messageId: string,
+ card: OptionCardData,
+ request: SkillRequestCardData & { action: SkillSwitchAction },
+): ReturnType<typeof resolveSkillRequest> {
+ if (card.answered || card.dismissed) {
+ return { claimed: true, outcome: card.answered === "allow" ? "allowed-once" : "rejected", alreadySettled: true };
+ }
+ const decided = (decision: "user-approved" | "user-denied") => appendDecision(DATA_DIR, { threadId: args.threadId,
+ requestId: args.requestId, botId: args.botId, botName: args.botName, tool: card.tool, summary: card.subtitle, decision, source: "user" });
+ if (args.behavior !== "allow") {
+ store.patchMessage(args.threadId, messageId, { card: { ...card, answered: "deny", dismissed: true, held: undefined } });
+ decided("user-denied");
+ return { claimed: true, outcome: "rejected" };
+ }
+ if (!request.sha256 || args.reviewedSha256 !== request.sha256) {
+ return { claimed: true, status: 409, error: "reviewedSha256 must match the skill shown on the approval card" };
+ }
+ if (request.requestId !== args.requestId || request.threadId !== args.threadId) {
+ return { claimed: true, status: 422, error: "this approval card no longer matches its skill" };
+ }
+ const bot = store.bot(args.botId);
+ const current = bot ? switchableSkill(bot, request.name) : undefined;
+ const still = skillSwitchStillMatches(request.name, request.action, current, request.sha256);
+ const applied = "error" in still ? still
+ : request.action === "delete" ? removeSkill(args.botId, request.name)
+ : (current?.kind === "imported" ? setImportedSkillEnabled : setSkillEnabled)(args.botId, request.name, request.action === "enable");
+ if ("error" in applied) {
+ store.patchMessage(args.threadId, messageId, { card: { ...card, held: applied.error } });
+ return { claimed: true, status: 422, error: applied.error };
+ }
+ store.patchMessage(args.threadId, messageId, {
+ card: { ...card, answered: "allow", held: undefined, title: skillSwitchCardCopy(request.action, request.name, "").done },
+ });
+ skillReview.noteSkillChange(args.botId, args.threadId);
+ decided("user-approved");
+ return { claimed: true, outcome: "allowed-once" };
+}
+
function resolveSkillRequest(args: {
botId: string;
botName?: string;
@@ -11470,6 +11568,7 @@ function resolveSkillRequest(args: {
if (request.botId !== args.botId) {
return { claimed: true, status: 403, error: "this skill request belongs to a different bot" };
}
+ if (isSkillSwitchAction(request.action)) return resolveSkillSwitch(args, message.id, card, { ...request, action: request.action });
if (card.answered || card.dismissed) {
const cleanup = rejectStagedSkillWrite(args.botId, request.stagedId);
if ("applied" in cleanup && cleanup.applied && card.answered !== "allow") {
@@ -13822,6 +13921,7 @@ const handleRequest = async (req: IncomingMessage, res: ServerResponse) => {
if (!connectorThread(from.id, fromThreadId)) {
return json(res, 403, { error: "source conversation does not belong to sender" });
}
+ if (isSkillSwitchAction(body.action)) return stageSkillSwitch(res, from, fromThreadId, body.action, body);
const direct = appliesDirectly(from.id, fromThreadId);
const persistence = skillProposalPersistence(from.id, fromThreadId, !direct);
if (!persistence.ok) return json(res, persistence.status, { error: persistence.error });
diff --git a/server/skill-review.ts b/server/skill-review.ts
index 68f6b80bc8..91d1c834f0 100644
--- a/server/skill-review.ts
+++ b/server/skill-review.ts
@@ -7,6 +7,7 @@ import { mkdirSync, readFileSync } from "node:fs";
import { dirname } from "node:path";
import type { WireMessage } from "../shared/wire.ts";
+import type { SkillRequestAction } from "../shared/skill-request.ts";
import { writeFileAtomic } from "./atomic.ts";
import { MAX_SKILL_REVIEW_STEPS } from "./config.ts";
import { AUTHORING_STANDARDS } from "./skill-learn.ts";
@@ -22,6 +23,14 @@ export const SETTLE_TRIES = 5;
export const MAX_COUNTERS = 500;
export const TRANSCRIPT_TAIL = 40;
export const TRANSCRIPT_MAX_CHARS = 40_000;
+const SKILL_DONE: Record<SkillRequestAction, string> = {
+ create: "created",
+ update: "updated",
+ enable: "turned on",
+ disable: "turned off",
+ delete: "deleted",
+};
+
const FULL_LINE_MAX = 2_500;
export const SKILL_BODIES_MAX_CHARS = 30_000;
const SKILL_BODY_MAX_CHARS = 12_000;
@@ -82,7 +91,7 @@ function entriesFor(messages: readonly ReviewMessage[], bot: { id: string; name:
entries.push({ role: "tool", speaker: bot.name, text: `${message.tool.name}${message.tool.ok === false ? " (failed)" : ""}${detail ? `: ${detail}` : ""}` });
} else if (message.kind === "options" && message.card?.skillRequest && (message.card.skillRequest.botId === bot.id)) {
const request = message.card.skillRequest;
- const state = message.card.answered === "allow" ? (request.action === "create" ? "created" : "updated") : "proposed";
+ const state = message.card.answered === "allow" ? SKILL_DONE[request.action] : `${request.action} proposed`;
entries.push({ role: "skill", speaker: bot.name, text: `skill "${request.name}" ${state}` });
}
}
diff --git a/server/skill-switch.test.ts b/server/skill-switch.test.ts
new file mode 100644
index 0000000000..553264f66f
--- /dev/null
+++ b/server/skill-switch.test.ts
@@ -0,0 +1,50 @@
+import { createHash } from "node:crypto";
+
+import { describe, expect, it } from "vitest";
+
+import { skillSwitchCardCopy, skillSwitchStillMatches, skillSwitchTarget, type SwitchableSkill } from "./skill-switch.ts";
+
+const text = "---\nname: notes\ndescription: Keeps notes\n---\n# Notes\n";
+const own = (enabled: boolean): SwitchableSkill => ({ kind: "own", enabled, text, description: "Keeps notes" });
+const hash = (value: string) => createHash("sha256").update(value).digest("hex");
+
+describe("skillSwitchTarget", () => {
+ it("shows the current SKILL.md and binds the card to its hash", () => {
+ expect(skillSwitchTarget("notes", "disable", own(true))).toEqual({ preview: text, sha256: hash(text), gist: "Keeps notes" });
+ expect(skillSwitchTarget("notes", "enable", own(false))).toMatchObject({ sha256: hash(text) });
+ expect(skillSwitchTarget("notes", "delete", own(false))).toMatchObject({ sha256: hash(text) });
+ });
+
+ it("refuses what the bot can't change on its own", () => {
+ expect(skillSwitchTarget("ghost", "enable", undefined)).toEqual({ error: expect.stringContaining("no skill named \"ghost\"") });
+ expect(skillSwitchTarget("lib", "disable", { kind: "fixed", enabled: true, text: null })).toEqual({ error: expect.stringContaining("only the person can change it") });
+ expect(skillSwitchTarget("imp", "delete", { kind: "imported", enabled: true, text })).toEqual({ error: expect.stringContaining("turn it off instead") });
+ expect(skillSwitchTarget("imp", "disable", { kind: "imported", enabled: true, text })).toMatchObject({ sha256: hash(text) });
+ });
+
+ it("refuses a switch that would change nothing", () => {
+ expect(skillSwitchTarget("notes", "enable", own(true))).toEqual({ error: "skill \"notes\" is already on" });
+ expect(skillSwitchTarget("notes", "disable", own(false))).toEqual({ error: "skill \"notes\" is already off" });
+ });
+
+ it("refuses a skill that can't be shown", () => {
+ expect(skillSwitchTarget("notes", "delete", { ...own(true), text: null })).toEqual({ error: expect.stringContaining("can't be shown for review") });
+ });
+});
+
+describe("skillSwitchStillMatches", () => {
+ it("passes only for the same skill in the same state", () => {
+ expect(skillSwitchStillMatches("notes", "disable", own(true), hash(text))).toEqual({ ok: true });
+ expect(skillSwitchStillMatches("notes", "disable", { ...own(true), text: `${text}more\n` }, hash(text))).toEqual({ error: expect.stringContaining("changed after this card was shown") });
+ expect(skillSwitchStillMatches("notes", "disable", own(false), hash(text))).toEqual({ error: "skill \"notes\" is already off" });
+ expect(skillSwitchStillMatches("notes", "delete", undefined, hash(text))).toHaveProperty("error");
+ });
+});
+
+describe("skillSwitchCardCopy", () => {
+ it("names the action on the card and its button", () => {
+ expect(skillSwitchCardCopy("enable", "notes", "")).toMatchObject({ title: "Turn on skill \"notes\"?", option: "Turn on", done: "Skill \"notes\" turned on" });
+ expect(skillSwitchCardCopy("disable", "notes", "Keeps notes")).toMatchObject({ option: "Turn off", subtitle: expect.stringMatching(/^Keeps notes\n\n.*Nothing is deleted\.$/) });
+ expect(skillSwitchCardCopy("delete", "notes", "")).toMatchObject({ title: "Delete skill \"notes\"?", option: "Delete", done: "Skill \"notes\" deleted" });
+ });
+});
diff --git a/server/skill-switch.ts b/server/skill-switch.ts
new file mode 100644
index 0000000000..94b1cac3f5
--- /dev/null
+++ b/server/skill-switch.ts
@@ -0,0 +1,85 @@
+import { createHash } from "node:crypto";
+
+import { redactSecretsInText } from "./redact.ts";
+import type { SkillSwitchAction } from "../shared/skill-request.ts";
+
+/** own: in this bot's own skills; imported: brought in from this computer for every bot, switched per bot;
+ * fixed: shared from the team library or the engine's own, which only the person changes. */
+export type SwitchableSkillKind = "own" | "imported" | "fixed";
+
+export interface SwitchableSkill {
+ kind: SwitchableSkillKind;
+ enabled: boolean;
+ /** The current SKILL.md, or null when it no longer verifies. */
+ text: string | null;
+ source?: string;
+ description?: string;
+}
+
+export interface SkillSwitchTarget {
+ /** The current SKILL.md as the card shows it; approval binds to its hash. */
+ preview: string;
+ sha256: string;
+ source?: string;
+ gist: string;
+}
+
+/** Refuses what a bot may not change on its own card, before any card is shown. */
+export function skillSwitchTarget(
+ name: string,
+ action: SkillSwitchAction,
+ skill: SwitchableSkill | undefined,
+): SkillSwitchTarget | { error: string } {
+ if (!skill) return { error: `no skill named "${name}"; copy the exact name from skills_list` };
+ if (skill.kind === "fixed") {
+ return { error: `skill "${name}" is shared with this bot, not its own; only the person can change it, in the bot's Skills settings` };
+ }
+ if (action === "delete" && skill.kind === "imported") {
+ return { error: `skill "${name}" comes from this computer and can't be deleted from one bot; turn it off instead (action "disable")` };
+ }
+ if (action === "enable" && skill.enabled) return { error: `skill "${name}" is already on` };
+ if (action === "disable" && !skill.enabled) return { error: `skill "${name}" is already off` };
+ if (skill.text === null) {
+ return { error: `skill "${name}" changed outside OpenMausBot and can't be shown for review; the person can fix it in the bot's Skills settings` };
+ }
+ const preview = redactSecretsInText(skill.text);
+ return {
+ preview,
+ sha256: createHash("sha256").update(preview).digest("hex"),
+ ...(skill.source ? { source: skill.source } : {}),
+ gist: redactSecretsInText(skill.description ?? "").replace(/\s+/g, " ").trim(),
+ };
+}
+
+/** At approval the skill must still be the one the card showed, in the state it described. */
+export function skillSwitchStillMatches(
+ name: string,
+ action: SkillSwitchAction,
+ skill: SwitchableSkill | undefined,
+ sha256: string,
+): { ok: true } | { error: string } {
+ const target = skillSwitchTarget(name, action, skill);
+ if ("error" in target) return target;
+ return target.sha256 === sha256
+ ? { ok: true }
+ : { error: `skill "${name}" changed after this card was shown; ask the bot to propose it again` };
+}
+
+export function skillSwitchCardCopy(action: SkillSwitchAction, name: string, gist: string): {
+ title: string;
+ subtitle: string;
+ option: string;
+ done: string;
+} {
+ const lead = gist ? `${gist}\n\n` : "";
+ if (action === "enable") {
+ return { title: `Turn on skill "${name}"?`, option: "Turn on", done: `Skill "${name}" turned on`,
+ subtitle: `${lead}The bot can use this skill again.` };
+ }
+ if (action === "disable") {
+ return { title: `Turn off skill "${name}"?`, option: "Turn off", done: `Skill "${name}" turned off`,
+ subtitle: `${lead}The bot stops using this skill until it is turned on again. Nothing is deleted.` };
+ }
+ return { title: `Delete skill "${name}"?`, option: "Delete", done: `Skill "${name}" deleted`,
+ subtitle: `${lead}Removes this skill from the bot for good. Its SKILL.md is shown below if you want to keep a copy.` };
+}
diff --git a/shared/skill-request.ts b/shared/skill-request.ts
index fb28578bdb..b0f753415f 100644
--- a/shared/skill-request.ts
+++ b/shared/skill-request.ts
@@ -3,7 +3,19 @@
* SKILL.md reaches the bot's enabled skill index until the user confirms; during
* an update the approved version stays live.
*/
-export type SkillRequestAction = "create" | "update";
+export type SkillRequestAction = "create" | "update" | SkillSwitchAction;
+
+/** Turning one of the bot's existing skills on or off, or deleting it: no new
+ * SKILL.md, so the card shows the current one and approval binds to it. */
+export type SkillSwitchAction = "enable" | "disable" | "delete";
+
+export function isSkillSwitchAction(action: unknown): action is SkillSwitchAction {
+ return action === "enable" || action === "disable" || action === "delete";
+}
+
+export function skillSwitchVerb(action: SkillSwitchAction): string {
+ return action === "enable" ? "turn on" : action === "disable" ? "turn off" : "delete";
+}
/** Kept on the receipt so Undo reverts the library write and the assignments together. */
export interface SkillShareRecord {
@@ -55,7 +67,7 @@ export function reviewedSkillSha256(request: SkillRequestCardData): string | und
* an unknown or corrupted card answer into approval. */
export function skillRequestBehavior(answer: string): "allow" | "deny" {
const normalized = answer.trim().toLowerCase();
- return ["enable", "update", "apply", "allow", "allow once", "confirm", "yes"].includes(normalized)
+ return ["enable", "turn on", "turn off", "delete", "update", "apply", "allow", "allow once", "confirm", "yes"].includes(normalized)
? "allow"
: "deny";
}
diff --git a/src/components/ApprovalCard.tsx b/src/components/ApprovalCard.tsx
index 2e0f30727d..5f8d3eee13 100644
--- a/src/components/ApprovalCard.tsx
+++ b/src/components/ApprovalCard.tsx
@@ -11,7 +11,7 @@ import { niceDate, niceTime, scheduleLabel } from "@/lib/schedule-label";
import { cronScheduleLabel } from "../../shared/cron-label";
import { PROFILE_REQUEST_FIELDS, type ProfileRequestField } from "../../shared/profile-request";
import type { RoutineRequestSchedule } from "../../shared/routine-request";
-import type { SkillShareRecord } from "../../shared/skill-request";
+import { isSkillSwitchAction, type SkillShareRecord } from "../../shared/skill-request";
import { cardAutomation } from "@/lib/automations";
import { useOwnerOrAdmin } from "@/lib/use-owner-or-admin";
import { yourComputerAsk } from "@/lib/your-computer";
@@ -35,6 +35,9 @@ const ROUTINE_SETTLED_LABEL = {
const SKILL_SETTLED_LABEL = {
create: "approval.status.skillEnabled",
update: "approval.status.skillUpdated",
+ enable: "approval.status.skillTurnedOn",
+ disable: "approval.status.skillTurnedOff",
+ delete: "approval.status.skillDeleted",
} as const;
/** Schedules and webhooks alike are "automations" to a person. */
@@ -56,6 +59,9 @@ const WAIT_APPLIED_LINE = {
const SKILL_APPLIED_LINE = {
create: "approval.applied.skill.create",
update: "approval.applied.skill.update",
+ enable: "approval.applied.skill.enable",
+ disable: "approval.applied.skill.disable",
+ delete: "approval.applied.skill.delete",
} as const;
const PROFILE_FIELD_LABEL: Record<ProfileRequestField, LocaleKey> = {
@@ -72,7 +78,9 @@ const PROFILE_FIELD_LABEL: Record<ProfileRequestField, LocaleKey> = {
const staleRoutineCard = (card: OptionCardData) => Boolean(card.routineRequest && !card.answered);
/** The card brings its own question and answer words (its title and first option): team setup and MCP server changes. */
-export const titledCard = (card: OptionCardData | undefined) => Boolean(card?.teamSetupRequest || card?.mcpRequest);
+/** Cards whose server-written title and first option say what approving does. */
+export const titledCard = (card: OptionCardData | undefined) =>
+ Boolean(card?.teamSetupRequest || card?.mcpRequest || isSkillSwitchAction(card?.skillRequest?.action));
export function approvalCardOutcome(card: OptionCardData): string | undefined {
const isProposal = Boolean(card.routineRequest || card.skillRequest || card.profileRequest || card.modelRequest || titledCard(card));
diff --git a/src/components/CallView.tsx b/src/components/CallView.tsx
index cb561a2cfd..f92e979e4a 100644
--- a/src/components/CallView.tsx
+++ b/src/components/CallView.tsx
@@ -1,6 +1,7 @@
// Half-duplex: the dictation helper is Apple's SFSpeechRecognizer on raw AVAudioEngine input with no echo cancellation,
// so a mic open during playback transcribes the bot's own voice back. The buffer-backed recognizer does not finalize on
// silence; the helper ends the stream.
+import { isSkillSwitchAction, skillSwitchVerb } from "../../shared/skill-request";
import { useCallback, useEffect, useId, useRef, useState } from "react";
import { AudioLines, Check, ChevronDown, Loader2, Phone, PhoneOff, X } from "lucide-react";
@@ -692,7 +693,10 @@ function Call({ bot }: { bot: Bot }) {
submitted: false,
};
spokenIds.current.add(approval.message.id);
- const skillPrompt = approval.message.card?.skillRequest?.action === "update"
+ const skill = approval.message.card?.skillRequest;
+ const skillPrompt = skill && isSkillSwitchAction(skill.action)
+ ? `${bot.name} wants to ${skillSwitchVerb(skill.action)} the skill "${skill.name}". Open this chat to review it. You can say no to deny it.`
+ : skill?.action === "update"
? `${bot.name} wants to update a learned skill. Open this chat to review the complete skill before replacing the current version. You can say no to deny it.`
: `${bot.name} wants to enable a new learned skill. Open this chat to review the complete skill before enabling it. You can say no to deny it.`;
void sayThenListen(isSkillApproval(approval) ? skillPrompt : spokenApprovalPrompt(approval, bot.name));
diff --git a/src/components/GroupCallView.tsx b/src/components/GroupCallView.tsx
index de30496846..31a8a4495f 100644
--- a/src/components/GroupCallView.tsx
+++ b/src/components/GroupCallView.tsx
@@ -1,5 +1,6 @@
// Half-duplex like CallView: the native recognizer has no echo cancellation. Replies are queued so a fast second member
// never cuts off the first.
+import { isSkillSwitchAction, skillSwitchVerb } from "../../shared/skill-request";
import { useCallback, useEffect, useRef, useState } from "react";
import { Loader2, PhoneOff, X } from "lucide-react";
@@ -368,7 +369,10 @@ function GroupCall({ group, members }: { group: Group; members: Bot[] }) {
};
spokenIds.current.add(approval.message.id);
const name = member?.name ?? approval.message.from?.name ?? "A group member";
- const skillPrompt = approval.message.card?.skillRequest?.action === "update"
+ const skill = approval.message.card?.skillRequest;
+ const skillPrompt = skill && isSkillSwitchAction(skill.action)
+ ? `${name} wants to ${skillSwitchVerb(skill.action)} the skill "${skill.name}". Open the group thread to review it. You can say no to deny it.`
+ : skill?.action === "update"
? `${name} wants to update a learned skill. Open the group thread to review the complete skill before replacing the current version. You can say no to deny it.`
: `${name} wants to enable a new learned skill. Open the group thread to review the complete skill before enabling it. You can say no to deny it.`;
enqueueSpeech(isSkillApproval(approval) ? skillPrompt : spokenApprovalPrompt(approval, name), member, true);
diff --git a/src/components/SkillRequestPreview.tsx b/src/components/SkillRequestPreview.tsx
index 047488955c..9ebaf4d283 100644
--- a/src/components/SkillRequestPreview.tsx
+++ b/src/components/SkillRequestPreview.tsx
@@ -1,4 +1,12 @@
-import { reviewedSkillSha256, type SkillRequestCardData } from "../../shared/skill-request";
+import { reviewedSkillSha256, type SkillRequestAction, type SkillRequestCardData } from "../../shared/skill-request";
+
+const REVIEW_BEFORE: Record<SkillRequestAction, string> = {
+ create: "enabling",
+ update: "replacing the current version",
+ enable: "turning it on",
+ disable: "turning it off",
+ delete: "deleting it",
+};
/**
* Security: learned instructions render as inert plain text; the approval hash binds this exact preview to the staged
@@ -10,7 +18,7 @@ export function SkillRequestPreview({ request }: { request: SkillRequestCardData
return (
<div className="mt-3 rounded-lg border border-danger/30 bg-danger/5 p-3 text-[12px] leading-relaxed text-danger">
This proposal was created by an older build and cannot be safely applied. Deny it, then ask the bot to
- {request.action === "update" ? " propose the update again." : " create the skill again."}
+ {request.action === "create" ? " create the skill again." : request.action === "update" ? " propose the update again." : " ask again."}
</div>
);
}
@@ -18,7 +26,7 @@ export function SkillRequestPreview({ request }: { request: SkillRequestCardData
<div className="mt-3 rounded-lg border border-hairline/40 bg-inset p-3">
<div className="flex flex-wrap items-center justify-between gap-2 text-[11px] text-ink-secondary">
<span>
- Review the complete SKILL.md{request.references?.length ? " and its reference files" : ""} before {request.action === "update" ? "replacing the current version" : "enabling"}
+ Review the complete SKILL.md{request.references?.length ? " and its reference files" : ""} before {REVIEW_BEFORE[request.action]}
</span>
<span className="font-mono" title={`sha256 ${reviewedSha256}`}>
sha256 {reviewedSha256.slice(0, 8)}
diff --git a/src/locales/en.json b/src/locales/en.json
index 7686f3f943..d6f6262d58 100644
--- a/src/locales/en.json
+++ b/src/locales/en.json
@@ -830,6 +830,9 @@
"approval.status.routineDeleted": "Routine deleted",
"approval.status.skillEnabled": "Skill enabled",
"approval.status.skillUpdated": "Skill updated",
+ "approval.status.skillTurnedOn": "Skill turned on",
+ "approval.status.skillTurnedOff": "Skill turned off",
+ "approval.status.skillDeleted": "Skill deleted",
"approval.status.profileUpdated": "Profile updated",
"approval.status.routineConfirmed": "Routine confirmed",
"approval.status.skillConfirmed": "Skill confirmed",
@@ -847,6 +850,9 @@
"approval.applied.forBot": "for {target}",
"approval.applied.skill.create": "{name} added a skill: {title}",
"approval.applied.skill.update": "{name} updated a skill: {title}",
+ "approval.applied.skill.enable": "{name} turned on a skill: {title}",
+ "approval.applied.skill.disable": "{name} turned off a skill: {title}",
+ "approval.applied.skill.delete": "{name} deleted a skill: {title}",
"approval.applied.profileOwn": "{name} updated its profile: {title}",
"approval.applied.profileOther": "{name} updated {target}'s profile: {title}",
"approval.applied.modelOwn": "{name} changed its default model: {title}",