Let the coordinator manage skills, MCP servers and tools, behind a confirm card
- 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]>
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
import type { ExtensionProposalView } from "@/src/types";
|
||||
import proposalTitle from "./proposal-title";
|
||||
|
||||
type Params = {
|
||||
view: ExtensionProposalView;
|
||||
};
|
||||
|
||||
/**
|
||||
* What the chat tells the bot once the user decided on its proposal, so
|
||||
* it carries on knowing what happened (and never has to take the user's
|
||||
* word over the card's).
|
||||
*/
|
||||
export default function proposalDecisionMessage({ view }: Params) {
|
||||
const title = proposalTitle({ view });
|
||||
|
||||
if (view.status == "rejected") return `I rejected proposal #${view.id} (${title}). Nothing was saved.`;
|
||||
|
||||
if (view.status == "failed") return `I confirmed proposal #${view.id} (${title}), but it failed. ${view.outcome}`;
|
||||
|
||||
return `I confirmed proposal #${view.id} (${title}). ${view.outcome}`;
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
type Params = {
|
||||
expires_at: number;
|
||||
now?: number;
|
||||
};
|
||||
|
||||
/**
|
||||
* How long a pending proposal can still be confirmed, e.g. `Expires in 23h`.
|
||||
*/
|
||||
export default function proposalExpiryLabel({ expires_at, now = Date.now() }: Params) {
|
||||
const minutes = Math.max(0, Math.round((expires_at - now) / 60000));
|
||||
|
||||
if (minutes < 60) return `Expires in ${Math.max(1, minutes)}m`;
|
||||
|
||||
return `Expires in ${Math.round(minutes / 60)}h`;
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
import type { ExtensionProposalView } from "@/src/types";
|
||||
|
||||
type Params = {
|
||||
view: Pick<ExtensionProposalView, "status" | "expired">;
|
||||
};
|
||||
|
||||
/**
|
||||
* Where a proposal stands, in a word for its chip.
|
||||
*/
|
||||
export default function proposalStatusLabel({ view }: Params) {
|
||||
if (view.expired) return "Expired";
|
||||
|
||||
return {
|
||||
pending: "Waiting for you",
|
||||
confirmed: "Confirmed",
|
||||
rejected: "Rejected",
|
||||
replaced: "Replaced",
|
||||
failed: "Failed",
|
||||
}[view.status];
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
import { ExtensionProposalKinds } from "@/src/dict/extension-proposal-dict";
|
||||
import type { ExtensionProposalView } from "@/src/types";
|
||||
|
||||
type Params = {
|
||||
view: Pick<ExtensionProposalView, "kind" | "extension_id" | "name">;
|
||||
};
|
||||
|
||||
/**
|
||||
* What a proposal does, e.g. `Add MCP server GitHub` or `Change tool
|
||||
* weather`.
|
||||
*/
|
||||
export default function proposalTitle({ view }: Params) {
|
||||
const kind = ExtensionProposalKinds.find((k) => k.value == view.kind)?.title || view.kind;
|
||||
|
||||
return `${view.extension_id ? "Change" : "Add"} ${kind} ${view.name}`;
|
||||
}
|
||||
Reference in New Issue
Block a user