fix assistant widget configuration

This commit is contained in:
ajnart committed 2026-08-14 11:32:10 +02:00
1 parent 8d06201b41
commit 1f60b4b4be
16 files changed
+696 -11

No files matched your search

@@ -24,6 +24,14 @@ const supportedToolArguments = {
summary: "Improve dashboard contrast.",
changes: { primaryColor: "#7C3AED" },
},
configure_widget: {
boardId: "board-1",
boardName: "Home",
kind: "notebook",
summary: "Add a formatted Plex self-hosting guide.",
options: { content: "<h2>Self-host Plex</h2><p>Install Docker first.</p>" },
integrationIds: [],
},
navigate_to_route: { path: "/manage/apps" },
open_command_menu: {},
open_media_request_search: {},
@@ -127,6 +135,20 @@ describe("assistant human tool contracts", () => {
expect(() => z.toJSONSchema(browserToolContracts.configure_board_settings.parameters)).not.toThrow();
});
test("accepts a native widget configuration with proposed options and integrations", () => {
expect(
browserToolContracts.configure_widget.parameters.safeParse({
boardId: "board-1",
boardName: "Home",
kind: "mediaServer",
summary: "Show current Plex streams.",
options: { showOnlyPlaying: true },
integrationIds: ["plex-1"],
}).success,
).toBe(true);
expect(() => z.toJSONSchema(browserToolContracts.configure_widget.parameters)).not.toThrow();
});
test("only preserves usable app icon URLs", () => {
expect(normalizeAssistantAppIconUrl("youtube")).toBe("");
expect(normalizeAssistantAppIconUrl("/api/media/youtube.svg")).toBe("/api/media/youtube.svg");