PML 2 Plugin Development Guide

Plugin Event Triggers

This document describes every trigger available in the PML 2 plugin system.

1. Plugin Event Triggers

Plugins subscribe to the events below through triggers.on in YAML. The data carried by an event can be referenced in action parameters through the template {{ctx.data.fieldName}}.

Event overview

EventFired whenFired fromPayloadExecution
app.startupThe main window has initialised and the application startsMainWindow.axaml.csversion, osawait
app.exitThe application exits (before logs are released)App.axaml.csversion, osawait
app.update.availableA new version is detectedMainWindow.axaml.cscurrentVersion, latestVersionfire-and-forget
user.loginA user signs in successfullyLoginPage.axaml.csusername, groupfire-and-forget
user.logoutAfter the user confirms sign-out, before the app restartsUserCenterPage.axaml.csusernameawait
proxy.startA tunnel starts (a terminal tab running the mefrpc command is created)TerminalPage.axaml.csproxyName, commandfire-and-forget
proxy.stopA terminal tab is closed (paired with proxy.start)TerminalPage.axaml.csproxyNamefire-and-forget
page.navigateThe main page changesMainPageFrameViewModel.cspagefire-and-forget
plugin.installA plugin file is installed successfullyPluginService.csfilefire-and-forget
plugin.uninstallA plugin is uninstalled successfullyPluginService.cspluginId, pluginNamefire-and-forget
plugin.enableA plugin is enabledPluginService.cspluginIdfire-and-forget
plugin.disableA plugin is disabledPluginService.cspluginIdfire-and-forget

Event details

app.startup / app.exit

Application lifecycle events. app.startup fires after the main window has loaded and the privacy policy check has completed; app.exit fires before the process exits and waits for plugin actions to finish before releasing log resources.

FieldDescriptionExample
versionApplication version26.2.0
osOperating system platformWin32NT / Unix

app.update.available

Fired the first time a new version is detected after startup (only once per run).

FieldDescription
currentVersionThe current version
latestVersionThe newest version detected

user.login / user.logout

FieldDescription
usernameThe user name that signed in/out
groupThe user group (only for user.login)

The application restarts immediately after user.logout, so it is dispatched with await to make sure plugin actions (such as notifications and reporting) complete.

proxy.start / proxy.stop

FieldDescription
proxyNameTunnel / terminal tab name
commandThe launch command (only for proxy.start)

Values of the page field: Home, CreateProxy, ManageProxy, NodesMonitoring, UserCenter, Settings, About, Terminal, Update, Theme, Plugin

plugin.install / plugin.uninstall / plugin.enable / plugin.disable

Plugin self-management events. Note that plugins may subscribe to these events to build chains, but a plugin that subscribes to plugin.uninstall will not receive any further events once it has been uninstalled.

2. Writing a Plugin YAML

Plugin files live in Config/Plugins/*.yaml and support hot reload (a changed file is reloaded automatically within 1 second).

id: my-plugin
name: Example Plugin
description: Sends a notification when a tunnel starts
author: Your Name
version: "1.0"

triggers:
  - on: proxy.start                          # Event name to subscribe to
    condition: "ctx.data.proxyName != ''"    # Optional, a condition expression
    actions:
      - name: notify
        params:
          msg: "Tunnel {{ctx.data.proxyName}} has started"

functions:
  my_func:                                   # A reusable function, invoked with call_function
    - name: log
      params:
        msg: "hello"

Built-in actions

ActionParametersDescription
logmsgWrites a log entry (console + application log file, module "Plugin")
notifymsgSends a system notification (titled pluginId | PML 2)
http_requesturl, method (default GET), bodyPerforms an HTTP request; the response body is stored in ctx.variables.http_response
python_runscript, inputRuns a Python script (requires python3 on PATH); the returned JSON is merged into the variables
call_functionfunc, argsCalls a function defined under functions
conditionalcondition, if_trueRuns a group of actions conditionally

Template variables

{{...}} inside parameters is replaced before execution:

  • {{ctx.data.xxx}} —— data carried by the event
  • {{ctx.variables.xxx}} —— variables produced during execution (such as http_response)
Copyright © RYCBStudio 2026, All Rights Reserved.