# Round 28 — Plugin Format Spec · The 4-Layer Plugin

**Date**: 2026-04-30
**Status**: ✅ COMPLETE
**Round Type**: Marketplace (קו D begins)

---

## 🎯 שאלה

**מה בדיוק יש בplugin? איך מעצב/מפתח עוטף 4 שכבות לZIP אחד?**

---

## 🏆 Verdict: **4 שכבות בZIP** — Schema + Agents + Renderer + Triggers

---

## 📦 Plugin ZIP Structure

```
my-plugin.jason/                   ⬅ ZIP archive
│
├── plugin.json                    ⬅ Manifest
│
├── schema/                        ⬅ Layer 1 — A2UI Catalog
│   ├── catalog.json               ⬅ A2UI catalog definition
│   └── tokens.json                ⬅ DTCG tokens (optional, L3 override)
│
├── agents/                        ⬅ Layer 2 — LLM Configurations
│   ├── prompts/
│   │   ├── system.txt             ⬅ system prompt
│   │   └── few-shot.json          ⬅ examples
│   ├── functions.json             ⬅ tool definitions
│   └── triggers.yaml              ⬅ when to invoke this plugin
│
├── renderer/                      ⬅ Layer 3 — Frontend Code
│   ├── components/
│   │   ├── MyComponent.tsx
│   │   └── styles.css
│   ├── package.json               ⬅ npm deps
│   └── index.ts                   ⬅ component registry export
│
├── triggers/                      ⬅ Layer 4 — Backend Hooks
│   ├── plugin.py                  ⬅ Python plugin (clastop-mega format)
│   ├── plugin.json                ⬅ hooks manifest
│   └── requirements.txt           ⬅ pip deps
│
├── assets/                        ⬅ Static files
│   ├── icons/
│   ├── lottie/
│   └── images/
│
├── README.md                      ⬅ Documentation
└── LICENSE
```

---

## 📜 plugin.json Manifest

```json
{
  "id": "advergame-quiz-pepsi",
  "version": "1.0.0",
  "name": "Pepsi Quiz Advergame",
  "description": "Inline trivia game template for Pepsi sponsored content",
  "author": "AdAgency Inc",
  "author_email": "support@adagency.com",
  "license": "Commercial",

  "category": "advergame",
  "tags": ["quiz", "trivia", "engagement"],

  "compatibility": {
    "master_jason_version": "^1.0.0",
    "clastop_mega_version": "^2.0.0",
    "frontend": ["react@19"]
  },

  "layers": {
    "schema": "schema/catalog.json",
    "agents": "agents/triggers.yaml",
    "renderer": "renderer/index.ts",
    "triggers": "triggers/plugin.py"
  },

  "capabilities_required": [
    "http:fetch",
    "kv:read",
    "kv:write",
    "event:emit",
    "asset:read"
  ],

  "pricing": {
    "model": "per_render",
    "amount_usd": 0.05,
    "developer_share": 0.7
  },

  "marketplace": {
    "icon_url": "assets/icons/main.svg",
    "screenshots": ["assets/images/screenshot-1.png"],
    "demo_url": "https://demo.clastop.app/advergame-quiz-pepsi"
  },

  "hooks_provided": [],
  "hooks_consumed": ["on_classify_done", "on_writing_done"]
}
```

---

## 🎯 Why 4 Layers?

הצורך:
1. **Schema** — ה-LLM צריך לדעת מה זה Component (catalog)
2. **Agents** — ה-LLM צריך הוראות איך/מתי להשתמש ב-Component (prompts + triggers)
3. **Renderer** — Frontend צריך לדעת איך לצייר אותו (React component)
4. **Triggers** — Backend צריך לדעת מתי לפלוט (hooks)

ב-1 ZIP, 4 שכבות. **Self-contained world**.

---

## 🛠️ Validation

ה-marketplace בודק לפני approval:
1. **Schema validation**: catalog.json passes A2UI v0.9 validator
2. **Renderer audit**: package.json deps don't include known vulns
3. **Capabilities check**: declared capabilities match actual code calls
4. **Sandbox test**: install in isolated container, render demo
5. **Performance budget**: load time < 2s, memory < 50MB

עובר? → published. נכשל? → developer gets specific errors.

---

## ✅ Closure
✅ **Round 28 closed.**
