Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

Β 

History

136 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

MulmoChat Plugin Quiz

npm version scoria

πŸ“¦ 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.

Overview

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

Features

  • 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 Values

Do NOT use Tailwind's arbitrary values (e.g., bg-[#1a1a2e], w-[137px]) in plugin code. MulmoChat uses @source directive to scan plugins, which only supports standard Tailwind classes. Use standard classes like bg-slate-900 instead.

Installation

Adding to MulmoChat

  1. Install the plugin:
cd MulmoChat
yarn add @mulmochat-plugin/quiz gui-chat-protocol

gui-chat-protocol is a peer dependency β€” install it alongside the plugin; the host application provides the runtime and this plugin only declares the compatible range.

  1. Import in MulmoChat's src/tools/index.ts:
import QuizPlugin from "@mulmochat-plugin/quiz/vue";

// Add to pluginList
const pluginList = [
  // ... other plugins
  QuizPlugin,
];
  1. Import styles in src/main.ts:
import "@mulmochat-plugin/quiz/style.css";

Package Exports

// 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";

Development

Setup

yarn install

Development Server

# Vue demo
yarn dev

# React demo
yarn dev:react

Demo page will be available at http://localhost:5173/

Build

yarn build

Type Check

yarn typecheck

Lint

yarn lint

Plugin Structure

MulmoChatPluginQuiz/
β”œβ”€β”€ 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

Directory Purpose

  • 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.

Creating a New Plugin

Use the automated script or follow the detailed template guide:

Quick Start (Recommended)

# 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 dev

Manual Setup

See 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)

Core Types

ToolPluginCore (Framework-agnostic)

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[];
}

ToolContext

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.

ToolPlugin (Vue-specific, extends ToolPluginCore)

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
}

ToolPlugin (React-specific, extends ToolPluginCore)

interface ToolPlugin<T, J, A> extends ToolPluginCore<T, J, A> {
  viewComponent?: ComponentType;    // React ComponentType
  previewComponent?: ComponentType; // React ComponentType
}

Test Prompts

Try these prompts to test the plugin:

  1. "Give me a 3-question quiz about world geography"
  2. "Quiz me on basic JavaScript concepts"
  3. "Create a history quiz about World War II"

License

MIT

Related

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages