Log inGet started

plugins

Updated November 24, 2026

What the plugin host loaded, and the one way to call a plugin.

require("@builtin::modules.api.engine.plugins") -- plugins (also available as global 'plugins')

The plugins namespace: 16 functions.

globals/plugins/awaitingPerson

plugins.awaitingPerson(plugin: string) -> boolean

Whether a call to this plugin is waiting on a person to answer the engine's consent dialog.

Parameters

  • plugin string — The plugin asset's library identity, written as a LITERAL.

Returns boolean — True while a dialog for this plugin is unanswered.

if plugins.awaitingPerson(PLUGIN) then print("waiting for you") end

globals/plugins/call

plugins.call(plugin: string, method: string, ...: any?) -> any

Call a method the plugin at plugin exposes.

Parameters

  • plugin string — The plugin asset's identity, written as a LITERAL: the same string asset.identity answers for it (motion for a plugin in this world, @publisher::path.name for one in a library), or its path. A computed identity is refused: runtime code has no dynamic requires and a plugin is no exception, because a name the reference deriver cannot read at authoring time is a dependency that never enters the graph.
  • method string — A method the plugin's plugin.yaml exposes. One it does not is not callable, whatever the component carries.
  • ... any (optional) — The call's arguments: numbers, strings, booleans, nil, buffers and tables of them. A whole number arrives as an integer. One call's arguments hold at most 16,384 values (a table held by several entries counted at each) and 64 MiB of strings and buffers; a call past that, or holding a table inside itself, is refused by name. Bulk data crosses as a buffer.

Returns any — A promise of the plugin's answer, as a value: a table as a table, a number as a number. A refusal raises where it is awaited.

local agents = await(plugins.call("@builtin/plugins/dotbot.plugin", "agents"))

globals/plugins/isLoaded

plugins.isLoaded(plugin: string) -> boolean

Whether the plugin is loaded and answering calls.

Parameters

  • plugin string — The plugin asset's identity, written as a LITERAL.

Returns boolean — True while it is loaded. Never raises: a caller asking is usually waiting for a plugin that is still loading.

while not plugins.isLoaded("motion") do task.wait(0.1) end

globals/plugins/off

plugins.off(plugin: string, id: number) -> boolean

Stop a listener plugins.on started.

Parameters

  • plugin string — The same identity the listener was started with.
  • id number — The id plugins.on answered.

Returns boolean — Whether a listener was removed.

globals/plugins/on

plugins.on(plugin: string, listener: (string, any) -> ()) -> number

Listen to the events a plugin raises.

Parameters

  • plugin string — The plugin asset's library identity, written as a LITERAL.
  • listener (string, any) -> () — function(eventType, payload) — payload is the event's decoded JSON.

Returns number — The subscription id, for plugins.off.

local id = plugins.on("@builtin/plugins/dotbot.plugin", function(kind, body) end)

globals/plugins/openUrl

plugins.openUrl(plugin: string, url: string) -> any

Ask the person to open one of the plugin's own pages.

Parameters

  • plugin string — The plugin asset's library identity, written as a LITERAL.
  • url string — An https URL whose host the plugin declared under network.hosts. Anywhere else is refused — otherwise this would be an unbounded way to put an address in front of somebody.

Returns any — A promise: true when it opened, or the refusal.

await(plugins.openUrl("@builtin/plugins/dotbot.plugin", "https://claude.ai/login"))

globals/plugins/state

plugins.state(plugin: string) -> { state: string, reason: string? }

Where the plugin asset at plugin stands, so a caller can tell a plugin that is still loading from one that failed to load.

Parameters

  • plugin string — The plugin asset's identity, written as a LITERAL.

Returns { state: string, reason: string? } — { state, reason }. state is loaded (answering calls), loading (its component is compiling and starting), failed (its most recent load settled without a plugin), stopped (the plugin stopped on its own) or none (no load of it has started). reason says why for failed and stopped. Never raises.

local s = plugins.state("motion")
if s.state == "failed" then print("motion did not load: " .. s.reason) end

globals/plugins/status

plugins.status() -> { [string]: any }

What the plugin host loaded, and what refused to load.

Returns { [string]: any } — started is whether the host has run; plugins lists each one with loaded, and the error that refused it where there is one. Once the host has run, execution states how plugin code runs: native (compiled to the CPU's own instructions, the desktop build), interpreted (wasmtime's Pulley interpreter, every Android build) or browser (the browser's own WebAssembly engine). On the web build it also carries what the browser offers of JavaScript Promise Integration, which every plugin's host calls are lowered onto.

local report = plugins.status()
print(report.started, #report.plugins)

typed/builtin//modules/api/engine/plugins/plugins/awaitingPerson

plugins.awaitingPerson(plugin: string) -> boolean

Whether a call to this plugin is waiting on a person to answer the engine's consent dialog.

Parameters

  • plugin string — The plugin asset's library identity, written as a LITERAL.

Returns boolean — True while a dialog for this plugin is unanswered.

if plugins.awaitingPerson(PLUGIN) then print("waiting for you") end

typed/builtin//modules/api/engine/plugins/plugins/call

plugins.call(plugin: string, method: string, ...: any?) -> any

Call a method the plugin at plugin exposes.

Parameters

  • plugin string — The plugin asset's identity, written as a LITERAL: the same string asset.identity answers for it (motion for a plugin in this world, @publisher::path.name for one in a library), or its path. A computed identity is refused: runtime code has no dynamic requires and a plugin is no exception, because a name the reference deriver cannot read at authoring time is a dependency that never enters the graph.
  • method string — A method the plugin's plugin.yaml exposes. One it does not is not callable, whatever the component carries.
  • ... any (optional) — The call's arguments: numbers, strings, booleans, nil, buffers and tables of them. A whole number arrives as an integer. One call's arguments hold at most 16,384 values (a table held by several entries counted at each) and 64 MiB of strings and buffers; a call past that, or holding a table inside itself, is refused by name. Bulk data crosses as a buffer.

Returns any — A promise of the plugin's answer, as a value: a table as a table, a number as a number. A refusal raises where it is awaited.

local agents = await(plugins.call("@builtin/plugins/dotbot.plugin", "agents"))

typed/builtin//modules/api/engine/plugins/plugins/isLoaded

plugins.isLoaded(plugin: string) -> boolean

Whether the plugin is loaded and answering calls.

Parameters

  • plugin string — The plugin asset's identity, written as a LITERAL.

Returns boolean — True while it is loaded. Never raises: a caller asking is usually waiting for a plugin that is still loading.

while not plugins.isLoaded("motion") do task.wait(0.1) end

typed/builtin//modules/api/engine/plugins/plugins/off

plugins.off(plugin: string, id: number) -> boolean

Stop a listener plugins.on started.

Parameters

  • plugin string — The same identity the listener was started with.
  • id number — The id plugins.on answered.

Returns boolean — Whether a listener was removed.

typed/builtin//modules/api/engine/plugins/plugins/on

plugins.on(plugin: string, listener: (string, any) -> ()) -> number

Listen to the events a plugin raises.

Parameters

  • plugin string — The plugin asset's library identity, written as a LITERAL.
  • listener (string, any) -> () — function(eventType, payload) — payload is the event's decoded JSON.

Returns number — The subscription id, for plugins.off.

local id = plugins.on("@builtin/plugins/dotbot.plugin", function(kind, body) end)

typed/builtin//modules/api/engine/plugins/plugins/openUrl

plugins.openUrl(plugin: string, url: string) -> any

Ask the person to open one of the plugin's own pages.

Parameters

  • plugin string — The plugin asset's library identity, written as a LITERAL.
  • url string — An https URL whose host the plugin declared under network.hosts. Anywhere else is refused — otherwise this would be an unbounded way to put an address in front of somebody.

Returns any — A promise: true when it opened, or the refusal.

await(plugins.openUrl("@builtin/plugins/dotbot.plugin", "https://claude.ai/login"))

typed/builtin//modules/api/engine/plugins/plugins/state

plugins.state(plugin: string) -> { state: string, reason: string? }

Where the plugin asset at plugin stands, so a caller can tell a plugin that is still loading from one that failed to load.

Parameters

  • plugin string — The plugin asset's identity, written as a LITERAL.

Returns { state: string, reason: string? } — { state, reason }. state is loaded (answering calls), loading (its component is compiling and starting), failed (its most recent load settled without a plugin), stopped (the plugin stopped on its own) or none (no load of it has started). reason says why for failed and stopped. Never raises.

local s = plugins.state("motion")
if s.state == "failed" then print("motion did not load: " .. s.reason) end

typed/builtin//modules/api/engine/plugins/plugins/status

plugins.status() -> { [string]: any }

What the plugin host loaded, and what refused to load.

Returns { [string]: any } — started is whether the host has run; plugins lists each one with loaded, and the error that refused it where there is one. Once the host has run, execution states how plugin code runs: native (compiled to the CPU's own instructions, the desktop build), interpreted (wasmtime's Pulley interpreter, every Android build) or browser (the browser's own WebAssembly engine). On the web build it also carries what the browser offers of JavaScript Promise Integration, which every plugin's host calls are lowered onto.

local report = plugins.status()
print(report.started, #report.plugins)
  • api
  • reference