跳到內容

Examples

本頁內容尚未翻譯。

The repository keeps small, working plugins in examples/. Each has a test next to it that runs it without Discord or PostgreSQL, except migrations.ts, whose test needs a database. The plugin guide embeds each file, and the repository’s test suite fails when a block in the guide differs from its file.

File What it shows
tools.ts A tool agents can call, with a minimum tier and a refusal the model can correct
holds.ts A tool’s hold, and a hold rule that sees every tool call, so a call waits for the owner’s approval
prompt.ts A prompt section added after the core’s prompt in every agent turn
seeds.ts An agent created on the first start, never overwritten afterwards
events.ts Handlers for turn start, turn end, team change, and shutdown
services.ts A long-lived timer service with start, stop, and busy
shared-services.ts A service one plugin provides and others read with get, find and lazy, and a plugin that replaces it
migrations.ts Tables of the plugin’s own, created by an idempotent migration
providers.ts A plugin that fills the images provider slot
echo-runtime.ts A replacement for the Pi runtime, filling the runtime slot
preflight.ts A check that refuses to start when a setting is empty
interactions.ts A slash subcommand added with commands.add
http.ts A route on the public listener
dashboard.ts Extra lines on the dashboard message
selection.ts Tools every agent carries besides its own
packages.ts A Pi package whose extensions every session loads
session-tools.ts The raw Pi extension form of a tool
channels.ts A channel claim that owns conversations in some channels
study-room.ts A conversation kind of its own: a persona, a claim, and context.turns
support-desk.ts A background target that sets what may be scheduled or delegated
fake-surface.ts A chat surface for an in-memory chat, and the plugin that contributes it

To see what each part is for, start with What plugins can add. To run tests like the ones beside these files, see Test a plugin.