Skip to content
Download

Build a plugin ​

A plugin is a separate program. QueryLane starts the command from the plugin's plugin.json and talks JSON-RPC 2.0 to it over stdin and stdout, one JSON message per line. You can write it in any language. The official plugins and the tools that build, sign and publish them live in the querylane-plugins repository.

QueryLane installs only packages signed with the official QueryLane key. You can build and test a package signed with another key, but the app refuses to install it.

Set up the repository ​

  • Node 24, then npm install.
  • A checkout of the QueryLane app at ../dataflow3/roadmap, or QUERYLANE_APP_DIR pointing at it. Tests run plugins through the app's own plugin host.
  • For npm run build, an Ed25519 private key in PEM at ~/.querylane/plugin-signing/querylane-official.pem, or its path in QUERYLANE_PLUGIN_SIGNING_KEY.

Create the plugin ​

  1. Create plugins/<name>/ with plugin.json and your code, and optionally an icon and a guide for the AI assistant.
  2. Add the folder to PLUGIN_SOURCES in tools/lib/config.mjs with its platforms, for example { dir: 'plugins/hello', platforms: ['darwin-aarch64'] }. The manifest test fails for a folder that is not listed.
  3. Give every plugin English and Russian texts with the same keys; the manifest test checks it.

plugin.json ​

FieldMeaning
schemaVersion, apiVersionBoth 1
idLowercase dotted id, such as com.example.hello
version, minAppVersion1.2.3; the oldest QueryLane version the plugin needs
author{ "name": "…", "url": "…" }
iconSquare SVG or PNG in the package, up to 128 KiB
permissionsAny of network, download, spawnProcesses, userFiles
platformsKeys such as darwin-aarch64, each with command, optional setup commands and env
contributes.stepsid, language of the step code, starterCode, template: true to substitute ${...} values before the plugin gets the code, and inputs: "dependencies" to get only the results of the steps it depends on or references instead of every earlier step
contributes.settingskey, type, default, group, scope and more
contributes.toolsname, description, inputSchema (JSON Schema)
contributes.runEvents["finished"] to receive run notifications
contributes.guideMarkdown file with instructions for writing step code
contributes.connectorsDatabases the plugin adds to Create connection, see Database connectors
locales, defaultLocaleTexts per language, and the fallback language

Commands and env values can use ${pluginDir} (the unpacked package), ${dataDir} (a folder that survives updates) and ${node} (the Node.js that QueryLane runs). setup commands run once before the first start and after updates. They and the prepare call get HTTPS_PROXY, HTTP_PROXY, NO_PROXY and NODE_USE_ENV_PROXY=1 when the user downloads through a proxy, so Node's fetch, uv, pip and Playwright download through it.

Setting types are string, number, boolean, enum, stringList, secret and proxyProfile. scope is plugin (default), step or notification.

Each locale needs name and description, plus flat keys: steps.<id>.title, settings.<key>.label, settings.<key>.description, settings.<key>.options.<option>, groups.<group> and errors.<reasonCode>.

Protocol ​

QueryLane sends these requests:

MethodAnswer
initialize{ "apiVersion": 1 }
prepareRuns once after install and update, for example to download a browser
step/run{ "summary": {...}, "rows": [...] } for code, settings, inputs, variables, timeoutMs, artifactsDir and more
tool/call, tool/close{ "data": ..., "images": [...] } for a tool call; tool/close ends a tool session
run/finishedReports a full run of a job that lists the plugin in its notifications
shutdownSent before QueryLane stops the plugin

While it handles a request, the plugin can send the notifications rows, progress and artifact (kind is screenshot, html or file) with requestId set to the request id. step/cancel arrives as a notification with the runId to stop.

Report failures as JSON-RPC errors with data.reasonCode. QueryLane shows the plugin's errors.<reasonCode> text. Keep stdout for protocol messages and write logs to stderr. Exit when stdin closes.

Database connectors ​

A connector adds a database type. QueryLane shows its form in Create connection, keeps its connections with the others and calls the plugin with db/* requests for everything the connection does. The JDBC databases plugin is a full example; the app checkout has a small one on node:sqlite in fixtures/plugins/sqlconnector.

FieldMeaning
idConnector id, unique across QueryLane, such as jdbc-oracle
typeAdapter type shared by the connectors of the plugin, such as jdbc; never a built-in type such as postgresql
variant, family, dialectVariant stored with each connection (the id by default), engine family, and the SQL dialect the formatter and completions use
category, icon, keywords, defaultPortGroup in Create connection (enterprise, cloud, analytics, embedded, other and the built-in groups), an icon in the package, search words and the default port
fieldsForm fields: key, type (string, integer, boolean, enum, secret, path, text), required, default, options, group and link
scopedatabase and schema: whether a connection chooses a catalog and a schema
networkssh and ssl: whether the form has the SSH and SSL/TLS tabs
sqlHow SQL text looks: identifierQuote, parameterStyle (question, dollar or atP), backslashEscapes, rowLimit (limit, top or fetchFirst), explainTemplate with {query}, and types of new table columns by value kind
operationsThe db/* methods the plugin serves: test, loginRights, execute, fetch, explorer, details, schema, privileges, transaction, cancel, exportRows. execute or fetch is required
rowActions, objectActions, objectActionPreviewsRow edits such as insert, update, delete and bulkInsert, and object actions such as createTable, drop and renameObject
capabilitiesCorrections of what the operations imply, such as "query": { "readOnlySession": true } when the plugin keeps the sessions of read-only agents read-only

Fields with a group go to the Advanced tab. A required boolean must be turned on, which suits a driver license, and link adds an https link next to the field. Secret fields other than password are stored under connection.secrets in the vault.

Connector texts are flat keys in the locales: connectors.<id>.label, connectors.<id>.description, and connectors.<id>.fields.<key>.label, .placeholder, .description, .linkLabel and .options.<value>. A field without a label takes QueryLane's own label when its key is host, port, database, username or password.

Every db/* request has connector, the connector id, and config with connection (the form values, password and secrets included), scope (the chosen catalog and schema), agentReadOnly and downloadProxy (url and noProxy of the proxy for downloads such as drivers, or null). With an SSH tunnel, host and port already point at the tunnel.

MethodAnswer
db/test{ "version": "…" }, shown after Test
db/loginRights{ "rights": "readOnly" }, "readWrite" or "unknown"
db/executeFor query, operationId and options (params, limit, timeoutMs, readOnly, multipleStatements): { "columns": [...], "rows": [...], "rowCount": 1, "affectedRows": 0 }
db/cursorNext, db/cursorCloseThe next page of rows for cursor; closes it when the reader stops
db/transactionRuns statements in one transaction and answers like db/execute
db/fetchA page of the table view for request (table, limit, skip, sort, filters with where and params): { "documents": [...], "totalRecords": 120 }
db/explorer{ "nodes": [...] } under parent, null for the root, each with key, label, kind, lazy and objectRef
db/details{ "kind", "name", "ddl", "metadata": { "columns", "indexes", "constraints" } } for object
db/schema{ "entities": [...] } for the assistant and completions
db/privileges{ "deniedCapabilities": [...] } the login lacks
db/exportRowsRows of request for an export, in pages like db/execute
db/rowAction, db/objectAction, db/objectActionPreviewThe result of action for request, such as { "affectedRows": 1 }; a preview answers { "commandPreview": "…" }

When there are more rows than one answer should carry, answer with "done": false and a cursor. QueryLane then asks db/cursorNext for the next pages, and the last page has "done": true. db/cancel arrives as a notification with the operationId of a running statement or export.

For a database error, set data.details.sqlState to the SQLSTATE and put the driver message in message. QueryLane turns the SQLSTATE into the same reasons as its built-in drivers, such as DB_OBJECT_NOT_FOUND, and shows the message as details.

Minimal example ​

plugins/hello/plugin.json:

json
{
  "schemaVersion": 1,
  "id": "com.example.hello",
  "version": "1.0.0",
  "apiVersion": 1,
  "author": { "name": "Example" },
  "permissions": [],
  "platforms": {
    "darwin-aarch64": { "command": ["${node}", "${pluginDir}/main.mjs"] }
  },
  "contributes": {
    "steps": [{ "id": "greet", "language": "plaintext", "template": true, "starterCode": "Hello, ${name}" }]
  },
  "locales": {
    "en": { "name": "Hello", "description": "Returns a greeting as a row", "steps.greet.title": "Greeting" },
    "ru": { "name": "Привет", "description": "Возвращает приветствие строкой", "steps.greet.title": "Приветствие" }
  }
}

plugins/hello/main.mjs:

js
import readline from 'node:readline';

const send = message => process.stdout.write(`${JSON.stringify({ jsonrpc: '2.0', ...message })}\n`);

readline.createInterface({ input: process.stdin }).on('line', (line) => {
  const { id, method, params = {} } = JSON.parse(line);
  if (id === undefined)
    return;
  if (method === 'initialize')
    send({ id, result: { apiVersion: 1 } });
  else if (method === 'step/run')
    send({ id, result: { rows: [{ greeting: params.code.trim() }] } });
  else if (method === 'prepare' || method === 'shutdown')
    send({ id, result: {} });
  else
    send({ id, error: { code: -32601, message: `unknown method ${method}`, data: { reasonCode: 'HELLO_METHOD_UNKNOWN' } } });
});

Build and test ​

  • npm run build packs every listed plugin into dist/<id>-<version>-<platform>.qlplugin, a gzip tar with plugin.json at its root, signs it and writes dist/catalog.json. Without the official key it warns that the app will refuse the packages.
  • npm run check runs the linters, the manifest check against the app's validator, and the package and plugin tests.

To try the plugin end to end, write a test in tests/ like the existing ones: build the package with a throwaway Ed25519 key, install it into a scratch folder with the app's installPluginPackage and that key in trustedKeys, then call preparePlugin and runPluginStep from the app's plugins/host.ts.

With a development checkout of the app, its npm run dev offers the packages from dist/catalog.json in Marketplace. They still need the official signature.

Other runtimes ​

  • Bun: a package.json with querylanePlugin.bun (version, entry, binary) is compiled into one executable, so users install nothing. The build needs Bun at that version.
  • Python: bundleUv: true in PLUGIN_SOURCES adds bin/uv to the package, and setup commands use it to install Python and dependencies into ${dataDir}, as the Browser plugin does.
  • Java: querylanePlugin.java (sources, release, mainClass, jar) compiles the sources into one jar with the JDK's javac, without a build tool. A setup command can download a Java runtime into ${dataDir}, as the JDBC databases plugin does.
  • Rust: querylanePlugin.rust (crate, binary, crateBinary) builds a crate for every platform of the plugin on the Mac, Windows builds with cargo-xwin. exclude keeps the sources out of the package.