How 1BZ Bots Define Features via Manifest
<div class="post-category"><span class="cat-badge cat-handles">Handles</span></div>
<p class="lead"><strong>1BZ bots used to hand-wire every capability as a Python `CommandHandler`. That put even a trivial command one code change and a redeploy away from production. The Feature Manifest Framework replaces that with a declarative YAML file at `bot/features.yaml` — one entry per feature, loaded at startup, synced into PostgreSQL, and auto-registered as both a slash command and a network handle. Every 1BZ bot now reads the same format, which means the same feature can ship across admin and customer bots with zero code duplication.</strong></p>
<h2>Manifest schema</h2>
<p>Each entry has a stable `name`, a human `description`, a `tier_required` gate (basic/pro/admin), a `slash` block (enabled, command, help_args), a `handle` block (enabled, public, dzit_cost, fields), and a `handler` block that says how to execute.</p>
<ul><li>name: invoice</li><li>- { name: customer, type: string, required: true }</li><li>- { name: amount, type: float, required: true }</li></ul>
<h2>Handler types</h2>
<ul><li>template — zero-code `{field}` substitution into a string.</li><li>llm — Ollama prompt template; fields interpolated into the prompt and the model's reply is the output.</li><li>python — dotted-path import of a Python function that receives the validated fields.</li><li>webhook — POST the payload to an external URL and return the response.</li></ul>
<h2>Startup lifecycle</h2>
<p>On bot boot the framework loads `bot/features.yaml`, validates each entry against the schema, then syncs the set into the `bot_features` table in PostgreSQL so the dashboard and wizard can read it. For every enabled slash block it registers a Telegram CommandHandler pointing at the generic dispatcher; for every enabled handle block it registers the handle with `services/handle_registry.py` so it appears in `handles.php` and accepts cross-node calls. Tier gating is enforced by the dispatcher before the handler runs, so a `tier_required: pro` feature silently no-ops on a basic bot.</p>
<p>Every 1BZ bot — admin and customer — uses the same framework.</p>
<h2>Related</h2>
<ul><li>[Slash Command vs Handle — what each is for](/post.php?slug=slash-vs-handle)</li><li>[Add a Command to Your Bot in 10 Lines of YAML](/post.php?slug=adding-a-command)</li><li>[Handle System & CA Verification](/post.php?slug=handle-system)</li></ul>
Powered by BizNode™