Skip to main content
This page lists the contract between Kaneo and a plugin, as provided by @kaneo/plugin-sdk. For a walkthrough, see Writing plugins.

Package fields

Entries must point to files inside the package, starting with ./. Without kaneo.id, the ID is the package name in lowercase, without the leading @, with each run of characters other than a-z and 0-9 replaced by -, trimmed of leading and trailing -, and cut to 64 characters. For example, @acme/kaneo-reports becomes acme-kaneo-reports. Kaneo serves the folder that holds the ./web entry, including its subfolders, at /api/plugins/<id>/assets/ without authentication. That folder must not contain the ./server or . entry, so keep the web entry in a folder of its own, such as dist/web/. Kaneo refuses to load a plugin whose web folder contains server code.

definePlugin

Pass import.meta.url as url. The schema’s input type types the factory argument, and its output type types kaneo.options. The factory argument is optional when the schema accepts undefined or an empty object. PluginOptions<typeof factory> gives the validated options type.

Server

defineServer

Pass the factory from your src/index.ts to type kaneo.options. setup runs once at startup. If it throws or rejects, the plugin fails at the start stage and Kaneo does not start.

Server context

plugin

{ id, version }: the plugin ID and the installed package version.

options

The operator’s options from kaneo.config.ts, after validation by your schema. Typed by the schema’s output, so defaults are applied.

log

log.info(...args), log.warn(...args), log.error(...args). Writes to Kaneo’s log with the plugin ID as a prefix. Do not log secrets or private workspace content.

routes

A Hono app mounted at /api/plugins/<id>. A route registered as /tasks/:taskId/progress answers at /api/plugins/<id>/tasks/:taskId/progress. Every request goes through Kaneo’s session or API key authentication first. In a handler:
  • c.get("userId") is the signed-in user.
  • c.get("workspaceId") is set by a guard to the workspace that owns the checked resource.
The first path segments assets, data, workspace, and webhooks are reserved for Kaneo.

webhooks

A Hono app mounted at /api/plugins/<id>/webhooks. Requests are not authenticated and carry no user or workspace. Verify the sender yourself, and check enabledWorkspaces() before acting on a workspace.

guard

Hono middleware for routes. Each guard reads an ID from a route parameter, resolves the workspace that owns it, and checks that:
  1. The signed-in user can access that workspace.
  2. The user has every permission in permissions, if given.
  3. The plugin is on in that workspace. If not, the guard responds with 404.
Then it sets c.get("workspaceId"). For a nested task route such as /projects/:projectId/tasks/:taskId, pass { projectParam: "projectId" } as the third argument to guard.task. The guard returns 404 if the task belongs to a different project. permissions maps a resource to the actions the user needs, for example { task: ["update"] } or { project: ["read"], label: ["create"] }: These are the same permissions that workspace roles grant.

on

on(event, handler) registers a handler for one of the events. Handlers receive events from workspaces where the plugin is on, with an exception for retained storage on project.moved. An error in a handler is logged against the plugin and does not affect Kaneo or other plugins.

storage

storage(workspaceId) returns a JSON key/value store for this plugin in one workspace. Other workspaces and other plugins cannot see its keys. Storage is kept when the plugin is turned off or removed from the config, and deleted with the workspace. Storage stays with the workspace when a project moves, so plugins that store project data should handle project.moved and move it to the new workspace.

settings

settings(workspaceId) resolves to that workspace’s settings, typed from your settings fields. Defaults are applied, secret values are included, and stored values that no longer pass validation fall back to the default.

enabledWorkspaces

enabledWorkspaces() resolves to the IDs of the workspaces where the plugin is on. Use it in scheduled jobs and webhooks.

schedule

schedule(name, cron, run) runs run on a cron schedule, such as "0 * * * *" for the start of every hour. name identifies the job within your plugin. Cron schedules use UTC. Kaneo attempts each occurrence at most once across API instances. A failure or interruption leaves that occurrence claimed. Later occurrences can run once the lease is free. Jobs are not tied to a workspace.

Events

PLUGIN_EVENT_NAMES lists every event. Each event has a type field with its name, plus these fields: Events are delivered to workspaces that turned the plugin on. project.moved is also delivered if the plugin has retained storage in the source workspace. A plugin receives the move once, even if it qualifies in both workspaces. Events report changes that already happened and cannot change or block them. The catalog is mapped from Kaneo’s internal events, so it stays stable when Kaneo’s internals change.

Settings fields

Every field has a type, a label, and an optional description. options is an array of { value, label }. multiline renders a text area. step only sets the input’s increment.

How values are typed

  • boolean is always present. It defaults to false.
  • multiselect is always present. It defaults to [].
  • Other fields are always present when they have a default or required: true. Otherwise their type includes undefined.
  • select and multiselect values are typed as the literal option values when settings are declared inline in defineServer.

How values are validated

When a workspace admin saves the form, or a client calls the update endpoint: A required field without a default must have a value. Keys that are not declared fields are dropped.

Secrets

  • Secret values are never sent to the browser. usePlugin().settings omits secret fields, and the settings form only shows whether a secret is set.
  • When saving, omit a secret to keep the stored value, or send null to clear it.
  • Secret fields have no default.

Web

defineWeb

Contributions only appear in workspaces where the plugin is on. Each one renders inside its own error boundary and suspense boundary, so a failing plugin only breaks its own slot.

Extension points

id must be unique within its list. icon is any React component that accepts className.

Project views

A project view is a layout like Board, List, and Calendar. It appears in the layout switch of the project’s Display menu, and Kaneo renders its search, filters, task count, and active filters above it, as it does for its own layouts. Kaneo remembers the layout each person picked last, so Tasks returns to it while the plugin is on in the workspace and falls back to Board otherwise. Inside the view and its display component, useProjectView() returns: Both lists use the task fields below and keep the board’s order, with planned tasks last.

Component props

The prop types are exported as ProjectViewProps, TaskPanelProps, WorkspacePageProps, and SettingsPanelProps. A command’s run(context) may be async and receives:

Hooks

All hooks come from @kaneo/plugin-sdk/web and only work inside Kaneo’s web app. The API clients have get<T>(path), delete<T>(path), post<T>(path, body?), put<T>(path, body?), and patch<T>(path, body?). Each returns a promise for the response body. Bodies are sent as JSON. useTask, useTasks, and useProjectView return tasks with these fields:

Shared modules

Kaneo provides these modules to every web entry. The build does not bundle them, so plugins use Kaneo’s instances:
  • react, react/jsx-runtime, and react/jsx-dev-runtime
  • react-dom
  • @tanstack/react-query
Plugins share Kaneo’s React tree and query cache. Prefix query keys with your plugin ID.

UI components

All components come from @kaneo/plugin-sdk/ui and render Kaneo’s own implementation.

Theme tokens

@kaneo/plugin-sdk/theme.css maps Tailwind’s theme to Kaneo’s CSS variables. In plain CSS, use the variables directly, for example var(--muted-foreground). The variables change with Kaneo’s light and dark theme. Tailwind’s dark: variant applies inside Kaneo’s .dark theme.

Build output

kaneo-plugin build writes: All dependencies are bundled except the shared modules. Install scripts and native modules are not supported. dist/web/ holds only web code, because Kaneo serves it publicly. If you use your own build, keep web code in a folder of its own, as described in Package fields. The build fails when your CSS defines class names that Kaneo’s own Tailwind classes also use, such as .hidden or .md\:flex. Give Tailwind a prefix, for example @import "tailwindcss/theme.css" layer(theme) prefix(taskprogress);, or use namespaced class names.

REST endpoints

Kaneo’s API exposes two endpoints for managing plugins in a workspace. They accept a session or an API key. The endpoint reference in the Developers tab lists their exact request and response fields.

List plugins for a workspace

GET /api/plugins?workspaceId={workspaceId} Returns the plugins installed on the instance, with each one’s enabled state, settings fields, and current settings in that workspace. Secret values are never returned; the response only says which secret fields are set.

Update a plugin in a workspace

PUT /api/plugins/{pluginId}/workspace/{workspaceId} Turns the plugin on or off in the workspace and saves its settings. Requires the workspace manage_settings permission. Both body fields are optional. Settings are validated as described in How values are validated. Omit a secret to keep it, or send null to clear it. A plugin with required settings can only be turned on once they are filled in.
The response is the workspace state: { "enabled": true, "settings": { ... }, "configuredSecrets": [] }. Invalid settings return 400 with { "message": "...", "errors": { "<field>": "<reason>" } }.

Paths under a plugin