π¦ Template Repository This is the reference implementation for MulmoChat plugins. Use this repository as a template to create your own plugins. See TEMPLATE.md for detailed instructions.
A quiz plugin for MulmoChat. Presents multiple choice quizzes to users.
This plugin is the reference implementation of the MulmoChat plugin system. With its simple structure requiring no server communication, it can be used as a template for creating new plugins.
It demonstrates the framework-agnostic core architecture with Vue and React implementations:
- Core: Framework-agnostic plugin logic (can be used with any UI framework)
- Vue: Vue-specific UI components
- React: React-specific UI components
- Tailwind CSS 4 for styling
- TypeScript for type-safe implementation
- ESLint for static analysis
- Framework-agnostic core for portability
- Multi-framework support (Vue and React)
β οΈ Important: No Arbitrary ValuesDo NOT use Tailwind's arbitrary values (e.g.,
bg-[#1a1a2e],w-[137px]) in plugin code. MulmoChat uses@sourcedirective to scan plugins, which only supports standard Tailwind classes. Use standard classes likebg-slate-900instead.
- Install the plugin:
cd MulmoChat
yarn add @mulmochat-plugin/quiz gui-chat-protocol
gui-chat-protocolis a peer dependency β install it alongside the plugin; the host application provides the runtime and this plugin only declares the compatible range.
- Import in MulmoChat's
src/tools/index.ts:
import QuizPlugin from "@mulmochat-plugin/quiz/vue";
// Add to pluginList
const pluginList = [
// ... other plugins
QuizPlugin,
];- Import styles in
src/main.ts:
import "@mulmochat-plugin/quiz/style.css";// Default: Core (framework-agnostic)
import { pluginCore, TOOL_NAME, QuizData } from "@mulmochat-plugin/quiz";
// Vue implementation
import QuizPlugin from "@mulmochat-plugin/quiz/vue";
import "@mulmochat-plugin/quiz/style.css";
// Named Vue exports
import { plugin, View, Preview } from "@mulmochat-plugin/quiz/vue";
// React implementation
import QuizPlugin from "@mulmochat-plugin/quiz/react";
import "@mulmochat-plugin/quiz/style.css";
// Named React exports
import { plugin, View, Preview } from "@mulmochat-plugin/quiz/react";yarn install# Vue demo
yarn dev
# React demo
yarn dev:reactDemo page will be available at http://localhost:5173/
yarn buildyarn typecheckyarn lintMulmoChatPluginQuiz/
βββ src/
β βββ index.ts # Default export (core)
β βββ style.css # Tailwind CSS entry
β βββ core/ # Framework-agnostic (no Vue/React dependencies)
β β βββ index.ts # Core exports
β β βββ types.ts # Quiz-specific types (QuizData, QuizArgs)
β β βββ definition.ts # Tool definition (schema)
β β βββ samples.ts # Sample data
β β βββ plugin.ts # Execute function
β βββ vue/ # Vue-specific implementation
β β βββ index.ts # Vue plugin (combines core + components)
β β βββ View.vue # Main view component
β β βββ Preview.vue # Sidebar preview component
β βββ react/ # React-specific implementation
β βββ index.ts # React plugin (combines core + components)
β βββ View.tsx # Main view component
β βββ Preview.tsx # Sidebar preview component
βββ demo/ # Vue demo
β βββ App.vue
β βββ main.ts
βββ demo-react/ # React demo
β βββ App.tsx
β βββ main.tsx
β βββ style.css
β βββ index.html
β βββ vite.config.ts
βββ package.json
βββ vite.config.ts
βββ tsconfig.json
βββ tsconfig.react.json # React-specific TypeScript config
βββ eslint.config.js
- src/core/: Framework-agnostic types and plugin logic. No Vue/React dependencies.
- src/vue/: Vue-specific UI components and the full Vue plugin export.
- src/react/: React-specific UI components and the full React plugin export.
- demo/: Vue demo.
- demo-react/: React demo.
Use the automated script or follow the detailed template guide:
# Generate a new plugin
./scripts/create-plugin.sh my-plugin "My Plugin" "Description of my plugin"
# Move to generated directory and install
cd ../MulmoChatPluginMyPlugin
yarn install
yarn devSee TEMPLATE.md for detailed instructions on:
- Core/Vue architecture
- Files that can be copied as-is
- Plugin-specific implementation requirements
- Important patterns (View.vue reactivity)
interface ToolPluginCore<T, J, A> {
toolDefinition: ToolDefinition;
execute: (context: ToolContext, args: A) => Promise<ToolResult<T, J>>;
generatingMessage: string;
isEnabled: (startResponse?: StartApiResponse | null) => boolean;
// Optional
systemPrompt?: string;
inputHandlers?: InputHandler[];
configSchema?: PluginConfigSchema;
samples?: ToolSample[];
backends?: BackendType[];
}interface ToolContext {
currentResult?: ToolResult | null; // Currently selected result
app?: ToolContextApp; // Host app features
userSpokeAt?: number; // 2.1: when the user last spoke (Date.now() ms)
conversationId?: string; // 2.2: which conversation the call belongs to
}app holds the host's functions (check one exists before calling it; generateImage and
editImages are shared conventions). A tool that shows steps one at a time returns sequence on
its results. See the API reference.
interface ToolPlugin<T, J, A> extends ToolPluginCore<T, J, A> {
viewComponent?: Component; // Vue Component
previewComponent?: Component; // Vue Component
config?: ToolPluginConfig; // Legacy Vue component-based config
}interface ToolPlugin<T, J, A> extends ToolPluginCore<T, J, A> {
viewComponent?: ComponentType; // React ComponentType
previewComponent?: ComponentType; // React ComponentType
}Try these prompts to test the plugin:
- "Give me a 3-question quiz about world geography"
- "Quiz me on basic JavaScript concepts"
- "Create a history quiz about World War II"
MIT
- Protocol spec: gui-chat-protocol
- Reference implementations using this protocol: mulmoclaude Β· MulmoChat