Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
Skills on all of a person's bots in one step
milind-sonib69cab10eed6
diff --git a/packages/phone-protocol/src/skill-request.ts b/packages/phone-protocol/src/skill-request.tsindex 0a70e54026..8086c1327e 100644--- a/packages/phone-protocol/src/skill-request.ts+++ b/packages/phone-protocol/src/skill-request.ts@@ -53,6 +53,8 @@ export interface SkillRequestCardData {previous?: { preview: string; source: string; references?: Array<{ path: string; content: string }>; enabled?: boolean };shared?: SkillShareRecord;shareError?: string;+ /** The change is to a skill on all of the person's bots, not this bot's own. */+ allBots?: true;}/** The hash a current client may echo after it displayed the completediff --git a/scripts/ci-scope.mjs b/scripts/ci-scope.mjsindex 99ff822fd4..1d1b2af5d5 100644--- a/scripts/ci-scope.mjs+++ b/scripts/ci-scope.mjs@@ -121,6 +121,7 @@ export const VITEST_SUBSETS = {"server/cloud-team-requests.e2e.test.ts","server/cloud-team-routines.e2e.test.ts","server/cloud-team-setup-request.e2e.test.ts",+ "server/cloud-team-skills-all-bots.e2e.test.ts","server/cloud-team-templates.e2e.test.ts","server/cloud-team.e2e.test.ts","server/host/brief-words.test.ts",diff --git a/scripts/ci-scope.test.ts b/scripts/ci-scope.test.tsindex f82d13afbb..362daf23f8 100644--- a/scripts/ci-scope.test.ts+++ b/scripts/ci-scope.test.ts@@ -261,6 +261,7 @@ describe("CI outputs", () => {"server/cloud-team-requests.e2e.test.ts","server/cloud-team-routines.e2e.test.ts","server/cloud-team-setup-request.e2e.test.ts",+ "server/cloud-team-skills-all-bots.e2e.test.ts","server/cloud-team-templates.e2e.test.ts","server/cloud-team.e2e.test.ts","server/host/brief-words.test.ts",diff --git a/server/cloud-team-skills-all-bots.e2e.test.ts b/server/cloud-team-skills-all-bots.e2e.test.tsnew file mode 100644index 0000000000..b0b5ceebd7--- /dev/null+++ b/server/cloud-team-skills-all-bots.e2e.test.ts@@ -0,0 +1,70 @@+// A skill on "all my bots" on a real Team Cloud: Ada (an Admin) puts one of her skills on all of her bots, and it reaches+// each bot she owns, one she makes later too, and never the Owner's; the Owner can neither put it on nor take it off+// Ada's bots, and a User cannot reach these routes at all (skills stay an admin's on a team, as before). Ada's switch on+// one bot is that bot's only, and one removal takes it off every bot of hers. The engine is the synthetic Claude CLI.+import { randomBytes } from "node:crypto";+import { afterAll, beforeAll, expect, it } from "vitest";+import { launchCloudSendFixture, type CloudSendFixture, type CloudTeamFixture } from "../scripts/testing/cloud-send-fixture.ts";+import { hostTimeout } from "./testing/host-timeout.ts";++const OLIVE = { email: "[email protected]", role: "owner" as const };+const ADA = { email: "[email protected]", role: "admin" as const };+const BOB = { email: "[email protected]", role: "member" as const };+const SKILL = "---\nname: client-onboarding\ndescription: Sets up a new client the way Ada does.\n---\n\n# Client onboarding\n\nMake the folder, then the intake sheet.\n";++type Bot = { id: string; name: string };+let fx: CloudSendFixture, team: CloudTeamFixture;+let olive = "", ada = "", bob = "";++beforeAll(async () => {+ fx = await launchCloudSendFixture({ onePasswordToken: `ops_fake-team-${randomBytes(8).toString("hex")}`, team: { id: "team-acme-1", name: "Acme" } });+ team = fx.team!;+ olive = (await team.pair(OLIVE)).token!;+ ada = (await team.pair(ADA)).token!;+ bob = (await team.pair(BOB)).token!;+}, hostTimeout(120_000));++afterAll(async () => {+ await fx?.close();+});++const create = async (token: string, name: string) => {+ const created = await team.as(token, "POST", "/api/bots", { name });+ expect(created.status, JSON.stringify(created.body)).toBe(201);+ return created.body.bot as Bot;+};+const skillsOf = async (bot: Bot) => {+ const listed = await team.as(olive, "GET", `/api/bots/${bot.id}/skills`);+ expect(listed.status, JSON.stringify(listed.body)).toBe(200);+ return (listed.body.skills as Array<{ name: string; enabled: boolean; allBots?: boolean }>).filter((skill) => skill.name === "client-onboarding");+};+const allBots = (token: string, bot: Bot) => team.as(token, "POST", `/api/bots/${bot.id}/skills/client-onboarding/all-bots`);++it("reaches only the person's own bots, and only that person can put it on or take it off", async () => {+ const adasWriter = await create(ada, "Ada's Writer");+ const adasResearcher = await create(ada, "Ada's Researcher");+ const olivesBot = await create(olive, "Olive's Helper");+ const added = await team.as(ada, "POST", `/api/bots/${adasWriter.id}/skill-template`, { name: "client-onboarding", description: "", source: "test", text: SKILL, enabled: true });+ expect(added.status, JSON.stringify(added.body)).toBe(201);++ expect((await allBots(olive, adasWriter)).status).toBe(403);+ expect((await allBots(bob, adasWriter)).status).toBe(403);+ const put = await allBots(ada, adasWriter);+ expect(put.status, JSON.stringify(put.body)).toBe(200);++ const later = await create(ada, "Ada's Later Bot");+ for (const bot of [adasWriter, adasResearcher, later]) {+ expect(await skillsOf(bot)).toEqual([expect.objectContaining({ enabled: true, allBots: true })]);+ }+ expect(await skillsOf(olivesBot)).toEqual([]);++ expect((await team.as(olive, "DELETE", `/api/bots/${adasResearcher.id}/skills/client-onboarding`)).status).toBe(403);+ expect(await skillsOf(adasResearcher)).toHaveLength(1);++ expect((await team.as(ada, "PATCH", `/api/bots/${adasResearcher.id}/skills/client-onboarding`, { enabled: false })).status).toBe(200);+ expect(await skillsOf(adasResearcher)).toEqual([expect.objectContaining({ enabled: false })]);+ expect(await skillsOf(adasWriter)).toEqual([expect.objectContaining({ enabled: true })]);++ expect((await team.as(ada, "DELETE", `/api/bots/${adasWriter.id}/skills/client-onboarding`)).status).toBe(200);+ for (const bot of [adasWriter, adasResearcher, later]) expect(await skillsOf(bot)).toEqual([]);+}, hostTimeout(120_000));diff --git a/server/drivers/agents-call.test.ts b/server/drivers/agents-call.test.tsindex 9bc17f0b02..e8a1e6a737 100644--- a/server/drivers/agents-call.test.ts+++ b/server/drivers/agents-call.test.ts@@ -222,7 +222,7 @@ describe("skill_manage", () => {const sent: unknown[] = [];const ctx = context({ client: { api: async (path) => { sent.push(path); return {}; }, apiResponse: async () => ({ ok: true, status: 200, body: {} }) } });expect(await callTool("skill_manage", { action: "save" }, ctx)).toEqual({- text: 'skill_manage action must be "create", "update", "import", "enable", "disable" or "delete". It takes action, skill_name, skill_md, references, gist, base_revision, source.',+ text: 'skill_manage action must be "create", "update", "import", "enable", "disable" or "delete". It takes action, skill_name, skill_md, references, gist, base_revision, source, all_bots.',isError: true,});expect((await callTool("skill_manage", { action: "create", source: "conversation" }, ctx)).text).toContain("---\\nname: file-expense\\ndescription:");diff --git a/server/drivers/agents-call.ts b/server/drivers/agents-call.tsindex 32a604bf67..f589287943 100644--- a/server/drivers/agents-call.ts+++ b/server/drivers/agents-call.ts@@ -888,7 +888,8 @@ export async function callTool(called: string, input: Json, context: ToolCallCon// Unreviewed imports: a hostile description is still prompt content, so only names and status.const revision = typeof row.revision === "string" ? `, shared with your team, revision ${row.revision}` : "";const unlisted = row.enabled && row.listed === false ? ", not in your prompt: search to read it" : "";- return `- ${row.name} (${row.enabled ? "enabled" : "disabled"}, ${row.editable === true ? "learned/editable" : "imported"}${revision}${unlisted})`;+ const everywhere = row.allBots === true ? ", on all your bots" : "";+ return `- ${row.name} (${row.enabled ? "enabled" : "disabled"}, ${row.editable === true ? "learned/editable" : "imported"}${everywhere}${revision}${unlisted})`;}).join("\n"): "(none)";const pending = staged.length@@ -940,7 +941,7 @@ export async function callTool(called: string, input: Json, context: ToolCallCon...(Array.isArray(args.references) ? { references: args.references } : {}),gist: typeof args.gist === "string" ? args.gist : undefined,base_revision: typeof args.base_revision === "string" ? args.base_revision : undefined,- source,+ source, ...(args.all_bots === true ? { all_bots: true } : {}),}),});const nameLabel = typeof r.name === "string" ? r.name : "the skill";diff --git a/server/drivers/agents-catalog-goldens/full.tools-list.json b/server/drivers/agents-catalog-goldens/full.tools-list.jsonindex f4c03948e0..a0fbfa984d 100644--- a/server/drivers/agents-catalog-goldens/full.tools-list.json+++ b/server/drivers/agents-catalog-goldens/full.tools-list.json@@ -2321,7 +2321,7 @@},{"name": "skill_manage",- "description": "Create or update a reusable skill (SKILL.md), import one from GitHub or skills.sh (action import with source; same review as create, brings SKILL.md and references/*.md), or turn one of your own skills on or off, or delete it. Never change a skill unless the person explicitly asked for that named skill. It applies at once, with an Undo where possible: read the result before saying it did. It never raises another bot's execution permissions.",+ "description": "Create or update a reusable skill (SKILL.md), import one from GitHub or skills.sh (action import with source; same review as create, brings SKILL.md and references/*.md), or turn one of your own skills on or off, or delete it. all_bots on create or import puts it on every bot the person has, including later ones, in one call; updating or deleting a skill skills_list marks \"on all your bots\" changes it on every one, and enable/disable switches it for you only. Never change a skill unless the person explicitly asked for that named skill. It applies at once, with an Undo where possible: read the result before saying it did. It never raises another bot's execution permissions.","inputSchema": {"type": "object","additionalProperties": false,@@ -2378,6 +2378,10 @@"source": {"type": "string","description": "create or update: the URL, folder or 'conversation' it came from. import: owner/repo, a GitHub link to the skill's folder or SKILL.md, or a skills.sh link."+ },+ "all_bots": {+ "type": "boolean",+ "description": "create or import: put it on all of the person's bots instead of only yours. Only when the person asked for that."}},"required": [diff --git a/server/drivers/agents-catalog-goldens/profiles.json b/server/drivers/agents-catalog-goldens/profiles.jsonindex a6cb649c9d..c93b151b83 100644--- a/server/drivers/agents-catalog-goldens/profiles.json+++ b/server/drivers/agents-catalog-goldens/profiles.json@@ -250,8 +250,8 @@]},"skills": {- "bytes": 64101,- "sha256": "0160213db9032f21882dc39b401ffe1fb21dda54199f95f1531d1571dada1e2f",+ "bytes": 64499,+ "sha256": "504aef63abaa549246bddfcb8262a624959392c9efd519c700235fabe40f64e2","tools": ["tool_result_read","list_room_targets",@@ -313,8 +313,8 @@]},"skills+voice": {- "bytes": 64882,- "sha256": "800c931994abae759bc15ab5ca830a8a6e6be80f5d2eebf8361a6f89ad14626c",+ "bytes": 65280,+ "sha256": "7be47b5b9edf5ee92bbb73e13c391e45fe0b985b6756ba2d02895d8eabd0ced1","tools": ["tool_result_read","list_room_targets",@@ -377,8 +377,8 @@]},"skills+shared": {- "bytes": 66366,- "sha256": "5d7009e528e0d4cb00606397b6b63a1de22369f34be95e47d3fccbeaecde2813",+ "bytes": 66764,+ "sha256": "4f13bae5624d35fcf13d13d909111f903cebf574692789f2992764cad765018c","tools": ["tool_result_read","list_shared_computers",@@ -442,8 +442,8 @@]},"skills+shared+voice": {- "bytes": 67147,- "sha256": "c5f5f299fdbfcf00c047a39d2b041b5ed23bb7a61017ac005fa9927beb70a23d",+ "bytes": 67545,+ "sha256": "56477e49960c1a54899108b28a4e91150e1fb861e482aad936f4ac355db385f7","tools": ["tool_result_read","list_shared_computers",@@ -730,8 +730,8 @@]},"skills+non-chief": {- "bytes": 55553,- "sha256": "5d2597438c2458d5022cac328cbe131e1d7e0100f16534a5954291c052a7fcec",+ "bytes": 55951,+ "sha256": "82a281e38499efada80bc6fcfde71ac12baf50a95d60f49faa978ab4e7e14c35","tools": ["tool_result_read","list_room_targets",@@ -786,8 +786,8 @@]},"skills+voice+non-chief": {- "bytes": 56334,- "sha256": "5a3c6e314f4a87b3ecc648235ecf006234126abe853eb2fb12088d058bdf8015",+ "bytes": 56732,+ "sha256": "d65a50e4c558b8397a1bb11de30429c442aad2bece5a24aae281b171cf91d64d","tools": ["tool_result_read","list_room_targets",@@ -843,8 +843,8 @@]},"skills+shared+non-chief": {- "bytes": 57818,- "sha256": "730a87897f3e29eb56d0701be4a91b865784083054f88724fbc3ca0432023aee",+ "bytes": 58216,+ "sha256": "63f633164e79d17af1b4d464bed3649e2bd31c008cd6c0c63d87f736dc44e334","tools": ["tool_result_read","list_shared_computers",@@ -901,8 +901,8 @@]},"skills+shared+voice+non-chief": {- "bytes": 58599,- "sha256": "4a3fc1361cd73cfc0f38efde9bc05d91674ccaaecb2721a43a948c750f90b1e9",+ "bytes": 58997,+ "sha256": "d65c170d9574942ee2603a8c49156065edbc56e3b8f9ce691321fd8583b9efda","tools": ["tool_result_read","list_shared_computers",@@ -960,8 +960,8 @@]},"skills+shared+voice+cloud-home": {- "bytes": 66903,- "sha256": "07f381781a3cbfa8dbb9d097bb2c75f859540b4381cc4d024fb687166de26b66",+ "bytes": 67301,+ "sha256": "081c478dbca7902462157e6d59e43302999f8c0714d71df23c768c41267a1cc2","tools": ["tool_result_read","list_shared_computers",@@ -1026,8 +1026,8 @@]},"skills+shared+voice+non-chief+cloud-home": {- "bytes": 58355,- "sha256": "046a03225d28d71c57ae5d492808a2f4d14753e13b9830fc80c7c147e0710b33",+ "bytes": 58753,+ "sha256": "f6e23c1841ab47e176bdd707d252e3355b04146336ba498f1d99f189c509cf0c","tools": ["tool_result_read","list_shared_computers",@@ -1085,8 +1085,8 @@]},"skills+shared+voice+x": {- "bytes": 70986,- "sha256": "e65cfaf1222643add8a1aa10cbcfd8dce4c557655656dad1a403e8bc445e8b47",+ "bytes": 71384,+ "sha256": "4df799f96a502614c18404e69815499d35350bca04edeed195dc9752b5b085f6","tools": ["tool_result_read","list_shared_computers",@@ -1155,8 +1155,8 @@]},"skills+shared+voice+x+team": {- "bytes": 70986,- "sha256": "e65cfaf1222643add8a1aa10cbcfd8dce4c557655656dad1a403e8bc445e8b47",+ "bytes": 71384,+ "sha256": "4df799f96a502614c18404e69815499d35350bca04edeed195dc9752b5b085f6","tools": ["tool_result_read","list_shared_computers",@@ -1225,8 +1225,8 @@]},"skills+shared+voice+x+team+images": {- "bytes": 72933,- "sha256": "6b6b7d35f7c99593183ec3e5e698e78079e93bb28b2e1e1436e26d70d7c1cfd7",+ "bytes": 73331,+ "sha256": "47004afef7777c96015fdb6d43e79bde906c3a4163e84649e11491b615ab80da","tools": ["tool_result_read","list_shared_computers",@@ -1421,8 +1421,8 @@]},"skills+shared+voice+mausbot": {- "bytes": 67798,- "sha256": "5387028d23473fb0e1f1e5506a3f0577e8ad933e1cd813e34117130746ae1abd",+ "bytes": 68196,+ "sha256": "4dc84c4c807f314b30aae88128f750e3fb8f762ef96426c6578e6fd3bea061cd","tools": ["tool_result_read","list_shared_computers",@@ -1713,8 +1713,8 @@]},"skills+shared+voice+x+team+images+hosting": {- "bytes": 74796,- "sha256": "8e0d1588e714acbf4660a60b934171badab4b6dd7be9e4aca346c4070ebd65d8",+ "bytes": 75194,+ "sha256": "d51aea236aa8118ffa7adfaae35081b1f59ed794df54acfafffabe8d9fef74d9","tools": ["tool_result_read","list_shared_computers",diff --git a/server/drivers/agents-catalog.ts b/server/drivers/agents-catalog.tsindex 5c065c70a6..e15d99453b 100644--- a/server/drivers/agents-catalog.ts+++ b/server/drivers/agents-catalog.ts@@ -734,7 +734,7 @@ const TOOL_DEFINITIONS = [{name: "skill_manage",description:- "Create or update a reusable skill (SKILL.md), import one from GitHub or skills.sh (action import with source; same review as create, brings SKILL.md and references/*.md), or turn one of your own skills on or off, or delete it. Never change a skill unless the person explicitly asked for that named skill." + APPLIES_OUTCOME,+ "Create or update a reusable skill (SKILL.md), import one from GitHub or skills.sh (action import with source; same review as create, brings SKILL.md and references/*.md), or turn one of your own skills on or off, or delete it. all_bots on create or import puts it on every bot the person has, including later ones, in one call; updating or deleting a skill skills_list marks \"on all your bots\" changes it on every one, and enable/disable switches it for you only. Never change a skill unless the person explicitly asked for that named skill." + APPLIES_OUTCOME,inputSchema: {type: "object",additionalProperties: false,@@ -759,6 +759,7 @@ const TOOL_DEFINITIONS = [gist: { type: "string", description: "Optional one-line summary of the change." },base_revision: { type: "string", description: "To update a skill shared with your team: its revision from skills_list." },source: { type: "string", description: "create or update: the URL, folder or 'conversation' it came from. import: owner/repo, a GitHub link to the skill's folder or SKILL.md, or a skills.sh link." },+ all_bots: { type: "boolean", description: "create or import: put it on all of the person's bots instead of only yours. Only when the person asked for that." },},required: ["action"],},diff --git a/server/host/skill-switch-host.ts b/server/host/skill-switch-host.tsindex 2b0129ce2e..593178b6a6 100644--- a/server/host/skill-switch-host.ts+++ b/server/host/skill-switch-host.ts@@ -12,6 +12,7 @@ import { appendDecision } from "../decision-log.ts";import { UNDO_STALE, type DirectApply } from "../direct-apply.ts";import { setImportedSkillEnabled } from "../imported-skills.ts";import { applySkillWriteWithReceipt, listSkills, readSkillFile, readSkillReferences, rejectStagedSkillWrite, removeSkill, setSkillEnabled, stageSkillWrite } from "../skills.ts";+import { setAllBotsSkillOff } from "../skills-for-all-bots.ts";import { skillSwitchCardCopy, skillSwitchStillMatches, skillSwitchTarget, type SkillSwitchTarget, type SwitchableSkill } from "../skill-switch.ts";import { conversationLanguage } from "../server-lines.ts";import type { BotRecord, Message, Store } from "../store.ts";@@ -61,6 +62,7 @@ export function createSkillSwitchHost(deps: SkillSwitchHostDeps) {const seen = deps.listBotSkills(bot).find((skill) => skill.name === name);if (!seen) return undefined;const imported = (seen as { origin?: string }).origin === "imported";+ if ((seen as { allBots?: boolean }).allBots) return { kind: "all-bots", enabled: seen.enabled, text: deps.readBotSkillFile(bot, name), source: seen.source, description: seen.description };return { kind: imported ? "imported" : "fixed", enabled: seen.enabled, text: imported ? deps.readBotSkillFile(bot, name) : null, source: seen.source, description: seen.description };}@@ -115,6 +117,8 @@ export function createSkillSwitchHost(deps: SkillSwitchHostDeps) {function apply(botId: string, name: string, action: SkillSwitchAction, kind: SwitchableSkill["kind"] | undefined) {if (action === "delete") return removeSkill(botId, name);+ // This bot's own switch for a skill on all of the person's bots; the others keep theirs.+ if (kind === "all-bots") return (setAllBotsSkillOff(botId, name, action === "disable"), { ok: true as const });return (kind === "imported" ? setImportedSkillEnabled : setSkillEnabled)(botId, name, action === "enable");}diff --git a/server/host/skills-for-all-bots-host.ts b/server/host/skills-for-all-bots-host.tsnew file mode 100644index 0000000000..d6754599f1--- /dev/null+++ b/server/host/skills-for-all-bots-host.ts@@ -0,0 +1,258 @@+// skill_manage on all of the person's bots in one call: create (or import) with all_bots, and update or delete of a skill+// that is already on all their bots. Like the bot's own skill changes, it applies directly with a receipt and Undo where+// those do, and otherwise waits on a card; approval applies only the exact files the card showed, pinned on the server.+// "All their bots" is the calling bot's person's (skills-for-all-bots.ts): on a Team Cloud the member it reports to, so a+// bot nobody owns is refused. Turning one on or off stays a per-bot switch (skill-switch-host.ts).+import { createHash, randomUUID } from "node:crypto";+import { mkdirSync, readFileSync, rmSync } from "node:fs";+import { dirname, join } from "node:path";+import { z } from "zod";++import type { SkillRequestCardData } from "../../shared/skill-request.ts";+import type { OptionCardData } from "../../shared/wire.ts";+import { writeFileAtomic } from "../atomic.ts";+import { appendDecision } from "../decision-log.ts";+import { UNDO_STALE, type DirectApply } from "../direct-apply.ts";+import { redactSecretsInText } from "../redact.ts";+import { conversationLanguage, serverLine, type ServerLineKey } from "../server-lines.ts";+import { learnSource } from "../skill-learn.ts";+import { parseSkillManageReferences } from "../skill-request-card.ts";+import { listSkills, preparedLearnedSkill, STAGED_GIST_MAX, STAGED_SKILL_FILE_MAX_BYTES } from "../skills.ts";+import { allBotsScopeOfBot, allBotsSkills, SKILLS_FOR_ALL_BOTS_DIR } from "../skills-for-all-bots.ts";+import { copyDigest, putOnAllBots, removeFromAllBots, restoreOwnCopies, sharedCopy, type RetiredCopy, type SkillCopy } from "../skills-for-all-bots-ops.ts";+import type { BotRecord, Message, Store } from "../store.ts";++type Action = "create" | "update" | "delete";+type Result = { status: number; body: Record<string, unknown> };++export interface SkillsForAllBotsHostDeps {+ store: Pick<Store, "bot" | "appendMessage" | "patchMessage">;+ dataDir: string;+ persistence(botId: string, threadId: string, opensCard: boolean): { ok: true } | { ok: false; status: number; error: string };+ noteSkillChange(botId: string, threadId: string): void;+}++const fileSchema = z.object({ path: z.string(), content: z.string(), base64: z.boolean().optional() });+const copySchema = z.object({ skillMd: z.string(), files: z.array(fileSchema), source: z.string() });+const recordSchema = z.object({+ scope: z.string(), action: z.enum(["create", "update", "delete"]), name: z.string(), digest: z.string(),+ copy: copySchema.optional(), previous: copySchema.optional(),+ retired: z.array(z.object({ botId: z.string(), wasOff: z.boolean(), copy: copySchema })).optional(),+});+type StoredCopy = z.infer<typeof copySchema>;+type SkillRecord = z.infer<typeof recordSchema>;++const stored = (copy: SkillCopy): StoredCopy => ({+ skillMd: copy.skillMd, source: copy.source,+ files: copy.files.map((file) => typeof file.content === "string" ? { path: file.path, content: file.content } : { path: file.path, content: Buffer.from(file.content).toString("base64"), base64: true }),+});+const loaded = (copy: StoredCopy): SkillCopy => ({+ skillMd: copy.skillMd, source: copy.source,+ files: copy.files.map((file) => ({ path: file.path, content: file.base64 ? new Uint8Array(Buffer.from(file.content, "base64")) : file.content })),+});++const OPTION: Record<Action, string> = { create: "Enable", update: "Update", delete: "Delete" };+const LINES = {+ create: { title: "server.allBotsSkill.create.title", done: "server.allBotsSkill.create.done" },+ update: { title: "server.allBotsSkill.update.title", done: "server.allBotsSkill.update.done" },+ delete: { title: "server.allBotsSkill.delete.title", done: "server.allBotsSkill.delete.done" },+} as const satisfies Record<Action, { title: ServerLineKey; done: ServerLineKey }>;++/** The skill a bot's skill_manage call means to change on all of the person's bots, or null when it is about the bot's own. */+function claimed(bot: BotRecord, body: Record<string, unknown>): { action: Action; name: string } | null {+ const name = typeof body.skill_name === "string" ? body.skill_name.trim() : "";+ if ((body.action === "create" || body.action === "import") && body.all_bots === true) return { action: "create", name };+ if (body.action !== "update" && body.action !== "delete") return null;+ if (body.all_bots !== true && (!name || listSkills(bot.id).some((skill) => skill.name === name) || !allBotsSkills(bot.id).some((skill) => skill.name === name))) return null;+ return { action: body.action, name };+}++export function createSkillsForAllBotsHost(deps: SkillsForAllBotsHostDeps) {+ const { store } = deps;+ const recordPath = (requestId: string) => join(deps.dataDir, SKILLS_FOR_ALL_BOTS_DIR, "requests", `${requestId}.json`);+ const readRecord = (requestId: string): SkillRecord | null => {+ try {+ const parsed = recordSchema.safeParse(JSON.parse(readFileSync(recordPath(requestId), "utf8")));+ return parsed.success ? parsed.data : null;+ } catch { return null; }+ };+ const writeRecord = (requestId: string, record: SkillRecord) => {+ mkdirSync(dirname(recordPath(requestId)), { recursive: true, mode: 0o700 });+ writeFileAtomic(recordPath(requestId), `${JSON.stringify(record)}\n`, { mode: 0o600 });+ };+ const dropRecord = (requestId: string) => rmSync(recordPath(requestId), { force: true });++ /** The new files a create or update brings, checked as a bot's own learned skill is. */+ function proposed(body: Record<string, unknown>, action: "create" | "update", name: string): { copy: SkillCopy; name: string; gist: string; warnings: string[] } | { error: string } {+ const skillMd = redactSecretsInText(typeof body.skill_md === "string" ? body.skill_md : "");+ if (!skillMd.trim()) return { error: "skill_manage needs skill_md: the full SKILL.md including YAML frontmatter" };+ if (Buffer.byteLength(skillMd, "utf8") > STAGED_SKILL_FILE_MAX_BYTES) return { error: `SKILL.md files must be at most ${STAGED_SKILL_FILE_MAX_BYTES / 1024}KB` };+ const source = typeof body.source === "string" ? body.source.trim() : "";+ if (!source) return { error: 'source must be a URL, folder, or "conversation"' };+ const references = parseSkillManageReferences(body.references);+ if ("error" in references) return references;+ const prepared = preparedLearnedSkill([{ path: "SKILL.md", content: skillMd }, ...references.map((file) => ({ path: file.path, content: redactSecretsInText(file.content) }))]);+ if ("error" in prepared) return prepared;+ if (action === "update" && prepared.parsed.name !== name) return { error: `updated SKILL.md name must remain "${name}"` };+ const gist = redactSecretsInText(typeof body.gist === "string" ? body.gist : "").replace(/\s+/g, " ").trim().slice(0, STAGED_GIST_MAX) || prepared.parsed.description.slice(0, STAGED_GIST_MAX);+ return { copy: { skillMd: prepared.files[0]!.content, files: prepared.files.slice(1), source: learnSource(source) }, name: prepared.parsed.name, gist, warnings: prepared.warnings };+ }++ function appendCard(args: { requestId: string; bot: BotRecord; threadId: string; action: Action; name: string; gist: string; preview: string; source: string; warnings: string[]; applied?: { previous?: SkillRequestCardData["previous"] } }): string {+ const language = conversationLanguage(args.threadId);+ const preview = redactSecretsInText(args.preview);+ const payload: SkillRequestCardData = {+ version: 1, requestId: args.requestId, botId: args.bot.id, threadId: args.threadId, stagedId: `all-bots-${args.requestId}`,+ action: args.action, name: args.name, gist: args.gist, source: args.source, preview, sha256: createHash("sha256").update(preview).digest("hex"),+ warnings: args.warnings, createdAt: Date.now(), allBots: true, ...(args.applied?.previous ? { previous: args.applied.previous } : {}),+ };+ const title = serverLine(language, LINES[args.action].title, { name: args.name });+ const done = serverLine(language, LINES[args.action].done, { name: args.name });+ const body = serverLine(language, args.action === "delete" ? "server.allBotsSkill.deleteBody" : "server.allBotsSkill.body");+ const warnings = args.warnings.length ? `\n\nWarnings:\n- ${args.warnings.join("\n- ")}` : "";+ store.appendMessage(args.threadId, {+ role: "bot", kind: "options", from: { botId: args.bot.id, name: args.bot.name, color: args.bot.color },+ card: {+ title, subtitle: `${args.gist ? `${args.gist}\n\n` : ""}${body}${warnings}`, options: args.applied ? [] : [OPTION[args.action], "Deny"],+ ...(args.applied ? { answered: "allow" as const, autoApplied: true, title: done } : {}),+ requestId: args.requestId, tool: "stage_skill", skillRequest: payload,+ },+ });+ return args.applied ? done : title;+ }++ /** Applies a recorded change; what Undo needs goes back into the record. */+ function apply(record: SkillRecord): { ok: true; record: SkillRecord; kept: string[] } | { error: string } {+ const current = sharedCopy(record.scope, record.name);+ if (record.action === "delete") {+ if (!current || copyDigest(current) !== record.digest) return { error: `skill "${record.name}" changed after this card was shown; ask the bot to propose it again` };+ const removed = removeFromAllBots(record.scope, record.name);+ return "error" in removed ? removed : { ok: true, record: { ...record, previous: stored(removed.removed) }, kept: [] };+ }+ if (record.action === "create" && current) return { error: `"${record.name}" is already on all your bots; update it instead` };+ if (record.action === "update" && (!current || copyDigest(current) !== record.digest)) return { error: `skill "${record.name}" changed after this card was shown; ask the bot to propose it again` };+ const copy = loaded(record.copy!);+ const put = putOnAllBots(record.scope, record.name, copy, { fresh: record.action === "create" });+ if ("error" in put) return put;+ return { ok: true, record: { ...record, digest: copyDigest(copy), ...(current ? { previous: stored(current) } : {}), retired: put.retired.map((one) => ({ ...one, copy: stored(one.copy) })) }, kept: put.kept };+ }++ const keptLine = (kept: readonly string[]) => {+ const names = kept.map((id) => store.bot(id)?.name).filter(Boolean);+ return names.length ? ` Kept their own different copy: ${names.join(", ")}.` : "";+ };++ /** Null when the call is about the bot's own skill; then the usual paths take it. */+ async function stage(from: BotRecord, threadId: string, received: Record<string, unknown>, direct: () => DirectApply | null,+ withImport: (body: Record<string, unknown>) => Promise<Record<string, unknown> | { importError: string }>, active: () => boolean): Promise<Result | null> {+ const claim = claimed(from, received);+ if (!claim) return null;+ const scope = allBotsScopeOfBot(store.bot(from.id));+ if (!scope) return { status: 422, body: { error: "This bot belongs to no one on this team, so it has no \"all my bots\". Ask the person to have their own Chief of Staff do it, or add the skill to this bot alone without all_bots." } };+ const body = claim.action === "create" ? await withImport(received) : received;+ if ("importError" in body) return { status: 422, body: { error: body.importError } };+ if (!active()) return { status: 401, body: { error: "This turn has ended." } };+ const applies = direct();+ const persistence = deps.persistence(from.id, threadId, !applies);+ if (!persistence.ok) return { status: persistence.status, body: { error: persistence.error } };+ let record: SkillRecord, gist: string, warnings: string[] = [], preview: string, source: string;+ if (claim.action === "delete") {+ const current = sharedCopy(scope, claim.name);+ if (!current) return { status: 422, body: { error: `no skill named "${claim.name}" is on all your bots; copy the exact name from skills_list` } };+ record = { scope, action: "delete", name: claim.name, digest: copyDigest(current) };+ gist = ""; preview = current.skillMd; source = current.source;+ } else {+ const change = proposed(body, claim.action, claim.name);+ if ("error" in change) return { status: 422, body: { error: change.error } };+ const current = sharedCopy(scope, change.name);+ if (claim.action === "create" && current) return { status: 422, body: { error: `"${change.name}" is already on all your bots; update it instead (action "update")` } };+ if (claim.action === "update" && !current) return { status: 422, body: { error: `no skill named "${claim.name}" is on all your bots; to put one on all of them, call create with all_bots and its full SKILL.md` } };+ record = { scope, action: claim.action, name: change.name, digest: current ? copyDigest(current) : "", copy: stored(change.copy) };+ ({ gist, warnings } = change); preview = change.copy.skillMd; source = change.copy.source;+ }+ const requestId = randomUUID();+ if (applies) {+ const applied = apply(record);+ if ("error" in applied) return { status: 422, body: { state: "failed", error: applied.error } };+ writeRecord(requestId, applied.record);+ const previous = applied.record.previous ? { preview: applied.record.previous.skillMd, source: applied.record.previous.source } : undefined;+ const done = appendCard({ requestId, bot: from, threadId, action: claim.action, name: record.name, gist, preview, source, warnings, applied: { previous } });+ appendDecision(deps.dataDir, { threadId, requestId, botId: from.id, botName: from.name, tool: "stage_skill", summary: done, decision: "auto-approved", source: applies });+ deps.noteSkillChange(from.id, threadId);+ return { status: 201, body: { state: "applied", name: record.name, action: claim.action, allBots: true, warnings, summary: `${done}.${keptLine(applied.kept)}` } };+ }+ writeRecord(requestId, record);+ let summary: string;+ try {+ summary = appendCard({ requestId, bot: from, threadId, action: claim.action, name: record.name, gist, preview, source, warnings });+ } catch (error) {+ dropRecord(requestId);+ throw error;+ }+ appendDecision(deps.dataDir, { threadId, requestId, botId: from.id, botName: from.name, tool: "stage_skill", summary, decision: "card-shown", source: "skill" });+ return { status: 201, body: { state: "pending", name: record.name, action: claim.action, allBots: true, warnings, summary } };+ }++ function resolve(args: { botId: string; botName?: string; threadId: string; requestId: string; behavior: "allow" | "deny" | "answer"; reviewedSha256?: string },+ messageId: string, card: OptionCardData, request: SkillRequestCardData):+ | { claimed: true; status: number; error: string }+ | { claimed: true; outcome: "allowed-once" | "rejected"; alreadySettled?: true } {+ 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(deps.dataDir, { 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 } });+ dropRecord(request.requestId);+ 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" };+ const record = readRecord(request.requestId);+ const applied = record && record.name === request.name ? apply(record) : { error: "this approval card no longer matches its skill" };+ if ("error" in applied) {+ store.patchMessage(args.threadId, messageId, { card: { ...card, held: applied.error } });+ return { claimed: true, status: 422, error: applied.error };+ }+ writeRecord(request.requestId, applied.record);+ const done = serverLine(conversationLanguage(args.threadId), LINES[applied.record.action].done, { name: request.name });+ store.patchMessage(args.threadId, messageId, { card: { ...card, answered: "allow", held: undefined, title: done } });+ deps.noteSkillChange(args.botId, args.threadId);+ decided("user-approved");+ return { claimed: true, outcome: "allowed-once" };+ }++ /** Puts things back as they were before the change, while nothing has changed the skill since. */+ function undo(botId: string, threadId: string, message: Message, request: SkillRequestCardData):+ | { claimed: true; state: "undone" }+ | { claimed: true; state: "invalid"; error: string; status: number; stale?: true } {+ const record = readRecord(request.requestId);+ if (!record) return { claimed: true, state: "invalid", error: "This change can't be undone here.", status: 409 };+ const current = sharedCopy(record.scope, record.name);+ const stale = { claimed: true as const, state: "invalid" as const, error: UNDO_STALE, status: 409, stale: true as const };+ let undone: { ok: true } | { error: string };+ if (record.action === "delete") {+ if (current || !record.previous) return stale;+ const put = putOnAllBots(record.scope, record.name, loaded(record.previous), { fresh: false });+ undone = "error" in put ? put : { ok: true };+ } else {+ if (!current || copyDigest(current) !== record.digest) return stale;+ if (record.previous) {+ const put = putOnAllBots(record.scope, record.name, loaded(record.previous), { fresh: false });+ undone = "error" in put ? put : { ok: true };+ } else {+ const removed = removeFromAllBots(record.scope, record.name);+ undone = "error" in removed ? removed : { ok: true };+ }+ if ("ok" in undone) restoreOwnCopies(record.name, (record.retired ?? []).map((one): RetiredCopy => ({ ...one, copy: loaded(one.copy) })));+ }+ if ("error" in undone) return { claimed: true, state: "invalid", error: undone.error, status: 409 };+ dropRecord(request.requestId);+ if (message.card) store.patchMessage(threadId, message.id, { card: { ...message.card, undone: true } });+ deps.noteSkillChange(botId, threadId);+ return { claimed: true, state: "undone" };+ }++ return { stage, resolve, undo };+}++export type SkillsForAllBotsHost = ReturnType<typeof createSkillsForAllBotsHost>;diff --git a/server/host/skills-library.ts b/server/host/skills-library.tsindex cfe85329ff..8c53d8a5d4 100644--- a/server/host/skills-library.ts+++ b/server/host/skills-library.ts@@ -18,6 +18,7 @@ import { readSectionContext } from "../section-context.ts";import { librarySkillFilePath, librarySkillOptOuts, listLibrarySkills, readLibrarySkillFile, readSkillLibraryIndex, skillsLibraryEnabled } from "../skill-library.ts";import { findWorkflowSkill, skillBurgerEnabled, workflowSkillsPrompt } from "../skill-burger/store.ts";import { librarySkillFiles, ownSkillFiles, type StoredSkillFiles } from "../skill-side-files.ts";+import { allBotsRootOfBot, allBotsSkillFile, readAllBotsSkillFile } from "../skills-for-all-bots.ts";import {conversationAssignedSkills,prepareShareNote,@@ -90,7 +91,7 @@ export function createSkillsLibraryHost(deps: SkillsLibraryHostDeps) {/** The bot's own skills, and its library skills while the library is on; an imported skill of the same name yields. */const ownSkills = (bot: BotRecord) =>- skillsLibraryEnabled(cfg) ? resolveBotSkills(bot.id, bot.assignedSkills ?? []) : listSkills(bot.id);+ resolveBotSkills(bot.id, skillsLibraryEnabled(cfg) ? bot.assignedSkills ?? [] : undefined);/** What the bot is for, as its settings and its department's shared instructions say: what its skills from this* computer are picked by. */const aboutBot = (bot: BotRecord): string => {@@ -114,6 +115,7 @@ export function createSkillsLibraryHost(deps: SkillsLibraryHostDeps) {if (own !== null) return own;// Private wins collisions: a private skill that no longer verifies must not fall through to a same-named shared one.if (listSkills(bot.id).some((skill) => skill.name === name)) return null;+ if (allBotsSkillFile(bot.id, name)) return readAllBotsSkillFile(bot.id, name);// The library fallback is by assignment only, never by name alone.if (skillsLibraryEnabled(cfg) && listLibrarySkills().some((skill) => skill.name === name && (bot.assignedSkills?.includes(name) || (skill.everyBot && !librarySkillOptOuts(bot.id).has(name))))) return readLibrarySkillFile(name);if (readImportedSkills()[name]) return readImportedSkillFile(name);@@ -125,6 +127,8 @@ export function createSkillsLibraryHost(deps: SkillsLibraryHostDeps) {const readBotSkillFiles = (bot: BotRecord, name: string): StoredSkillFiles => {if (readSkillFile(bot.id, name) !== null) return ownSkillFiles(bot.id, name);if (listSkills(bot.id).some((skill) => skill.name === name)) return null;+ const everywhere = allBotsSkillFile(bot.id, name) && allBotsRootOfBot(bot.id);+ if (everywhere) return librarySkillFiles(name, everywhere);if (skillsLibraryEnabled(cfg) && listLibrarySkills().some((skill) => skill.name === name && (bot.assignedSkills?.includes(name) || (skill.everyBot && !librarySkillOptOuts(bot.id).has(name))))) return librarySkillFiles(name);return [];};diff --git a/server/index.ts b/server/index.tsindex a91036467f..a81b51bb2e 100644--- a/server/index.ts+++ b/server/index.ts@@ -583,7 +583,7 @@ import { createBotPatchRoutes } from "./routes/bot-patch.ts";import { createBotOrderRoutes } from "./routes/bot-order.ts";import { createGroupOrderRoutes } from "./routes/group-order.ts";import { createBotLifecycleRoutes } from "./routes/bot-lifecycle.ts";-import { createBotSkillsRoutes } from "./routes/bot-skills.ts";+import { createBotSkillsRoutes } from "./routes/bot-skills.ts"; import { createSkillsForAllBotsRoutes } from "./routes/skills-for-all-bots.ts"; import { createSkillsForAllBotsHost } from "./host/skills-for-all-bots-host.ts"; import { wireSkillsForAllBots } from "./skills-for-all-bots.ts";import { createSkillShareRoutes } from "./routes/skill-share.ts";import { createTeamContextRoutes } from "./routes/team-context.ts";import { createAppSuggestions } from "./host/app-suggestions.ts"; import { createAppFindRoute, createAppSuggestionRoutes } from "./routes/app-suggestions.ts"; import { appPickAvailable } from "./decider/app-picks.ts"; import { managedConnectorUnavailableReason } from "../shared/connector-availability.ts"; import { createDeciderRoutes } from "./routes/decider.ts"; import { createCloudSendRoutes } from "./routes/cloud-send.ts"; import { claudeCodeSkillInputs } from "./setup-import.ts"; import { createCloudConnectionsHost } from "./cloud-connections-host.ts";@@ -9269,7 +9269,7 @@ function undoSkillCard(botId: string, threadId: string, messageId: string): Undoreturn { claimed: true, state: "invalid", error: "Only a change that applied on its own can be undone here.", status: 409 };}if (request.botId !== botId || request.threadId !== threadId) return { claimed: true, state: "invalid", error: "this skill request belongs to a different bot", status: 403 };- const action = request.action; if (isSkillSwitchAction(action)) return skillSwitch.undo(botId, threadId, message, { ...request, action });+ const action = request.action; if (request.allBots) return allBotsSkills.undo(botId, threadId, message, request); if (isSkillSwitchAction(action)) return skillSwitch.undo(botId, threadId, message, { ...request, action });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.previous ? { previous: { skillMd: request.previous.preview, source: request.previous.source, references: request.previous.references ?? [] } } : {}),@@ -11155,7 +11155,7 @@ function appendSkillRequestCard(args: {};}-const skillSwitch = createSkillSwitchHost({ store, dataDir: DATA_DIR, persistence: skillProposalPersistence, listBotSkills, readBotSkillFile, noteSkillChange: (botId, threadId) => skillReview.noteSkillChange(botId, threadId) });+const skillSwitch = createSkillSwitchHost({ store, dataDir: DATA_DIR, persistence: skillProposalPersistence, listBotSkills, readBotSkillFile, noteSkillChange: (botId, threadId) => skillReview.noteSkillChange(botId, threadId) }); wireSkillsForAllBots({ team: Boolean(CLOUD_TEAM), bot: (id) => store.bot(id), bots: () => store.bots }); const allBotsSkills = createSkillsForAllBotsHost({ store, dataDir: DATA_DIR, persistence: skillProposalPersistence, noteSkillChange: (botId, threadId) => skillReview.noteSkillChange(botId, threadId) });function resolveSkillRequest(args: {botId: string;botName?: string;@@ -11176,7 +11176,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 skillSwitch.resolve(args, message.id, card, { ...request, action: request.action });+ if (request.allBots) return allBotsSkills.resolve(args, message.id, card, request); if (isSkillSwitchAction(request.action)) return skillSwitch.resolve(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") {@@ -12000,7 +12000,7 @@ ROUTES.push(createBotLifecycleRoutes({store, routines: () => routines, interruptAllDirectThreads, cancelDirectTurnDispatch, revokeInternalCapabilitiesForThread,activeGroupTurnForBot, cancelGroupTurnOperations, runningTurnInstance, closeOpenApprovals, deleteBotWithLifecycle, deleteRefusal: (auth, botId) => memberDeleteRefusal(auth, store.bot(botId), Boolean(CLOUD_TEAM)),}));-const skillsRoutes = createBotSkillsRoutes({ store, cfg, listBotSkills, readBotSkillFile, stagedSkillListing }); ROUTES.push(skillsRoutes);+const skillsRoutes = createBotSkillsRoutes({ store, cfg, listBotSkills, readBotSkillFile, stagedSkillListing }); ROUTES.push(createSkillsForAllBotsRoutes({ store }), skillsRoutes);ROUTES.push(createEmailRoutes({ service: emailService }));ROUTES.push(phones.routes);ROUTES.push(createSkillShareRoutes({ enabled: () => skillsHost.mode() !== "off", botExists: (id) => Boolean(store.bot(id)),@@ -13415,7 +13415,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(received.action)) { const staged = skillSwitch.stage(from, fromThreadId, received.action, received, appliesDirectly(from.id, fromThreadId)); return json(res, staged.status, staged.body); }+ const everywhere = await allBotsSkills.stage(from, fromThreadId, received, () => appliesDirectly(from.id, fromThreadId), (asked) => importedSkillRequest(asked, fetch, callSignal), () => internalCapabilityIsActive(internalCapability) && skillAuthoringEnabled(cfg)); if (everywhere) return json(res, everywhere.status, everywhere.body); if (isSkillSwitchAction(received.action)) { const staged = skillSwitch.stage(from, fromThreadId, received.action, received, appliesDirectly(from.id, fromThreadId)); return json(res, staged.status, staged.body); }const body = await importedSkillRequest(received, fetch, callSignal); if ("importError" in body) return json(res, 422, { error: body.importError }); if (!internalCapabilityIsActive(internalCapability)) return json(res, 401, { error: TURN_ENDED_REFUSAL }); if (!skillAuthoringEnabled(cfg)) return json(res, 403, { error: "skill authoring is not enabled in Settings" });const direct = appliesDirectly(from.id, fromThreadId);const persistence = skillProposalPersistence(from.id, fromThreadId, !direct);diff --git a/server/perf/disk-categories.ts b/server/perf/disk-categories.tsindex 7219f2bed9..481e25465c 100644--- a/server/perf/disk-categories.ts+++ b/server/perf/disk-categories.ts@@ -63,13 +63,13 @@ const DATA_FOLDERS: Readonly<Record<string, StorageCategory>> = {// config.ts EVENTS_DIR and NATIVE_DIR: each conversation's event log; checkpoints.ts; memory-journal.ts.events: "conversations", native: "conversations", checkpoints: "conversations", "memory-journal": "conversations",// Sign-ins and settings: providers (provider logins), people and people-connections (team-connections.ts), caddy- // (caddy.ts), ssh (vps-ssh.ts), the skills folders (index.ts, skill-library.ts, imported-skills.ts), themes+ // (caddy.ts), ssh (vps-ssh.ts), the skills folders (index.ts, skill-library.ts, imported-skills.ts, skills-for-all-bots.ts), themes// (themes/store.ts), org-library (org-library.ts), share (share.ts), usage (usage-ledger.ts), decisions and// admin-activity (decision-log.ts, admin-activity.ts: the audit log readDecisions reads), prompt-split (drivers/prompt-split.ts),// codex-instructions (drivers/codex-instructions.ts), local-vm-stops, skill-switch, hook-tokens (drivers/claude.ts),// claude-user-skills (turn-settings.ts), box (bot-box/boot.ts), github (github/sign-in.ts).providers: "settings", people: "settings", "people-connections": "settings", caddy: "settings", ssh: "settings",- skills: "settings", "skills-library": "settings", "imported-skills": "settings", "skill-state": "settings", "skill-switch": "settings",+ skills: "settings", "skills-library": "settings", "imported-skills": "settings", "skill-state": "settings", "skill-switch": "settings", "skills-for-all-bots": "settings",themes: "settings", "org-library": "settings", share: "settings", usage: "settings", decisions: "settings", "admin-activity": "settings","prompt-split": "settings", "codex-instructions": "settings", "local-vm-stops": "settings", "hook-tokens": "settings","claude-user-skills": "settings", box: "settings", github: "settings",diff --git a/server/routes/skills-for-all-bots.ts b/server/routes/skills-for-all-bots.tsnew file mode 100644index 0000000000..1807447a91--- /dev/null+++ b/server/routes/skills-for-all-bots.ts@@ -0,0 +1,70 @@+// A bot's Skills page for a skill on all of the person's bots: put one of this bot's own skills on all of them, switch a+// shared one off for this bot alone, or take it off every bot. On a Team Cloud only the member the bot reports to may+// put a skill on, or take one off, all of their bots; anyone who may change the bot's skills may switch it for that bot.+import { z } from "zod";++import { ownerEmail } from "../../shared/bot-owner.ts";+import type { RequestAuth } from "../request-auth.ts";+import { listSkills } from "../skills.ts";+import { allBotsScopeOfBot, allBotsScopeOfPerson, allBotsSkills, setAllBotsSkillOff, skillsForAllBotsOnTeam } from "../skills-for-all-bots.ts";+import { ownCopy, putOnAllBots, removeFromAllBots } from "../skills-for-all-bots-ops.ts";+import type { BotRecord, Store } from "../store.ts";+import { PASS, type RouteHandler } from "./table.ts";++export interface SkillsForAllBotsRouteDeps {+ store: Pick<Store, "bot">;+}++/** The store this request may change through this bot: the bot's person's, and on a Team Cloud only when that is who+ * is asking. */+export function requesterScope(bot: BotRecord, auth: RequestAuth): { scope: string } | { status: number; error: string } {+ const scope = allBotsScopeOfBot(bot);+ if (!scope) return { status: 409, error: "This bot belongs to no one, so it has no \"all my bots\"." };+ if (!skillsForAllBotsOnTeam()) return { scope };+ const email = auth.kind === "session" ? auth.session.email : undefined;+ if (!email || allBotsScopeOfPerson(ownerEmail(email), true) !== scope) {+ return { status: 403, error: "Only the person this bot reports to can change the skills on all of their bots." };+ }+ return { scope };+}++export function createSkillsForAllBotsRoutes(deps: SkillsForAllBotsRouteDeps): RouteHandler {+ return async ({ path, method, auth, json, readBody, req, res }) => {+ const m = path.match(/^\/api\/bots\/([\w-]+)\/skills\/([a-z0-9-]+)(\/all-bots)?$/);+ if (!m) return PASS;+ const bot = deps.store.bot(m[1]!);+ if (!bot) return PASS;+ const name = m[2]!;+ if (m[3]) {+ if (method !== "POST") return PASS;+ const allowed = requesterScope(bot, auth);+ if ("error" in allowed) return json(res, allowed.status, { error: allowed.error });+ const own = listSkills(bot.id).find((skill) => skill.name === name);+ if (!own) return json(res, 404, { error: `This bot has no skill of its own named "${name}".` });+ // A skill still off here may be an import nobody has read yet: it reaches every bot only once it is on somewhere.+ if (!own.enabled) return json(res, 409, { error: `Turn "${name}" on for this bot first, after reading it.` });+ const copy = ownCopy(bot.id, name);+ if (!copy) return json(res, 409, { error: `"${name}" changed outside OpenMausBot; remove it and add it again.` });+ const put = putOnAllBots(allowed.scope, name, copy, { fresh: true });+ if ("error" in put) return json(res, 409, { error: put.error });+ return json(res, 200, { name, kept: put.kept.map((id) => deps.store.bot(id)?.name ?? id), retired: put.retired.length });+ }+ // Only a name on all of the person's bots that this bot does not shadow with its own; the rest is the per-bot routes'.+ const shared = !listSkills(bot.id).some((skill) => skill.name === name) && allBotsSkills(bot.id).find((skill) => skill.name === name);+ if (!shared) return PASS;+ if (method === "PATCH") {+ const parsed = z.object({ enabled: z.boolean() }).safeParse(await readBody(req));+ if (!parsed.success) return json(res, 400, { error: "enabled must be true or false" });+ setAllBotsSkillOff(bot.id, name, !parsed.data.enabled);+ return json(res, 200, { skill: allBotsSkills(bot.id).find((skill) => skill.name === name) });+ }+ if (method === "DELETE") {+ const allowed = requesterScope(bot, auth);+ if ("error" in allowed) return json(res, allowed.status, { error: allowed.error });+ const removed = removeFromAllBots(allowed.scope, name);+ if ("error" in removed) return json(res, 409, { error: removed.error });+ return json(res, 200, { ok: true });+ }+ return PASS;+ };+}diff --git a/server/skill-switch.ts b/server/skill-switch.tsindex 96958e32ae..b7f0ee88b7 100644--- a/server/skill-switch.ts+++ b/server/skill-switch.ts@@ -5,9 +5,10 @@ import { serverLine, type ServerLineKey } from "./server-lines.ts";import { STAGED_GIST_MAX } from "./skills.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";+/** own: in this bot's own skills; imported: brought in from this computer for every bot, switched per bot; all-bots: on+ * all of the person's bots, switched per bot; fixed: shared from the team library or the engine's own, which only the+ * person changes. */+export type SwitchableSkillKind = "own" | "imported" | "all-bots" | "fixed";export interface SwitchableSkill {kind: SwitchableSkillKind;diff --git a/server/skills-for-all-bots-ops.ts b/server/skills-for-all-bots-ops.tsnew file mode 100644index 0000000000..d2a89dff5b--- /dev/null+++ b/server/skills-for-all-bots-ops.ts@@ -0,0 +1,121 @@+// Putting a skill on all of a person's bots, changing it there and taking it off again (skills-for-all-bots.ts reads+// it). A bot that already has its own copy with the very same files gives that copy up for the shared one, keeping its+// on/off state as its own switch; a bot whose own copy differs keeps it (its own skill wins the name) and is reported.+import { createHash } from "node:crypto";++import { LEARN_SOURCE_PREFIX } from "./skill-learn.ts";+import { installLibrarySkill, readLibrarySkillFile, readSkillLibraryIndex, retireLibrarySkill, updateLibrarySkill } from "./skill-library.ts";+import { librarySkillFiles, ownSkillFiles } from "./skill-side-files.ts";+import {+ applySkillWriteWithReceipt, installSkill, listSkills, readSkillFile, rejectStagedSkillWrite, removeSkill, setSkillEnabled, stageSkillWrite,+} from "./skills.ts";+import { allBotsRoot, botsInAllBotsScope, setAllBotsSkillOff } from "./skills-for-all-bots.ts";++export interface SkillCopy {+ skillMd: string;+ /** The files beside SKILL.md: a learned skill's references/*.md, or an import's folder. */+ files: Array<{ path: string; content: string | Uint8Array }>;+ source: string;+}++const hex = (bytes: string | Uint8Array) => createHash("sha256").update(bytes).digest("hex");++/** One digest over SKILL.md and every file beside it, so two copies match only when all of their bytes do. */+export function copyDigest(copy: Pick<SkillCopy, "skillMd" | "files">): string {+ const files = [...copy.files].sort((a, b) => (a.path < b.path ? -1 : a.path > b.path ? 1 : 0)).map((file) => `${file.path}\0${hex(file.content)}`);+ return hex([hex(copy.skillMd), ...files].join("\n"));+}++/** The bot's own copy as stored, while every file still verifies. */+export function ownCopy(botId: string, name: string): SkillCopy | null {+ const skillMd = readSkillFile(botId, name), files = ownSkillFiles(botId, name);+ const source = listSkills(botId).find((skill) => skill.name === name)?.source;+ return skillMd !== null && files !== null && source ? { skillMd, files, source } : null;+}++export function sharedCopy(scope: string, name: string): SkillCopy | null {+ const root = allBotsRoot(scope), entry = readSkillLibraryIndex(root)[name];+ const skillMd = entry ? readLibrarySkillFile(name, root) : null, files = entry ? librarySkillFiles(name, root) : null;+ return entry && skillMd !== null && files !== null ? { skillMd, files, source: entry.source } : null;+}++export interface RetiredCopy {+ botId: string;+ wasOff: boolean;+ copy: SkillCopy;+}++export interface PutOnAllBots {+ name: string;+ sha256: string;+ /** Bots whose identical own copy gave way to the shared one. */+ retired: RetiredCopy[];+ /** Bots that keep a different copy of their own under the same name. */+ kept: string[];+}++/** Adds the skill to every bot of the person's, or replaces the copy they share. `fresh`: a new skill, so no bot keeps an+ * old switch for a skill of this name; Undo of a removal passes false and every bot keeps its switch. */+export function putOnAllBots(scope: string, name: string, copy: SkillCopy, options: { fresh: boolean }): PutOnAllBots | { error: string } {+ const root = allBotsRoot(scope), current = readSkillLibraryIndex(root)[name];+ const existing = current ? sharedCopy(scope, name) : null;+ if (current && !existing) return { error: `the copy of "${name}" on all your bots changed outside OpenMausBot; remove it and add it again` };+ if (!existing || copyDigest(existing) !== copyDigest(copy)) {+ const files = copy.files.map((file) => ({ path: file.path, content: file.content }));+ if (current && !current.files?.length && !files.length) {+ const updated = updateLibrarySkill({ name, instructions: copy.skillMd, expectSha256: current.sha256, source: copy.source, root });+ if ("stale" in updated) return { error: `"${name}" changed while it was being updated; try again` };+ if ("error" in updated) return updated;+ } else {+ if (current) {+ const retired = retireLibrarySkill(name, current.sha256, root);+ if (!("retired" in retired)) return { error: "stale" in retired ? `"${name}" changed while it was being updated; try again` : retired.error };+ }+ const installed = installLibrarySkill({ name, instructions: copy.skillMd, source: copy.source, reviewState: "approved", ...(files.length ? { files } : {}), root });+ if ("error" in installed) return installed;+ }+ }+ const sha256 = readSkillLibraryIndex(root)[name]?.sha256 ?? hex(copy.skillMd);+ const digest = copyDigest(copy), retired: RetiredCopy[] = [], kept: string[] = [];+ for (const bot of botsInAllBotsScope(scope)) {+ if (options.fresh) setAllBotsSkillOff(bot.id, name, false);+ const own = listSkills(bot.id).find((skill) => skill.name === name);+ if (!own) continue;+ const theirs = ownCopy(bot.id, name);+ if (!theirs || copyDigest(theirs) !== digest || "error" in removeSkill(bot.id, name)) {+ kept.push(bot.id);+ continue;+ }+ retired.push({ botId: bot.id, wasOff: !own.enabled, copy: theirs });+ if (!own.enabled) setAllBotsSkillOff(bot.id, name, true);+ }+ return { name, sha256, retired, kept };+}++/** Takes the skill off every bot of the person's; the bytes go to the library's archive, never deleted. */+export function removeFromAllBots(scope: string, name: string): { removed: SkillCopy } | { error: string } {+ const root = allBotsRoot(scope), current = readSkillLibraryIndex(root)[name], copy = sharedCopy(scope, name);+ if (!current) return { error: `no skill named "${name}" is on all your bots` };+ const retired = retireLibrarySkill(name, current.sha256, root);+ if (!("retired" in retired)) return { error: "stale" in retired ? `"${name}" changed outside OpenMausBot; try again` : retired.error };+ return { removed: copy ?? { skillMd: "", files: [], source: current.source } };+}++/** Undo of a put: gives each bot that gave way its own copy back, in the state it was in. */+export function restoreOwnCopies(name: string, retired: readonly RetiredCopy[]): void {+ for (const { botId, wasOff, copy } of retired) {+ if (listSkills(botId).some((skill) => skill.name === name)) continue;+ const learned = copy.source.startsWith(LEARN_SOURCE_PREFIX) && copy.files.every((file) => typeof file.content === "string" && file.path.startsWith("references/"));+ if (learned) {+ const staged = stageSkillWrite(botId, { action: "create", files: [{ path: "SKILL.md", content: copy.skillMd }, ...copy.files as Array<{ path: string; content: string }>], source: copy.source });+ if ("error" in staged) continue;+ const applied = applySkillWriteWithReceipt(botId, staged, () => {});+ if ("error" in applied) { rejectStagedSkillWrite(botId, staged.id); continue; }+ } else {+ const installed = installSkill(botId, copy.source, [{ path: "SKILL.md", content: copy.skillMd }, ...copy.files]);+ if ("error" in installed) continue;+ }+ setSkillEnabled(botId, name, !wasOff);+ setAllBotsSkillOff(botId, name, false);+ }+}diff --git a/server/skills-for-all-bots.e2e.test.ts b/server/skills-for-all-bots.e2e.test.tsnew file mode 100644index 0000000000..9cfa9ae962--- /dev/null+++ b/server/skills-for-all-bots.e2e.test.ts@@ -0,0 +1,60 @@+// A Chief puts a skill on all of the person's bots in one skill_manage call, through the real server and its injected+// tools; only the provider's planning is scripted. A bot made afterwards has it too, and one delete takes it off all.+import { existsSync, readFileSync, writeFileSync } from "node:fs";+import { join } from "node:path";+import { expect, it } from "vitest";+import { launchVerificationServer, runControlOmb } from "../scripts/control-omb.ts";+import { waitForExit } from "./testing/cleanup.ts";++it("puts a skill on every bot of the person's with one tool call, and takes it off them all with one more", async () => {+ const fixture = await launchVerificationServer({}, undefined, undefined, undefined, undefined, { scripted: true });+ const { url, dataDir } = fixture.info;+ const planPath = join(dataDir, "room-plan.json");+ const plans: Record<string, { turns: unknown[] }> = {};+ const providerTurns = (): Array<{ botId: string; evidence: Array<{ step?: unknown; response: any }> }> => existsSync(`${planPath}.evidence.jsonl`)+ ? readFileSync(`${planPath}.evidence.jsonl`, "utf8").trim().split("\n").filter(Boolean).map((line) => JSON.parse(line)) : [];+ const api = async (method: string, path: string, body?: unknown) => {+ const response = await fetch(`${url}${path}`, { method, headers: { "content-type": "application/json", origin: url },+ ...(body === undefined ? {} : { body: JSON.stringify(body) }), signal: AbortSignal.timeout(10_000) });+ const result = await response.json() as any;+ expect(response.ok, `${method} ${path}: ${JSON.stringify(result)}`).toBe(true);+ return result;+ };+ const cli = (...args: string[]) => runControlOmb([...args, "--url", url]) as Promise<any>;+ const shared = async (bot: { id: string }) => ((await api("GET", `/api/bots/${bot.id}/skills`)).skills as any[]).filter((skill) => skill.name === "client-onboarding");+ const run = async (bot: { id: string; activeTaskId: string }, text: string, steps: unknown[]) => {+ const before = providerTurns().length;+ (plans[bot.id] ??= { turns: [] }).turns.push({ steps, reply: `Done: ${text}` });+ writeFileSync(planPath, JSON.stringify(plans));+ await cli("send", "--bot", bot.id, "--task", bot.activeTaskId, "--text", text);+ await expect.poll(() => providerTurns().length, { timeout: 25_000 }).toBe(before + 1);+ expect((await cli("wait", "--bot", bot.id, "--task", bot.activeTaskId, "--timeout", "25")).status).toBe("settled");+ return providerTurns().slice(before)[0]!.evidence.filter((entry) => entry.step).map((entry) => entry.response.result.content[0].text as string);+ };+ try {+ const chief = (await cli("new-bot", "--name", "Clive", "--section", "Operations")).bot;+ const writer = (await cli("new-bot", "--name", "Wren", "--section", "Writing")).bot;+ await api("PATCH", "/api/config", { features: { skillAuthoring: true } });+ const skillMd = "---\nname: client-onboarding\ndescription: Sets up a new client the way this person does.\n---\n\n# Client onboarding\n\nMake the folder, then the intake sheet.\n";++ const [created] = await run(chief, "Put my client-onboarding skill on all my bots.", [+ { tool: "skill_manage", arguments: { action: "create", all_bots: true, skill_md: skillMd, source: "conversation" }, expectError: false },+ ]);+ expect(created).toContain("is on all your bots");+ const later = (await cli("new-bot", "--name", "Lark")).bot;+ for (const bot of [chief, writer, later]) expect(await shared(bot)).toEqual([expect.objectContaining({ enabled: true, allBots: true })]);+ const receipt = ((await api("GET", `/api/threads/${chief.activeTaskId}/messages?limit=50`)).messages as any[]).find((message) => message.card?.skillRequest);+ expect(receipt.card).toMatchObject({ autoApplied: true, skillRequest: { allBots: true, action: "create", name: "client-onboarding" } });++ const listed = await run(writer, "Which skills do you have?", [{ tool: "skills_list", arguments: {}, expectError: false }]);+ expect(listed[0]).toContain("client-onboarding (enabled, imported, on all your bots)");++ const [deleted] = await run(writer, "Remove client-onboarding from all my bots.", [+ { tool: "skill_manage", arguments: { action: "delete", skill_name: "client-onboarding" }, expectError: false },+ ]);+ expect(deleted).toContain("removed from all your bots");+ for (const bot of [chief, writer, later]) expect(await shared(bot)).toEqual([]);+ } finally {+ await waitForExit(fixture.child, { signal: "SIGTERM" });+ }+}, 120_000);diff --git a/server/skills-for-all-bots.test.ts b/server/skills-for-all-bots.test.tsnew file mode 100644index 0000000000..c8b7373e40--- /dev/null+++ b/server/skills-for-all-bots.test.ts@@ -0,0 +1,259 @@+import { mkdtempSync, rmSync } from "node:fs";+import { tmpdir } from "node:os";+import { join } from "node:path";++import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";++// config.ts resolves DATA_DIR at import time; isolate before importing.+process.env.OMB_DATA_DIR = mkdtempSync(join(tmpdir(), "omb-all-bots-"));++const skills = await import("./skills.ts");+const library = await import("./skill-library.ts");+const everywhere = await import("./skills-for-all-bots.ts");+const ops = await import("./skills-for-all-bots-ops.ts");+const { createSkillsForAllBotsHost } = await import("./host/skills-for-all-bots-host.ts");+const { createSkillSwitchHost } = await import("./host/skill-switch-host.ts");+const { requesterScope } = await import("./routes/skills-for-all-bots.ts");+const { learnSource } = await import("./skill-learn.ts");+const { flushDecisionLog } = await import("./decision-log.ts");+const { DATA_DIR } = await import("./config.ts");++type Bot = { id: string; name: string; color: string; createdBy?: string; reportsTo?: string; home?: unknown };++const SKILL = (name: string, body = "Do the thing.", description = "Sets up a new client the way this person does.") =>+ `---\nname: ${name}\ndescription: ${description}\n---\n\n# ${name}\n\n${body}\n`;+const unique = (prefix: string) => `${prefix}-${Math.random().toString(36).slice(2, 10)}`;+let bots: Bot[] = [];++function wire(team = false) {+ everywhere.wireSkillsForAllBots({ team, bot: (id) => bots.find((bot) => bot.id === id), bots: () => bots });+}+function bot(name: string, more: Partial<Bot> = {}): Bot {+ const made = { id: unique(name.toLowerCase()), name, color: "blue", ...more };+ bots.push(made);+ return made;+}+function learn(botId: string, name: string, body?: string) {+ const staged = skills.stageSkillWrite(botId, { action: "create", files: [{ path: "SKILL.md", content: SKILL(name, body) }], source: learnSource("conversation") });+ if ("error" in staged) throw new Error(staged.error);+ const applied = skills.applyStagedSkillWrite(botId, staged.id, { expectedSha256: staged.sha256 });+ if ("error" in applied) throw new Error(applied.error);+}+const names = (botId: string, library?: string[]) => skills.resolveBotSkills(botId, library).filter((skill) => skill.enabled).map((skill) => skill.name);+const indexLines = (botId: string, name: string) => skills.skillsSystemPrompt(botId).split("\n").filter((line) => line.startsWith(`- ${name}:`));+function putFrom(botId: string, name: string) {+ const copy = ops.ownCopy(botId, name);+ if (!copy) throw new Error("no own copy");+ const put = ops.putOnAllBots(everywhere.allBotsScopeOfBot(bots.find((one) => one.id === botId))!, name, copy, { fresh: true });+ if ("error" in put) throw new Error(put.error);+ return put;+}++beforeEach(() => {+ bots = [];+ rmSync(join(DATA_DIR, "skills-for-all-bots"), { recursive: true, force: true });+ wire();+});+afterEach(() => everywhere.wireSkillsForAllBots(null));++describe("a skill on all of the person's bots", () => {+ it("reaches every bot, a bot made later too, with one index line each, and leaves with one removal", () => {+ const chief = bot("Chief"), writer = bot("Writer"), keeper = bot("Keeper");+ learn(chief.id, "client-onboarding");+ learn(keeper.id, "client-onboarding", "Keeper's own different way.");+ const put = putFrom(chief.id, "client-onboarding");+ expect(put.retired.map((one) => one.botId)).toEqual([chief.id]);+ expect(put.kept).toEqual([keeper.id]);+ expect(skills.listSkills(chief.id)).toEqual([]);++ const later = bot("Later");+ for (const one of [chief, writer, later]) {+ expect(names(one.id)).toEqual(["client-onboarding"]);+ const lines = indexLines(one.id, "client-onboarding");+ expect(lines).toHaveLength(1);+ expect(lines[0]).toContain(join(DATA_DIR, "skills-for-all-bots", "mine", "skills", "client-onboarding", "SKILL.md"));+ }+ // The bot with its own different copy keeps it: its own skill wins the name.+ expect(skills.resolveBotSkills(keeper.id, undefined).filter((skill) => skill.name === "client-onboarding")).toHaveLength(1);+ expect(indexLines(keeper.id, "client-onboarding")[0]).toContain(join("workspaces", keeper.id));+ expect(skills.enabledSkillFile(writer.id, "client-onboarding")).toBe(everywhere.allBotsSkillFile(writer.id, "client-onboarding"));++ const removed = ops.removeFromAllBots("mine", "client-onboarding");+ expect("removed" in removed).toBe(true);+ for (const one of [chief, writer, later]) expect(names(one.id)).toEqual([]);+ expect(names(keeper.id)).toEqual(["client-onboarding"]);+ });++ it("turns off for one bot only, and an identical copy that was off stays off there", () => {+ const chief = bot("Chief"), writer = bot("Writer"), quiet = bot("Quiet");+ learn(chief.id, "weekly-report");+ learn(quiet.id, "weekly-report");+ skills.setSkillEnabled(quiet.id, "weekly-report", false);+ const put = putFrom(chief.id, "weekly-report");+ expect(put.retired.map((one) => [one.botId, one.wasOff])).toEqual([[chief.id, false], [quiet.id, true]]);+ expect(names(quiet.id)).toEqual([]);+ everywhere.setAllBotsSkillOff(writer.id, "weekly-report", true);+ expect(names(writer.id)).toEqual([]);+ expect(indexLines(writer.id, "weekly-report")).toEqual([]);+ expect(names(chief.id)).toEqual(["weekly-report"]);+ everywhere.setAllBotsSkillOff(writer.id, "weekly-report", false);+ expect(names(writer.id)).toEqual(["weekly-report"]);+ });++ it("with the library on too, a name in both shows once and is the person's all-bots copy", () => {+ const chief = bot("Chief");+ const libraryRoot = library.skillsLibraryRoot();+ const installed = library.installLibrarySkill({ name: "release-notes", instructions: SKILL("release-notes", "Library way.", "The library's copy."), source: "test", reviewState: "approved", root: libraryRoot });+ if ("error" in installed) throw new Error(installed.error);+ library.setLibrarySkillEveryBot("release-notes", true, libraryRoot);+ expect(skills.resolveBotSkills(chief.id, []).map((skill) => skill.name)).toEqual(["release-notes"]);+ learn(chief.id, "release-notes", "The person's way.");+ putFrom(chief.id, "release-notes");+ const listed = skills.resolveBotSkills(chief.id, []).filter((skill) => skill.name === "release-notes");+ expect(listed).toHaveLength(1);+ expect(listed[0]).toMatchObject({ allBots: true, description: "Sets up a new client the way this person does." });+ expect(skills.listBotSkillsWithOrigin(chief.id, []).skills.map((skill) => [skill.name, skill.origin])).toEqual([["release-notes", "all-bots"]]);+ expect(skills.enabledSkillFile(chief.id, "release-notes", [])).toBe(everywhere.allBotsSkillFile(chief.id, "release-notes"));+ expect(skills.skillsSystemPrompt(chief.id, []).split("\n").filter((line) => line.startsWith("- release-notes:"))).toEqual([+ expect.stringContaining(join("skills-for-all-bots", "mine")),+ ]);+ ops.removeFromAllBots("mine", "release-notes");+ expect(skills.resolveBotSkills(chief.id, [])[0]).not.toHaveProperty("allBots");+ library.retireLibrarySkill("release-notes", library.readSkillLibraryIndex(libraryRoot)["release-notes"]!.sha256, libraryRoot);+ });+});++describe("on a Team Cloud, all my bots is the member's own bots only", () => {+ it("never reaches another member's bot or a team bot nobody owns, and a stand-in has none", () => {+ wire(true);+ const alicesChief = bot("Alice's Chief", { createdBy: "[email protected]" });+ const alicesWriter = bot("Alice's Writer", { createdBy: "[email protected]", reportsTo: "[email protected]" });+ const bobs = bot("Bob's bot", { createdBy: "[email protected]" });+ const team = bot("Team bot");+ const standIn = bot("Elsewhere", { createdBy: "[email protected]", home: { place: "p", placeName: "Laptop", botId: "x" } });+ expect(everywhere.allBotsScopeOfBot(team)).toBeNull();+ expect(everywhere.allBotsScopeOfBot(standIn)).toBeNull();+ learn(alicesChief.id, "client-onboarding");+ putFrom(alicesChief.id, "client-onboarding");+ expect(names(alicesChief.id)).toEqual(["client-onboarding"]);+ expect(names(alicesWriter.id)).toEqual(["client-onboarding"]);+ for (const other of [bobs, team, standIn]) expect(names(other.id)).toEqual([]);++ const session = (email?: string) => ({ kind: "session", session: { email }, via: "bearer", scopes: ["client"] }) as never;+ expect(requesterScope(alicesWriter as never, session("[email protected]"))).toEqual({ scope: everywhere.allBotsScopeOfPerson("[email protected]", true) });+ expect(requesterScope(alicesWriter as never, session("[email protected]"))).toMatchObject({ status: 403 });+ expect(requesterScope(alicesWriter as never, session())).toMatchObject({ status: 403 });+ expect(requesterScope(alicesWriter as never, { kind: "loopback", scopes: ["admin"] } as never)).toMatchObject({ status: 403 });+ expect(requesterScope(team as never, session("[email protected]"))).toMatchObject({ status: 409 });+ });+});++describe("skill_manage for all the person's bots", () => {+ const dataDirs: string[] = [];+ afterEach(async () => {+ for (const dir of dataDirs.splice(0)) await flushDecisionLog(dir);+ });+ function host(direct: boolean) {+ const dataDir = mkdtempSync(join(tmpdir(), "omb-all-bots-host-"));+ dataDirs.push(dataDir);+ const messages: Array<{ id: string; card: any }> = [];+ const made = createSkillsForAllBotsHost({+ store: {+ bot: (id: string) => bots.find((one) => one.id === id) as never,+ appendMessage: ((_thread: string, message: { card: unknown }) => { messages.push({ id: `m${messages.length}`, card: message.card }); }) as never,+ patchMessage: ((_thread: string, id: string, patch: { card: unknown }) => { messages.find((one) => one.id === id)!.card = patch.card; }) as never,+ },+ dataDir,+ persistence: () => ({ ok: true }),+ noteSkillChange: vi.fn(),+ });+ const call = (from: Bot, body: Record<string, unknown>) =>+ made.stage(from as never, "t1", body, () => (direct ? "full-access" : null), async (asked) => asked, () => true);+ const last = () => messages.at(-1)!;+ const undo = (from: Bot) => made.undo(from.id, "t1", last() as never, last().card.skillRequest);+ const answer = (from: Bot, behavior: "allow" | "deny") =>+ made.resolve({ botId: from.id, threadId: "t1", requestId: last().card.requestId, behavior, reviewedSha256: last().card.skillRequest.sha256 }, last().id, last().card, last().card.skillRequest);+ return { call, last, undo, answer, messages };+ }++ it("creates on every bot in one call with a receipt, and Undo gives each bot back what it had", async () => {+ const chief = bot("Chief"), writer = bot("Writer"), quiet = bot("Quiet");+ learn(quiet.id, "client-onboarding");+ skills.setSkillEnabled(quiet.id, "client-onboarding", false);+ const { call, last, undo } = host(true);+ const result = await call(chief, { action: "create", all_bots: true, skill_md: SKILL("client-onboarding"), source: "conversation" });+ expect(result).toMatchObject({ status: 201, body: { state: "applied", allBots: true, name: "client-onboarding" } });+ expect(last().card).toMatchObject({ autoApplied: true, title: 'Skill "client-onboarding" is on all your bots', skillRequest: { allBots: true, action: "create" } });+ expect([names(chief.id), names(writer.id), names(quiet.id)]).toEqual([["client-onboarding"], ["client-onboarding"], []]);+ expect(skills.listSkills(quiet.id)).toEqual([]);++ expect(undo(chief)).toEqual({ claimed: true, state: "undone" });+ expect([names(chief.id), names(writer.id)]).toEqual([[], []]);+ expect(skills.listSkills(quiet.id).map((skill) => [skill.name, skill.enabled])).toEqual([["client-onboarding", false]]);+ expect(everywhere.allBotsSkillOffs(quiet.id).has("client-onboarding")).toBe(false);+ });++ it("updates and deletes a shared skill by its name alone, and Undo restores it", async () => {+ const chief = bot("Chief"), writer = bot("Writer");+ const { call, undo } = host(true);+ await call(chief, { action: "create", all_bots: true, skill_md: SKILL("weekly-report"), source: "conversation" });+ const updated = await call(writer, { action: "update", skill_name: "weekly-report", skill_md: SKILL("weekly-report", "New way."), source: "conversation" });+ expect(updated).toMatchObject({ status: 201, body: { state: "applied", action: "update" } });+ expect(skills.enabledSkillFile(chief.id, "weekly-report")).toBeTruthy();+ expect(ops.sharedCopy("mine", "weekly-report")?.skillMd).toContain("New way.");+ expect(undo(writer)).toEqual({ claimed: true, state: "undone" });+ expect(ops.sharedCopy("mine", "weekly-report")?.skillMd).toContain("Do the thing.");++ everywhere.setAllBotsSkillOff(writer.id, "weekly-report", true);+ const deleted = await call(chief, { action: "delete", skill_name: "weekly-report" });+ expect(deleted).toMatchObject({ status: 201, body: { state: "applied", action: "delete" } });+ expect(names(chief.id)).toEqual([]);+ expect(undo(chief)).toEqual({ claimed: true, state: "undone" });+ expect(names(chief.id)).toEqual(["weekly-report"]);+ expect(names(writer.id)).toEqual([]); // its own switch came back with it+ ops.removeFromAllBots("mine", "weekly-report");+ });++ it("waits on a card where the bot's own skill changes would, and applies only on approval", async () => {+ const chief = bot("Chief"), writer = bot("Writer");+ const { call, last, answer } = host(false);+ expect(await call(chief, { action: "create", all_bots: true, skill_md: SKILL("invoice-check"), source: "conversation" })).toMatchObject({ status: 201, body: { state: "pending" } });+ expect(last().card).toMatchObject({ options: ["Enable", "Deny"], title: 'Put skill "invoice-check" on all your bots?' });+ expect(names(writer.id)).toEqual([]);+ expect(answer(chief, "allow")).toEqual({ claimed: true, outcome: "allowed-once" });+ expect(names(writer.id)).toEqual(["invoice-check"]);+ await call(chief, { action: "delete", skill_name: "invoice-check" });+ expect(answer(chief, "deny")).toEqual({ claimed: true, outcome: "rejected" });+ expect(names(writer.id)).toEqual(["invoice-check"]);+ ops.removeFromAllBots("mine", "invoice-check");+ });++ it("leaves the bot's own skills to the usual paths, and refuses a team bot nobody owns", async () => {+ const chief = bot("Chief");+ learn(chief.id, "own-thing");+ const { call } = host(true);+ expect(await call(chief, { action: "update", skill_name: "own-thing", skill_md: SKILL("own-thing"), source: "conversation" })).toBeNull();+ expect(await call(chief, { action: "create", skill_md: SKILL("solo"), source: "conversation" })).toBeNull();+ wire(true);+ const nobodys = bot("Department Chief");+ expect(await call(nobodys, { action: "create", all_bots: true, skill_md: SKILL("x-skill"), source: "conversation" })).toMatchObject({ status: 422 });+ });++ it("switches a shared skill on or off for the asking bot only", () => {+ const chief = bot("Chief"), writer = bot("Writer");+ learn(chief.id, "tidy-inbox");+ putFrom(chief.id, "tidy-inbox");+ const dataDir = mkdtempSync(join(tmpdir(), "omb-all-bots-switch-"));+ dataDirs.push(dataDir);+ const switches = createSkillSwitchHost({+ store: { bot: (id: string) => bots.find((one) => one.id === id) as never, appendMessage: (() => {}) as never, patchMessage: (() => {}) as never },+ dataDir, persistence: () => ({ ok: true }),+ listBotSkills: (one) => skills.resolveBotSkills(one.id, undefined),+ readBotSkillFile: (one, name) => everywhere.readAllBotsSkillFile(one.id, name),+ noteSkillChange: vi.fn(),+ });+ expect(switches.stage(writer as never, "t1", "disable", { skill_name: "tidy-inbox" }, "full-access")).toMatchObject({ status: 201, body: { state: "applied" } });+ expect(names(writer.id)).toEqual([]);+ expect(names(chief.id)).toEqual(["tidy-inbox"]);+ });+});diff --git a/server/skills-for-all-bots.ts b/server/skills-for-all-bots.tsnew file mode 100644index 0000000000..267c366303--- /dev/null+++ b/server/skills-for-all-bots.ts@@ -0,0 +1,139 @@+// Skills a person keeps on all of their bots on this server: one copy per person, read by each bot of theirs when it+// lists its skills, so a bot made later has them too and removing one takes it off every bot at once. The copy is kept in+// the skills library's own record format (skill-library.ts), one library root per person: the per-person form of the+// library's every-bot flag. Off a team that person is the server's one owner and every bot here is theirs; on a Team+// Cloud a member's root reaches only the bots that report to them (botOwner), never a bot nobody owns and never another+// member's. A bot can turn one off for itself only (all-bots-off.json beside its own skill state). Nothing here runs at+// server start: the store is read when a bot lists its skills, as its own skills are.+import { createHash } from "node:crypto";+import { mkdirSync, readFileSync } from "node:fs";+import { join } from "node:path";+import { z } from "zod";++import { writeFileAtomic } from "./atomic.ts";+import { DATA_DIR } from "./config.ts";+import { botOwner, type OwnedBot } from "../shared/bot-owner.ts";+import { isSkillName } from "../shared/skill-md.ts";+import { librarySkillFilePath, listLibrarySkills, readLibrarySkillFile, type LibrarySkillListing } from "./skill-library.ts";++export const SKILLS_FOR_ALL_BOTS_DIR = "skills-for-all-bots";++/** A bot as far as whose it is: a stand-in (`home`) lives on another server and has its skills there. */+export type AllBotsBot = OwnedBot & { id: string; home?: unknown };++interface Wiring {+ team: boolean;+ bot(id: string): AllBotsBot | null | undefined;+ bots(): readonly AllBotsBot[];+}++let wiring: Wiring | null = null;++/** Set once by the server; unset (tests of one module, tools) there are no all-bots skills. */+export function wireSkillsForAllBots(next: Wiring | null): void {+ wiring = next;+}++export function skillsForAllBotsOnTeam(): boolean {+ return wiring?.team === true;+}++/** Whose store: "mine" off a team; on a Team Cloud the member's own, by a digest of their address. */+export function allBotsScopeOfPerson(email: string | null | undefined, team = skillsForAllBotsOnTeam()): string | null {+ if (!team) return "mine";+ const key = email?.trim().toLowerCase();+ return key ? `person-${createHash("sha256").update(key).digest("hex").slice(0, 32)}` : null;+}++/** Null for a bot that has no all-bots skills: a stand-in, or on a Team Cloud a bot nobody owns. */+export function allBotsScopeOfBot(bot: AllBotsBot | null | undefined, team = skillsForAllBotsOnTeam()): string | null {+ if (!bot || bot.home) return null;+ return team ? allBotsScopeOfPerson(botOwner(bot), true) : "mine";+}++export function allBotsRoot(scope: string, dataDir: string = DATA_DIR): string {+ return join(dataDir, SKILLS_FOR_ALL_BOTS_DIR, scope);+}++/** The bots a store reaches: every bot of that person here, the ones made later included. */+export function botsInAllBotsScope(scope: string): AllBotsBot[] {+ const team = skillsForAllBotsOnTeam();+ return (wiring?.bots() ?? []).filter((bot) => allBotsScopeOfBot(bot, team) === scope);+}++export function allBotsRootOfBot(botId: string): string | null {+ const scope = allBotsScopeOfBot(wiring?.bot(botId));+ return scope ? allBotsRoot(scope) : null;+}++export interface AllBotsSkillListing {+ name: string;+ description: string;+ enabled: boolean;+ editable: false;+ source: string;+ sha256: string;+ importedAt: string;+ warnings: string[];+ skippedFiles: string[];+ files?: string[];+ /** On all of the person's bots; `enabled` false here is this bot's own switch, or a copy that no longer verifies. */+ allBots: true;+}++function listing(skill: LibrarySkillListing, off: ReadonlySet<string>): AllBotsSkillListing {+ return {+ name: skill.name, description: skill.description, enabled: skill.enabled && !off.has(skill.name), editable: false,+ source: skill.source, sha256: skill.sha256, importedAt: skill.importedAt, warnings: skill.warnings, skippedFiles: skill.skippedFiles,+ ...(skill.files ? { files: skill.files } : {}), allBots: true,+ };+}++/** The person's all-bots skills as this bot has them. */+export function allBotsSkills(botId: string): AllBotsSkillListing[] {+ const root = allBotsRootOfBot(botId);+ if (!root) return [];+ const off = allBotsSkillOffs(botId);+ return listLibrarySkills(root).map((skill) => listing(skill, off));+}++/** The SKILL.md path the bot's index points at, when the person has a skill of this name on all their bots. */+export function allBotsSkillFile(botId: string, name: string): string | null {+ const root = allBotsRootOfBot(botId);+ return root && isSkillName(name) && listLibrarySkills(root).some((skill) => skill.name === name) ? librarySkillFilePath(name, root) : null;+}++/** Its SKILL.md while it still hashes as stored; null when there is none or it changed outside OpenMausBot. */+export function readAllBotsSkillFile(botId: string, name: string): string | null {+ const root = allBotsRootOfBot(botId);+ return root ? readLibrarySkillFile(name, root) : null;+}++const offSchema = z.array(z.string());++function offPath(botId: string): string | null {+ return /^[\w-]+$/.test(botId) ? join(DATA_DIR, "skill-state", botId, "all-bots-off.json") : null;+}++/** The all-bots skills this one bot has switched off. A list that cannot be read counts as none: every one stays on. */+export function allBotsSkillOffs(botId: string): ReadonlySet<string> {+ const path = offPath(botId);+ if (!path) return new Set();+ try {+ const parsed = offSchema.safeParse(JSON.parse(readFileSync(path, "utf8")));+ return new Set(parsed.success ? parsed.data.filter(isSkillName) : []);+ } catch {+ return new Set();+ }+}++export function setAllBotsSkillOff(botId: string, name: string, off: boolean): void {+ const path = offPath(botId);+ if (!path || !isSkillName(name)) return;+ const names = new Set(allBotsSkillOffs(botId));+ if (names.has(name) === off) return;+ if (off) names.add(name);+ else names.delete(name);+ mkdirSync(join(DATA_DIR, "skill-state", botId), { recursive: true, mode: 0o700 });+ writeFileAtomic(path, `${JSON.stringify([...names].sort(), null, 2)}\n`, { mode: 0o600 });+}diff --git a/server/skills.ts b/server/skills.tsindex 5366aa189c..c37856a254 100644--- a/server/skills.ts+++ b/server/skills.ts@@ -29,6 +29,7 @@ import {import { LEARN_SOURCE_PREFIX } from "./skill-learn.ts";import { libraryDescriptionsAt, librarySkillFilePath, librarySkillsForBot, librarySkillsToOffer, type LibrarySkillListing } from "./skill-library.ts";import { readManagedLinks, writeManagedLinks } from "./skill-link-registry.ts";+import { allBotsSkillFile, allBotsSkills } from "./skills-for-all-bots.ts";import {directoryEntryState, entryExistsWithoutFollowing, formatKb, isSkillReferencePath, learnedSkillDirectoryMatches, publishReviewedRevision,readReferenceFiles, referenceLimitError, referencePathError, REFERENCES_ADVICE, skillReferencesSha256, STAGED_SKILL_FILE_MAX_BYTES,@@ -37,13 +38,7 @@ import { workspaceDir } from "./workspace.ts";import { isSkillName, parseSkillMd, scanSkillText, SKILL_FILE_MAX_BYTES, type ParsedSkill } from "../shared/skill-md.ts";export {- DESCRIPTION_MAX,- isSkillName,- parseSkillMd,- scanSkillText,- SKILL_FILE_MAX_BYTES,- SKILL_NAME_MAX,- type ParsedSkill,+ DESCRIPTION_MAX, isSkillName, parseSkillMd, scanSkillText, SKILL_FILE_MAX_BYTES, SKILL_NAME_MAX, type ParsedSkill,} from "../shared/skill-md.ts";export { STAGED_SKILL_FILE_MAX_BYTES } from "./skill-storage.ts";@@ -1274,8 +1269,8 @@ export function skillsSystemPrompt(botId: string, assignedLibrary?: readonly str(omitted ? `${entries.length ? "\n" : ""}${notice(omitted, entries.length)}` : "");for (const skill of enabled.slice(0, INDEX_MAX_SKILLS)) {const entry = manifest[skill.name];- const file = entry ? join(skillTarget(root, skill.name, entry), "SKILL.md") : librarySkillFilePath(skill.name);- const line = `- ${skill.name}: ${entry ? skill.description : describe(skill.name, skill.description)} Read ${JSON.stringify(file)}.`;+ const file = entry ? join(skillTarget(root, skill.name, entry), "SKILL.md") : allBotsSkillFile(botId, skill.name) ?? librarySkillFilePath(skill.name);+ const line = `- ${skill.name}: ${entry || "allBots" in skill ? skill.description : describe(skill.name, skill.description)} Read ${JSON.stringify(file)}.`;if (Buffer.byteLength(block([...lines, line], enabled.length - lines.length - 1), "utf8") > INDEX_MAX_BYTES) break;lines.push(line);}@@ -1300,32 +1295,33 @@ export function enabledSkillFile(botId: string, name: string, assignedLibrary?:export function enabledSkillFiles(botId: string, names: readonly string[], assignedLibrary?: readonly string[]): Map<string, string> {if (!names.length) return new Map();const on = new Set(resolveBotSkills(botId, assignedLibrary).filter((skill) => skill.enabled).map((skill) => skill.name)), manifest = readManifest(botId);- return new Map(names.filter((name) => on.has(name)).map((name) => [name, manifest[name] ? join(skillTarget(workspaceDir(botId), name, manifest[name]), "SKILL.md") : librarySkillFilePath(name)] as const));+ return new Map(names.filter((name) => on.has(name)).map((name) => [name, manifest[name] ? join(skillTarget(workspaceDir(botId), name, manifest[name]), "SKILL.md") : allBotsSkillFile(botId, name) ?? librarySkillFilePath(name)] as const));}+/** The bot's own skills, then the person's skills for all their bots, then (while the library is on) its library skills:+ * a name shows once, and the earlier kind wins it. */export function resolveBotSkills(botId: string, assignedLibrary: readonly string[] | undefined): SkillListing[] {- const own = listSkills(botId);- if (assignedLibrary === undefined) return own; // the library is off: no every-bot skills either- const ownNames = new Set(own.map((skill) => skill.name));- return [...own, ...librarySkillsForBot(botId, new Set(assignedLibrary), ownNames)];+ const own = listSkills(botId), ownNames = new Set(own.map((skill) => skill.name));+ const mine = [...own, ...allBotsSkills(botId).filter((skill) => !ownNames.has(skill.name))];+ if (assignedLibrary === undefined) return mine; // the library is off: no library every-bot skills either+ return [...mine, ...librarySkillsForBot(botId, new Set(assignedLibrary), new Set(mine.map((skill) => skill.name)))];}export interface BotSkillWithOrigin extends SkillListing {- origin: "private" | "library";+ origin: "private" | "library" | "all-bots";}export function listBotSkillsWithOrigin(botId: string,assignedLibrary: readonly string[] | undefined,): { skills: BotSkillWithOrigin[]; library: LibrarySkillListing[] } {- const own = listSkills(botId);- const ownNames = new Set(own.map((skill) => skill.name));+ const ownNames = new Set(listSkills(botId).map((skill) => skill.name));const assigned = new Set(assignedLibrary ?? []);const skills = resolveBotSkills(botId, assignedLibrary ?? []).map((skill) => ({...skill,- origin: ownNames.has(skill.name) ? ("private" as const) : ("library" as const),+ origin: ownNames.has(skill.name) ? ("private" as const) : "allBots" in skill ? ("all-bots" as const) : ("library" as const),}));- const library = librarySkillsToOffer(botId, assigned, ownNames);+ const library = librarySkillsToOffer(botId, assigned, new Set(skills.map((skill) => skill.name)));return { skills, library };}diff --git a/src/components/ApprovalCard.tsx b/src/components/ApprovalCard.tsxindex 2d76c95abf..8cf7a1e9cb 100644--- a/src/components/ApprovalCard.tsx+++ b/src/components/ApprovalCard.tsx@@ -82,7 +82,7 @@ const staleRoutineCard = (card: OptionCardData) => Boolean(card.routineRequest &/** Cards whose server-written title and first option say what approving does. */export const titledCard = (card: OptionCardData | undefined) =>- Boolean(card?.teamSetupRequest || card?.mcpRequest || card?.lendingLift || isSkillSwitchAction(card?.skillRequest?.action));+ Boolean(card?.teamSetupRequest || card?.mcpRequest || card?.lendingLift || isSkillSwitchAction(card?.skillRequest?.action) || card?.skillRequest?.allBots);export function titledCardAction(card: OptionCardData): string {if (card.mcpRequest) return mcpRequestActionLabel(card.mcpRequest.action);@@ -190,7 +190,7 @@ export function appliedChange(card: OptionCardData, name: string): { line: strinconst skill = card.skillRequest;if (skill) {return {- line: t(SKILL_APPLIED_LINE[skill.action], { name, title: skill.name }),+ line: t(SKILL_APPLIED_LINE[skill.action], { name, title: skill.allBots ? `${skill.name} · ${t("skills.allBots.tag")}` : skill.name }),canUndo: skill.action === "create" || skill.action === "enable" || skill.action === "disable" || Boolean(skill.previous),};}diff --git a/src/components/SkillsSection.behavior.test.ts b/src/components/SkillsSection.behavior.test.tsindex 5ed834c111..170f37f019 100644--- a/src/components/SkillsSection.behavior.test.ts+++ b/src/components/SkillsSection.behavior.test.ts@@ -111,8 +111,8 @@ describe("Skills library review and assignment controls", () => {});it("requires the same source review before enabling a per-bot library skill", async () => {- // Hook call order: useManagedSkills owns 0-8 and the assignment guard ref (9); the section owns 10-13.- fixture.values = [[{ ...skill(), origin: "library" }], ["order-audit"], [], "", [], false, "", "", null, { current: false }, null, "", false, ""];+ // Hook call order: useManagedSkills owns 0-8, the assignment guard ref (9) and its note (10); the section owns 11-14.+ fixture.values = [[{ ...skill(), origin: "library" }], ["order-audit"], [], "", [], false, "", "", null, { current: false }, "", null, "", false, ""];fixture.request.mockImplementation(async (_url, options) => options?.method ? {} : { text: source });named(render(true), "Enable order-audit").props.onClick!();await flush();@@ -127,7 +127,7 @@ describe("Skills library review and assignment controls", () => {it("shows a skill from this computer with this bot's switch, and no way to delete the one copy every bot shares", async () => {const imported = { name: "pdf", description: "Works with PDFs", enabled: true, source: "~/.claude/skills/pdf", warnings: [], origin: "imported" };- fixture.values = [[imported], [], [], "", [], false, "", "", null, { current: false }, null, "", false, ""];+ fixture.values = [[imported], [], [], "", [], false, "", "", null, { current: false }, "", null, "", false, ""];fixture.request.mockImplementation(async (_url, options) => options?.method ? {} : { text: source });const tree = render(true);expect(tree.find((node) => node.props["aria-label"] === "Remove pdf")).toBeUndefined();@@ -136,4 +136,25 @@ describe("Skills library review and assignment controls", () => {await flush();expect(fixture.request).toHaveBeenCalledWith("/api/bots/bot/skills/pdf", expect.objectContaining({ method: "PATCH", body: '{"enabled":false}' }));});+ it("puts one of the bot's own skills on all bots, and marks one already there with this bot's own switch", async () => {+ const own = { name: "invoice-check", description: "Checks invoices", enabled: true, source: "learned:conversation", warnings: [] };+ const shared = { name: "client-onboarding", description: "Onboards clients", enabled: true, source: "learned:conversation", warnings: [], allBots: true };+ fixture.values = [[own, shared], [], [], "", [], false, "", "", null, { current: false }, "", null, "", false, ""];+ fixture.request.mockImplementation(async (url: string) => (url.endsWith("/all-bots") ? { kept: ["Keeper"] } : { skills: [own, shared] }));+ const tree = render(true);+ expect(tree.find((node) => node.props["aria-label"] === "Use client-onboarding on all your bots")).toBeUndefined();+ expect(tree.filter((node) => node.props.children === "All bots")).toHaveLength(1);+ named(tree, "Use invoice-check on all your bots").props.onClick!();+ await flush();+ expect(fixture.request).toHaveBeenCalledWith("/api/bots/bot/skills/invoice-check/all-bots", { method: "POST" });+ expect(fixture.values[10]).toBe("These bots keep their own different copy: Keeper");+ named(render(true), "Disable client-onboarding").props.onClick!();+ await flush();+ expect(fixture.request).toHaveBeenCalledWith("/api/bots/bot/skills/client-onboarding", expect.objectContaining({ method: "PATCH", body: '{"enabled":false}' }));+ const confirm = vi.fn(() => false);+ vi.stubGlobal("window", { confirm });+ named(render(true), "Remove client-onboarding").props.onClick!();+ expect(confirm).toHaveBeenCalledWith("Remove “client-onboarding” from all your bots?");+ vi.unstubAllGlobals();+ });});diff --git a/src/components/bot-panel/pages.tsx b/src/components/bot-panel/pages.tsxindex ee86a9675f..3bfa9892ab 100644--- a/src/components/bot-panel/pages.tsx+++ b/src/components/bot-panel/pages.tsx@@ -1,5 +1,5 @@import { useCallback, useEffect, useState, type ReactNode } from "react";-import { FolderOpen, Plus, Server } from "lucide-react";+import { FolderOpen, Plus, Server, Users } from "lucide-react";import { appSwitchPatch } from "@/lib/bot-app-access";import { skillsLibraryEnabled } from "@/lib/feature-flags";@@ -22,7 +22,7 @@ import { useBotEditor } from "../bot-settings/BotEditorContext";import { OrgSkillsCard } from "../bot-settings/OrgSkillsCard";import { SavedWorkflowsCard } from "../skill-burger/SavedWorkflowsCard";import { isBurgerSource } from "../../../shared/skill-burger/saved";-import { SkillReviewDialog, skillSwitchOn, useManagedSkills, type ManagedSkill } from "../bot-settings/SkillsSection";+import { canUseOnAllBots, onAllBots, SkillReviewDialog, skillSwitchOn, useManagedSkills, type ManagedSkill } from "../bot-settings/SkillsSection";import { useBotApps, type BotApp } from "../bot-settings/useBotApps";import { useChoosesVisibility, VisibilitySection } from "../bot-settings/VisibilitySection";import type { useBotSettingsDerived } from "../bot-settings/useBotSettingsDerived";@@ -251,7 +251,7 @@ export function SkillsPage({ bot }: PageContext) {const remove = async (skill: ManagedSkill) => {if (skills.working) return;- if (!window.confirm(t(skill.origin === "library" ? "skills.unassignConfirm" : "botPanel.skills.removeConfirm", { name: skill.name }))) return;+ if (!window.confirm(t(skill.origin === "library" ? "skills.unassignConfirm" : skill.allBots ? "skills.allBots.removeConfirm" : "botPanel.skills.removeConfirm", { name: skill.name }))) return;skills.setWorking(skill.name);skills.setError("");try {@@ -301,16 +301,26 @@ export function SkillsPage({ bot }: PageContext) {<SwitchRowkey={skill.name}data-panel-row={`skill:${skill.name}`}- title={skill.name}+ title={onAllBots(skill) ? <>{skill.name}<span data-panel-tag="all-bots" title={t("skills.allBots.tagHint")} className="ml-1.5 rounded bg-ink/[0.06] px-1.5 py-px align-[1px] text-[11px] font-normal text-ink-secondary">{t("skills.allBots.tag")}</span></> : skill.name}hint={skill.description || skill.source}label={t("botSettings.simple.skillToggle", { name: skill.name })}color={bot.color}checked={skillSwitchOn(skill)}disabled={Boolean(skills.working)}onChange={() => void skills.toggle(skill)}- extra={skill.origin === "imported" || skill.origin === "native" ? undefined : <TrashButton data-panel-action={`remove-skill:${skill.name}`} label={t("botPanel.skills.remove", { name: skill.name })} disabled={Boolean(skills.working)} onClick={() => void remove(skill)} />}+ extra={skill.origin === "imported" || skill.origin === "native" ? undefined : <>+ {canUseOnAllBots(skill) && (+ <button type="button" data-panel-action={`all-bots-skill:${skill.name}`} aria-label={t("skills.allBots.useName", { name: skill.name })} title={t("skills.allBots.use")}+ disabled={Boolean(skills.working)} onClick={() => void skills.putOnAllBots(skill)}+ className="flex size-7 shrink-0 items-center justify-center rounded-lg text-ink-tertiary hover:bg-ink/[0.05] hover:text-ink disabled:cursor-not-allowed disabled:opacity-50">+ <Users size={15} />+ </button>+ )}+ <TrashButton data-panel-action={`remove-skill:${skill.name}`} label={t("botPanel.skills.remove", { name: skill.name })} disabled={Boolean(skills.working)} onClick={() => void remove(skill)} />+ </>}/>))}+ {skills.note && <NoteRow>{skills.note}</NoteRow>}{skills.error && !skills.reviewing && <NoteRow tone="warn">{skills.error}</NoteRow>}</Card>{project.length > 0 && (diff --git a/src/components/bot-settings/SkillsSection.tsx b/src/components/bot-settings/SkillsSection.tsxindex 8589ff06f6..2d1148d029 100644--- a/src/components/bot-settings/SkillsSection.tsx+++ b/src/components/bot-settings/SkillsSection.tsx@@ -1,4 +1,4 @@-import { BookOpen, Trash2 } from "lucide-react";+import { BookOpen, Trash2, Users } from "lucide-react";import { t } from "@/lib/i18n";import { skillImportLines } from "@/lib/skill-import";import type { SkillImportSummary } from "../../../shared/skill-import";@@ -23,11 +23,20 @@ export interface ManagedSkill {/** "imported": one copy brought in from this computer for every bot, switched per bot and never removed from one.* "native": loaded by the bot's engine from a skills folder of its own; changed only there.* "project": shipped in the folder the bot works in; used while the owner trusts project skills, changed only there. */- origin?: "private" | "library" | "imported" | "native" | "project";+ origin?: "private" | "library" | "all-bots" | "imported" | "native" | "project";+ /** On all of the person's bots, a bot made later too; the switch is this bot's own. */+ allBots?: boolean;/** An imported skill that is on but not in this bot's list: the bot finds it when a task needs it. */listed?: boolean;}+/** On all of the person's bots, with this bot's own switch. */+export const onAllBots = (skill: ManagedSkill): boolean => skill.allBots === true;++/** One of this bot's own skills, on, that it could put on all of the person's bots. */+export const canUseOnAllBots = (skill: ManagedSkill): boolean =>+ skill.enabled && !skill.allBots && (skill.origin === undefined || skill.origin === "private");+/** A skill that lives in a folder of the person's, read only here. */const inFolder = (skill: ManagedSkill): boolean => skill.origin === "native" || skill.origin === "project";@@ -58,6 +67,8 @@ export function useManagedSkills(bot: Bot) {const [error, setError] = useState("");const [reviewing, setReviewing] = useState<{ skill: ManagedSkill; text: string } | null>(null);const assignmentBusy = useRef(false);+ /** What the last "use on all bots" left to say: bots that keep a different copy of their own. */+ const [note, setNote] = useState("");const refresh = async (cancelled?: () => boolean) => {try {@@ -122,8 +133,9 @@ export function useManagedSkills(bot: Bot) {setWorking(skill.name);setError("");try {- // Native skills live in the engine's own folders; the switch only affects this bot.- if (skill.origin === "native") {+ // Native skills live in the engine's own folders, and one on all the person's bots is switched here for this bot+ // only: the switch only affects this bot.+ if (skill.origin === "native" || skill.allBots) {await api(`/api/bots/${bot.id}/skills/${encodeURIComponent(skill.name)}`, {method: "PATCH",body: JSON.stringify({ enabled: !skill.enabled }),@@ -178,8 +190,24 @@ export function useManagedSkills(bot: Bot) {}};+ /** Puts one of this bot's own skills on all of the person's bots; a bot with a different copy of its own keeps it. */+ const putOnAllBots = async (skill: ManagedSkill) => {+ setWorking(skill.name);+ setError("");+ setNote("");+ try {+ const result = (await api(`/api/bots/${bot.id}/skills/${encodeURIComponent(skill.name)}/all-bots`, { method: "POST" })) as { kept?: string[] };+ if (result.kept?.length) setNote(t("skills.allBots.kept", { names: result.kept.join(", ") }));+ await refresh();+ } catch (cause) {+ setError(cause instanceof Error ? cause.message : t("skills.allBots.failed"));+ } finally {+ setWorking("");+ }+ };+return {- skills, staged, loading, working, setWorking, error, setError, reviewing, setReviewing, refresh, toggle, enableReviewed,+ skills, staged, loading, working, setWorking, error, setError, note, reviewing, setReviewing, refresh, toggle, enableReviewed, putOnAllBots,libraryPool, addFromLibrary, setAddFromLibrary, assignmentBusy, putAssignments, addToBot,};}@@ -292,7 +320,7 @@ export function SkillsSection({ bot }: { bot: Bot }) {const featureEnabled = skillAuthoringEnabled(state.config);const libraryOn = skillsLibraryEnabled(state.config);const {- skills, staged, loading, working, setWorking, error, setError, reviewing, setReviewing, refresh, toggle, enableReviewed,+ skills, staged, loading, working, setWorking, error, setError, note, reviewing, setReviewing, refresh, toggle, enableReviewed, putOnAllBots,libraryPool, addFromLibrary, setAddFromLibrary, assignmentBusy, addToBot,} = useManagedSkills(bot);const [viewing, setViewing] = useState<{ name: string; text: string } | null>(null);@@ -356,7 +384,7 @@ export function SkillsSection({ bot }: { bot: Bot }) {}return;}- if (!window.confirm(t("skills.removeLearnedConfirm", { name: skill.name }))) return;+ if (!window.confirm(t(skill.allBots ? "skills.allBots.removeConfirm" : "skills.removeLearnedConfirm", { name: skill.name }))) return;setWorking(skill.name);setError("");try {@@ -485,12 +513,12 @@ export function SkillsSection({ bot }: { bot: Bot }) {className="min-w-0 flex-1 text-left"><div className="truncate font-mono text-[13px] text-ink">{skill.name}</div>- {(libraryOn || skill.origin === "imported" || inFolder(skill)) && (+ {(libraryOn || onAllBots(skill) || skill.origin === "imported" || inFolder(skill)) && (<spanclassName="ml-1.5 rounded bg-control px-1 py-px font-mono text-[10px] uppercase tracking-wide text-ink-secondary"- title={skill.origin === "imported" ? t("skills.origin.importedHint") : skill.origin === "native" ? t("skills.origin.nativeHint") : skill.origin === "project" ? t("skills.origin.projectHint") : undefined}+ title={onAllBots(skill) ? t("skills.allBots.tagHint") : skill.origin === "imported" ? t("skills.origin.importedHint") : skill.origin === "native" ? t("skills.origin.nativeHint") : skill.origin === "project" ? t("skills.origin.projectHint") : undefined}>- {skill.origin === "imported" ? t("skills.origin.imported") : skill.origin === "native" ? t("skills.origin.native") : skill.origin === "project" ? t("skills.origin.project") : skill.origin === "library" ? t("skills.origin.library") : t("skills.origin.private")}+ {onAllBots(skill) ? t("skills.allBots.tag") : skill.origin === "imported" ? t("skills.origin.imported") : skill.origin === "native" ? t("skills.origin.native") : skill.origin === "project" ? t("skills.origin.project") : skill.origin === "library" ? t("skills.origin.library") : t("skills.origin.private")}</span>)}<div className="mt-0.5 line-clamp-2 text-[12px] text-ink-secondary">{skill.description}</div>@@ -504,6 +532,18 @@ export function SkillsSection({ bot }: { bot: Bot }) {onClick={() => void toggle(skill)}/>)}+ {canUseOnAllBots(skill) && (+ <button+ type="button"+ aria-label={t("skills.allBots.useName", { name: skill.name })}+ title={t("skills.allBots.use")}+ disabled={Boolean(working)}+ onClick={() => void putOnAllBots(skill)}+ className="flex size-8 shrink-0 items-center justify-center rounded-md text-ink-secondary hover:bg-control hover:text-ink disabled:opacity-40"+ >+ <Users size={15} />+ </button>+ )}{skill.origin !== "imported" && !inFolder(skill) && (<buttonaria-label={t("skills.removeName", { name: skill.name })}@@ -529,6 +569,7 @@ export function SkillsSection({ bot }: { bot: Bot }) {{staged.length === 1 ? t("skills.stagedOne") : t("skills.stagedMany", { count: staged.length })}</div>)}+ {note && <div className="mt-2 text-[12px] text-ink-secondary">{note}</div>}{error && <div role="alert" className="mt-2 text-[12px] text-danger">{error}</div>}</div>diff --git a/src/locales/de.json b/src/locales/de.jsonindex 9c8f8d1f1f..65c6fd67c1 100644--- a/src/locales/de.json+++ b/src/locales/de.json@@ -138,6 +138,21 @@"server.skillSwitch.delete.title": "Skill „{name}“ löschen?","server.skillSwitch.delete.body": "Entfernt diesen Skill mit all seinen Dateien endgültig vom Bot. Seine SKILL.md steht unten, Geheimnisse sind ausgeblendet.","server.skillSwitch.delete.done": "Skill „{name}“ gelöscht",+ "server.allBotsSkill.create.title": "Skill „{name}“ auf alle deine Bots legen?",+ "server.allBotsSkill.create.done": "Skill „{name}“ ist auf allen deinen Bots",+ "server.allBotsSkill.update.title": "Skill „{name}“ auf allen deinen Bots aktualisieren?",+ "server.allBotsSkill.update.done": "Skill „{name}“ auf allen deinen Bots aktualisiert",+ "server.allBotsSkill.delete.title": "Skill „{name}“ von allen deinen Bots entfernen?",+ "server.allBotsSkill.delete.done": "Skill „{name}“ von allen deinen Bots entfernt",+ "server.allBotsSkill.body": "Alle deine Bots nutzen dieselbe Kopie, auch Bots, die du später hinzufügst. Für einen einzelnen Bot schaltest du ihn auf dessen Skills-Seite aus.",+ "server.allBotsSkill.deleteBody": "Er verschwindet von jedem deiner Bots, der ihn hat. Seine SKILL.md steht unten, Geheimnisse sind ausgeblendet.",+ "skills.allBots.tag": "Alle Bots",+ "skills.allBots.tagHint": "Auf allen deinen Bots, auch auf später hinzugefügten. Der Schalter schaltet ihn nur für diesen Bot aus.",+ "skills.allBots.use": "Auf allen Bots nutzen",+ "skills.allBots.useName": "{name} auf allen deinen Bots nutzen",+ "skills.allBots.removeConfirm": "„{name}“ von allen deinen Bots entfernen?",+ "skills.allBots.kept": "Diese Bots behalten ihre eigene, andere Kopie: {names}",+ "skills.allBots.failed": "Der Skill konnte nicht auf alle deine Bots gelegt werden.","server.mcp.listed": "MCP-Server geprüft","server.mcp.on": "Eingeschaltet","server.mcp.switchedOff": "Ausgeschaltet",diff --git a/src/locales/en.json b/src/locales/en.jsonindex 293b0f0101..b2ffa92c9a 100644--- a/src/locales/en.json+++ b/src/locales/en.json@@ -277,6 +277,14 @@"server.skillSwitch.delete.title": "Delete skill \"{name}\"?","server.skillSwitch.delete.body": "Removes this skill and all its files from the bot for good. Its SKILL.md is shown below, with any secrets hidden.","server.skillSwitch.delete.done": "Skill \"{name}\" deleted",+ "server.allBotsSkill.create.title": "Put skill \"{name}\" on all your bots?",+ "server.allBotsSkill.create.done": "Skill \"{name}\" is on all your bots",+ "server.allBotsSkill.update.title": "Update skill \"{name}\" on all your bots?",+ "server.allBotsSkill.update.done": "Skill \"{name}\" updated on all your bots",+ "server.allBotsSkill.delete.title": "Remove skill \"{name}\" from all your bots?",+ "server.allBotsSkill.delete.done": "Skill \"{name}\" removed from all your bots",+ "server.allBotsSkill.body": "Every bot of yours uses the same copy, including bots you add later. Turn it off for one bot on that bot's Skills page.",+ "server.allBotsSkill.deleteBody": "It goes from every bot of yours that has it. Its SKILL.md is shown below, with any secrets hidden.","server.mcp.listed": "Checked MCP servers","server.mcp.on": "Turned on","server.mcp.switchedOff": "Switched off",@@ -9325,6 +9333,13 @@"skills.enableName": "Enable {name}","skills.disableName": "Disable {name}","skills.removeName": "Remove {name}",+ "skills.allBots.tag": "All bots",+ "skills.allBots.tagHint": "On all your bots, including ones you add later. The switch turns it off for this bot only.",+ "skills.allBots.use": "Use on all bots",+ "skills.allBots.useName": "Use {name} on all your bots",+ "skills.allBots.removeConfirm": "Remove “{name}” from all your bots?",+ "skills.allBots.kept": "These bots keep their own different copy: {names}",+ "skills.allBots.failed": "Couldn't put this skill on all your bots.","skills.remove": "Remove skill","skills.stagedOne": "1 proposal is waiting for a decision in chat.","skills.stagedMany": "{count} proposals are waiting for a decision in chat.",diff --git a/src/locales/it.json b/src/locales/it.jsonindex 524b4c2ed5..89962d1237 100644--- a/src/locales/it.json+++ b/src/locales/it.json@@ -277,6 +277,21 @@"server.skillSwitch.delete.title": "Eliminare abilità \"{name}\"?","server.skillSwitch.delete.body": "Rimuove questa abilità e tutti i suoi file dal bot per sempre. Il suo SKILL.md è mostrato qui sotto, con tutti i segreti nascosti.","server.skillSwitch.delete.done": "Abilità “{name}” eliminata",+ "server.allBotsSkill.create.title": "Mettere l'abilità \"{name}\" su tutti i tuoi bot?",+ "server.allBotsSkill.create.done": "L'abilità \"{name}\" è su tutti i tuoi bot",+ "server.allBotsSkill.update.title": "Aggiornare l'abilità \"{name}\" su tutti i tuoi bot?",+ "server.allBotsSkill.update.done": "Abilità \"{name}\" aggiornata su tutti i tuoi bot",+ "server.allBotsSkill.delete.title": "Rimuovere l'abilità \"{name}\" da tutti i tuoi bot?",+ "server.allBotsSkill.delete.done": "Abilità \"{name}\" rimossa da tutti i tuoi bot",+ "server.allBotsSkill.body": "Tutti i tuoi bot usano la stessa copia, anche quelli che aggiungerai dopo. Per spegnerla su un solo bot, usa la pagina Abilità di quel bot.",+ "server.allBotsSkill.deleteBody": "Sparisce da ogni tuo bot che la ha. Il suo SKILL.md è mostrato qui sotto, con tutti i segreti nascosti.",+ "skills.allBots.tag": "Tutti i bot",+ "skills.allBots.tagHint": "Su tutti i tuoi bot, anche quelli che aggiungerai dopo. L'interruttore la spegne solo per questo bot.",+ "skills.allBots.use": "Usa su tutti i bot",+ "skills.allBots.useName": "Usa {name} su tutti i tuoi bot",+ "skills.allBots.removeConfirm": "Rimuovere “{name}” da tutti i tuoi bot?",+ "skills.allBots.kept": "Questi bot tengono una propria copia diversa: {names}",+ "skills.allBots.failed": "Non è stato possibile mettere questa abilità su tutti i tuoi bot.","server.mcp.listed": "Server MCP controllati","server.mcp.on": "Attivato","server.mcp.switchedOff": "Disattivato",diff --git a/src/locales/pt-br.json b/src/locales/pt-br.jsonindex cdadd9256a..e626d09655 100644--- a/src/locales/pt-br.json+++ b/src/locales/pt-br.json@@ -258,6 +258,21 @@"server.skillSwitch.delete.title": "Excluir a habilidade “{name}”?","server.skillSwitch.delete.body": "Remove esta habilidade e todos os arquivos dela do bot de forma definitiva. O SKILL.md aparece abaixo, com os segredos ocultos.","server.skillSwitch.delete.done": "Habilidade “{name}” excluída",+ "server.allBotsSkill.create.title": "Colocar a habilidade “{name}” em todos os seus bots?",+ "server.allBotsSkill.create.done": "A habilidade “{name}” está em todos os seus bots",+ "server.allBotsSkill.update.title": "Atualizar a habilidade “{name}” em todos os seus bots?",+ "server.allBotsSkill.update.done": "Habilidade “{name}” atualizada em todos os seus bots",+ "server.allBotsSkill.delete.title": "Remover a habilidade “{name}” de todos os seus bots?",+ "server.allBotsSkill.delete.done": "Habilidade “{name}” removida de todos os seus bots",+ "server.allBotsSkill.body": "Todos os seus bots usam a mesma cópia, inclusive os que você adicionar depois. Para desligar em um só bot, use a página Habilidades desse bot.",+ "server.allBotsSkill.deleteBody": "Ela sai de todos os seus bots que a têm. O SKILL.md aparece abaixo, com os segredos ocultos.",+ "skills.allBots.tag": "Todos os bots",+ "skills.allBots.tagHint": "Em todos os seus bots, inclusive os que você adicionar depois. O botão desliga só para este bot.",+ "skills.allBots.use": "Usar em todos os bots",+ "skills.allBots.useName": "Usar {name} em todos os seus bots",+ "skills.allBots.removeConfirm": "Remover “{name}” de todos os seus bots?",+ "skills.allBots.kept": "Estes bots mantêm a própria cópia, que é diferente: {names}",+ "skills.allBots.failed": "Não foi possível colocar esta habilidade em todos os seus bots.","server.mcp.listed": "Conferiu os servidores MCP","server.mcp.on": "Ligado","server.mcp.switchedOff": "Desligado",diff --git a/src/locales/zh-tw.json b/src/locales/zh-tw.jsonindex 10949f96ca..3fa2031295 100644--- a/src/locales/zh-tw.json+++ b/src/locales/zh-tw.json@@ -255,6 +255,21 @@"server.skillSwitch.delete.title": "要刪除技能「{name}」嗎?","server.skillSwitch.delete.body": "從機器人中永久移除這個技能及其所有檔案。下方顯示它的 SKILL.md,並已隱藏所有機密資訊。","server.skillSwitch.delete.done": "已刪除技能「{name}」",+ "server.allBotsSkill.create.title": "要把技能「{name}」放到你所有的機器人上嗎?",+ "server.allBotsSkill.create.done": "技能「{name}」已在你所有的機器人上",+ "server.allBotsSkill.update.title": "要在你所有的機器人上更新技能「{name}」嗎?",+ "server.allBotsSkill.update.done": "已在你所有的機器人上更新技能「{name}」",+ "server.allBotsSkill.delete.title": "要從你所有的機器人移除技能「{name}」嗎?",+ "server.allBotsSkill.delete.done": "已從你所有的機器人移除技能「{name}」",+ "server.allBotsSkill.body": "你所有的機器人都使用同一份副本,包括之後新增的機器人。若只想為某個機器人關閉,請到該機器人的技能頁面操作。",+ "server.allBotsSkill.deleteBody": "它會從你所有擁有它的機器人上移除。下方顯示它的 SKILL.md,並已隱藏所有機密資訊。",+ "skills.allBots.tag": "所有機器人",+ "skills.allBots.tagHint": "在你所有的機器人上,包括之後新增的。開關只會為這個機器人關閉它。",+ "skills.allBots.use": "用於所有機器人",+ "skills.allBots.useName": "將 {name} 用於你所有的機器人",+ "skills.allBots.removeConfirm": "要從你所有的機器人移除「{name}」嗎?",+ "skills.allBots.kept": "這些機器人保留了各自不同的副本:{names}",+ "skills.allBots.failed": "無法把這個技能放到你所有的機器人上。","server.mcp.listed": "已查看 MCP 伺服器","server.mcp.on": "已開啟","server.mcp.switchedOff": "已關閉",diff --git a/src/locales/zh.json b/src/locales/zh.jsonindex bc1a65af0a..c10198541e 100644--- a/src/locales/zh.json+++ b/src/locales/zh.json@@ -35,6 +35,21 @@"server.skillSwitch.delete.title": "删除技能“{name}”?","server.skillSwitch.delete.body": "会把这个技能及其所有文件从机器人中永久移除。下面显示它的 SKILL.md,其中的机密已被隐藏。","server.skillSwitch.delete.done": "技能“{name}”已删除",+ "server.allBotsSkill.create.title": "要把技能“{name}”放到你的所有机器人上吗?",+ "server.allBotsSkill.create.done": "技能“{name}”已在你的所有机器人上",+ "server.allBotsSkill.update.title": "要在你的所有机器人上更新技能“{name}”吗?",+ "server.allBotsSkill.update.done": "已在你的所有机器人上更新技能“{name}”",+ "server.allBotsSkill.delete.title": "要从你的所有机器人上移除技能“{name}”吗?",+ "server.allBotsSkill.delete.done": "已从你的所有机器人上移除技能“{name}”",+ "server.allBotsSkill.body": "你的所有机器人都使用同一份副本,包括以后添加的机器人。要只为某个机器人关闭,请在该机器人的技能页面操作。",+ "server.allBotsSkill.deleteBody": "它会从你所有拥有它的机器人上移除。下面显示它的 SKILL.md,其中的机密已被隐藏。",+ "skills.allBots.tag": "所有机器人",+ "skills.allBots.tagHint": "在你的所有机器人上,包括以后添加的。开关只为这个机器人关闭它。",+ "skills.allBots.use": "用于所有机器人",+ "skills.allBots.useName": "把 {name} 用于你的所有机器人",+ "skills.allBots.removeConfirm": "要从你的所有机器人上移除“{name}”吗?",+ "skills.allBots.kept": "这些机器人保留了各自不同的副本:{names}",+ "skills.allBots.failed": "无法把这个技能放到你的所有机器人上。","server.notify.message": "来自 {who} 的消息","server.notify.workingFor": "{who},为 {other} 工作","server.notify.secret": "{who} 需要你的{label}",