Skip to main content

setup_host_api

Function setup_host_api 

Source
pub fn setup_host_api(runtime: &LuaRuntime) -> Result<(), LuaError>
Expand description

Set up the imp global table with host API functions.

Exposes to Lua:

  • imp.on(event, handler) — subscribe to hook events
  • imp.register_tool(def) — register a custom tool
  • imp.exec(command, args, opts) — run a shell command
  • imp.register_command(name, def) — register a slash command
  • imp.events.on() / imp.events.emit() — inter-extension event bus
  • imp.tool(name, params) — call a native imp tool
  • imp.ui.request(spec) — ask the active UI for confirm/select/input/custom
  • imp.ui.confirm(title, message) — ergonomic yes/no helper
  • imp.secret(provider, field?) — read a saved imp secret field
  • imp.secret_fields(provider) — read all saved fields for a provider
  • imp.env(name) — read an env var (scoped by allowed list)
  • imp.http.get(url, headers?) — HTTP GET
  • imp.http.post(url, body, headers?) — HTTP POST