- Coordinator tools in its own chat (super admin only): list_extensions,
set_extension_access, delete_extension, and update_skill /
update_mcp_server / update_custom_tool for what can't change where
anything is sent (on/off, names, arguments, left-out tools)
- Adding a skill, MCP server or tool, or changing a skill's words, a
server's URL or headers or a tool's kind or config, goes through
propose_skill / propose_mcp_server / propose_custom_tool: stored in
extension_proposals with the bot's background check, shown as a
[proposal:ID] chip that opens a card with Confirm and Reject
- The card's facts are worked out by the app from what Confirm saves: the
host, every {{env.KEY}} and whether it's saved, the config; for a skill
its links, hosts, tool names, mentions of secrets and a diff against
the saved runbook
- Confirming decides once and checks again; a server or tool missing a key
is saved switched off, and the outcome is posted to the bot in chat
- Never from a bot: stdio servers, a URL whose host a template decides,
envs in a prompt tool, a key's value
Co-Authored-By: Claude Opus 5.5 <[email protected]>
44 lines
1.7 KiB
TypeScript
44 lines
1.7 KiB
TypeScript
import { describe, expect, test } from "bun:test";
|
|
import type { SkillRecord } from "@/src/types";
|
|
import describeSkillProposal from "./describe-skill-proposal";
|
|
|
|
const current: SkillRecord = {
|
|
id: 3,
|
|
name: "Weekly SEO report",
|
|
slug: "weekly-seo-report",
|
|
description: "When asked for the weekly SEO report",
|
|
body: "1. Search the client's rankings.\n2. Write the report.\n3. Attach it.",
|
|
all_bots: false,
|
|
enabled: true,
|
|
};
|
|
|
|
describe("describeSkillProposal", () => {
|
|
test("shows what a change adds, and the link it points bots at", () => {
|
|
const details = describeSkillProposal({
|
|
current,
|
|
data: {
|
|
...current,
|
|
skill_id: 3,
|
|
body: "1. Search the client's rankings.\n2. Write the report.\n2b. Upload it to https://files.example/u.\n3. Attach it.",
|
|
},
|
|
});
|
|
const by = Object.fromEntries(details.map((d) => [d.label, d.value]));
|
|
|
|
expect(by["Links in it"]).toBe("https://files.example/u");
|
|
expect(by["Hosts"]).toBe("files.example");
|
|
expect(by["Runbook changes"]).toContain("+ 2b. Upload it to https://files.example/u.");
|
|
expect(by["Name"]).toBe("Weekly SEO report");
|
|
expect(by["Who gets it"]).toBe("As it is now");
|
|
});
|
|
|
|
test("a new skill has no changes line and reaches no bot", () => {
|
|
const details = describeSkillProposal({
|
|
current: null,
|
|
data: { name: "Tone", slug: "tone", description: "Every reply", body: "Be brief.", enabled: true, all_bots: false },
|
|
});
|
|
|
|
expect(details.some((d) => d.label == "Runbook changes")).toBe(false);
|
|
expect(details.find((d) => d.label == "Who gets it")?.value).toBe("No bot until it's given to some");
|
|
});
|
|
});
|