From 9f05e6cd944aa850bcccfd6634ee05d9665507b9 Mon Sep 17 00:00:00 2001 From: Kris Braun Date: Sun, 8 Mar 2026 12:51:03 -0400 Subject: [PATCH 1/3] Add AIOptions, AICapabilities types and available() method to AI tool Co-Authored-By: Claude Opus 4.6 --- twister/src/tools/ai.ts | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/twister/src/tools/ai.ts b/twister/src/tools/ai.ts index f787ad7..d9253a2 100644 --- a/twister/src/tools/ai.ts +++ b/twister/src/tools/ai.ts @@ -65,6 +65,13 @@ import { ITool } from ".."; * ``` */ export abstract class AI extends ITool { + /** + * Returns which AI capabilities are currently available. + * Check this before calling prompt() or embed() to gracefully + * handle cases where AI is disabled by the user. + */ + abstract available(): AICapabilities; + /** * Sends a request to an AI model and returns the response using the Vercel AI SDK. * @@ -146,6 +153,20 @@ export abstract class AI extends ITool { ): Promise>; } +/** Options for configuring AI tool usage in a twist. */ +export type AIOptions = { + /** Whether AI is required for this twist to function. Default: true */ + required?: boolean; +}; + +/** Describes which AI capabilities are currently available to this twist. */ +export type AICapabilities = { + /** Whether AI prompting (text generation) is available. */ + prompt: boolean; + /** Whether AI embedding generation is available. */ + embed: boolean; +}; + /** * Model preferences for selecting an AI model based on performance and cost requirements. * This allows Plot to match those preferences with user preferences (such as preferred or From faba1b95b0d1eace20e0cc7b045e469083478d8b Mon Sep 17 00:00:00 2001 From: Kris Braun Date: Sun, 8 Mar 2026 12:59:17 -0400 Subject: [PATCH 2/3] Add changeset for AI preferences types Co-Authored-By: Claude Opus 4.6 --- .changeset/ai-preferences.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/ai-preferences.md diff --git a/.changeset/ai-preferences.md b/.changeset/ai-preferences.md new file mode 100644 index 0000000..7de20b6 --- /dev/null +++ b/.changeset/ai-preferences.md @@ -0,0 +1,5 @@ +--- +"@plotday/twister": minor +--- + +Add AIOptions, AICapabilities types and available() method to AI tool for controlling AI feature availability in twists From 5f9da95a73fc4c5d8325202ce14878bec0d7b8b1 Mon Sep 17 00:00:00 2001 From: Kris Braun Date: Sun, 8 Mar 2026 13:00:07 -0400 Subject: [PATCH 3/3] Fix changeset category prefix Co-Authored-By: Claude Opus 4.6 --- .changeset/ai-preferences.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changeset/ai-preferences.md b/.changeset/ai-preferences.md index 7de20b6..a43348a 100644 --- a/.changeset/ai-preferences.md +++ b/.changeset/ai-preferences.md @@ -2,4 +2,4 @@ "@plotday/twister": minor --- -Add AIOptions, AICapabilities types and available() method to AI tool for controlling AI feature availability in twists +Added: AIOptions, AICapabilities types and available() method to AI tool for controlling AI feature availability in twists