Add MCP servers and custom tools for bots
Two new settings pages, MCPs and Tools. Super admins define them; super
admins and admins attach them to bots, to workspaces (every bot there),
or to every bot. Bots get them in chat replies and tasks.
- Custom tools: a JSON-schema of arguments plus an HTTP request, a script
on the bot's computer, or a prompt, templated with {{args.x}} and
{{env.KEY}}, secrets redacted from results.
- MCP servers: remote (URL and headers) or stdio commands run on the host
with a setup command and an isolated env, in a per-process pool. Tools
are listed into a cache and connect on first call.
- Add, edit, access and try open in modals.
- Markdown, JSON and command fields use twui's AceEditor (CodeEditor),
its scripts loaded on demand.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
import { describe, expect, test } from "bun:test";
|
||||
import parseTemplateLines, { templateLines } from "./parse-template-lines";
|
||||
|
||||
describe("parseTemplateLines", () => {
|
||||
test("reads headers, keeping colons in values", () => {
|
||||
expect(
|
||||
parseTemplateLines({ text: "Authorization: Bearer {{env.T}}\n\nX-Url: http://a:1\nbad line", separator: ":" }),
|
||||
).toEqual({ Authorization: "Bearer {{env.T}}", "X-Url": "http://a:1" });
|
||||
});
|
||||
|
||||
test("reads envs and writes them back", () => {
|
||||
const map = parseTemplateLines({ text: "A=1\nB = x=y", separator: "=" });
|
||||
expect(map).toEqual({ A: "1", B: "x=y" });
|
||||
expect(templateLines({ map, separator: "=" })).toBe("A=1\nB=x=y");
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user