|
| 1 | +# plugin.yaml Specification |
| 2 | + |
| 3 | +Every Flyto2 plugin must include a `plugin.yaml` at the package root. |
| 4 | + |
| 5 | +## Naming Convention |
| 6 | + |
| 7 | +A plugin has two identifiers: |
| 8 | + |
| 9 | +| Identifier | Where | Example | Purpose | |
| 10 | +|---|---|---|---| |
| 11 | +| **npm package name** | `package.json` `"name"` | `@flyto/plugin-slack` | npm install/publish | |
| 12 | +| **plugin runtime ID** | `plugin.yaml` `id` | `flyto-community/slack` | Runtime dispatch, module registry | |
| 13 | + |
| 14 | +- npm name uses `@flyto/plugin-*` scope for official plugins |
| 15 | +- Runtime ID uses `vendor/name` format (e.g., `flyto-community/slack`, `acme-corp/custom-tool`) |
| 16 | +- The module registry key becomes `plugin.{runtime_id}/{step_id}` |
| 17 | + |
| 18 | +## Schema |
| 19 | + |
| 20 | +```yaml |
| 21 | +# ── Plugin identity ────────────────────────────────────── |
| 22 | +id: string # Runtime ID — "vendor/name" format (e.g., "flyto-community/slack") |
| 23 | +name: string # Display name |
| 24 | +version: string # SemVer |
| 25 | +description: string # One-line description |
| 26 | + |
| 27 | +# ── Runtime ────────────────────────────────────────────── |
| 28 | +runtime: |
| 29 | + language: node # "node" (future: "deno", "bun") |
| 30 | + entry_point: dist/index.js # Compiled entry |
| 31 | + min_flyto_version: "2.25.0" # Minimum flyto-core version |
| 32 | + |
| 33 | +# ── Steps ──────────────────────────────────────────────── |
| 34 | +steps: |
| 35 | + - id: string # Step identifier |
| 36 | + label: string # Display label |
| 37 | + description: string # What this step does |
| 38 | + category: string # Category for grouping |
| 39 | + icon: string # Icon name (Lucide icons) |
| 40 | + color: string # Hex color for the node |
| 41 | + |
| 42 | + # Connection rules |
| 43 | + can_receive_from: ["*"] # Which step types can connect to this |
| 44 | + can_connect_to: ["*"] # Which step types this can connect to |
| 45 | + |
| 46 | + # Input parameters |
| 47 | + params_schema: |
| 48 | + param_name: |
| 49 | + type: string | number | boolean | array | object |
| 50 | + label: string |
| 51 | + description: string |
| 52 | + required: boolean # default: false |
| 53 | + default: any # default value |
| 54 | + placeholder: string # input placeholder |
| 55 | + options: # for select/enum types |
| 56 | + - value: string |
| 57 | + label: string |
| 58 | + |
| 59 | + # Output schema |
| 60 | + output_schema: |
| 61 | + field_name: |
| 62 | + type: string | number | boolean | array | object |
| 63 | + description: string |
| 64 | + |
| 65 | + # ── UI Configuration (optional) ────────────────────── |
| 66 | + # When present, this step opens an interactive UI page |
| 67 | + # instead of running headlessly. |
| 68 | + ui: |
| 69 | + type: page | panel | dialog # How the UI is displayed |
| 70 | + # page — full-screen overlay |
| 71 | + # panel — side panel (default 400px) |
| 72 | + # dialog — centered modal |
| 73 | + page: string # Path to UI directory (relative to plugin root) |
| 74 | + # Must contain index.html |
| 75 | + width: number # Default width in pixels (optional) |
| 76 | + height: number # Default height in pixels (optional) |
| 77 | + timeout_ms: number # Max wait time in ms (default: 300000) |
| 78 | + |
| 79 | +# ── Secrets ────────────────────────────────────────────── |
| 80 | +required_secrets: # List of secret names the plugin needs |
| 81 | + - SECRET_NAME |
| 82 | +``` |
| 83 | +
|
| 84 | +## UI Step Lifecycle |
| 85 | +
|
| 86 | +``` |
| 87 | +flyto-core Plugin SDK Plugin UI (iframe) |
| 88 | + │ │ │ |
| 89 | + ├── invoke(step) ──────────>│ │ |
| 90 | + │ ├── start HTTP server │ |
| 91 | + │ ├── ui.open {url} ──────────> │ |
| 92 | + │ │ ├── render UI |
| 93 | + │ │ ├── user interacts |
| 94 | + │ │ <── POST /callback ───────┤ flyto.submit(data) |
| 95 | + │ ├── ui.close ────────────────>│ |
| 96 | + │ <── result ─────────────┤ │ |
| 97 | + │ │ │ |
| 98 | +``` |
| 99 | + |
| 100 | +## Example: UI Step in plugin.yaml |
| 101 | + |
| 102 | +```yaml |
| 103 | +steps: |
| 104 | + - id: crop_image |
| 105 | + label: Crop Image |
| 106 | + description: Interactive image cropping tool |
| 107 | + category: media |
| 108 | + icon: Crop |
| 109 | + color: "#10B981" |
| 110 | + params_schema: |
| 111 | + image_url: |
| 112 | + type: string |
| 113 | + label: Image URL |
| 114 | + required: true |
| 115 | + aspect_ratio: |
| 116 | + type: string |
| 117 | + label: Aspect Ratio |
| 118 | + options: |
| 119 | + - { value: "free", label: "Free" } |
| 120 | + - { value: "1:1", label: "Square" } |
| 121 | + - { value: "16:9", label: "Widescreen" } |
| 122 | + - { value: "4:3", label: "Standard" } |
| 123 | + output_schema: |
| 124 | + cropped_data_url: |
| 125 | + type: string |
| 126 | + description: Base64 data URL of the cropped image |
| 127 | + crop_rect: |
| 128 | + type: object |
| 129 | + description: "{ x, y, width, height } of the crop area" |
| 130 | + ui: |
| 131 | + type: dialog |
| 132 | + page: ui/dist |
| 133 | + width: 900 |
| 134 | + height: 650 |
| 135 | +``` |
0 commit comments