agent-zero/plugins/_commands
frdel bebe6826cf
Some checks are pending
Build And Publish Docker Images / plan (push) Waiting to run
Build And Publish Docker Images / build (push) Blocked by required conditions
Improve WebUI bundling, manifest and stop command
Introduce a WebUI extension manifest and rewrite the asset bundler/server to support caller-supplied entry sets, extension-injected entries, and negotiated gzip. Key changes: add get_webui_extension_manifest() to helpers/extension, refactor Stop logic into stop_context() and reuse it from the connector `/stop` command, and add a new `/rename` slash command for chat naming. ui_bundler now accepts entry_urls, includes enabled extension entry files, raises the embedded text file size limit to 512 KiB, computes per-entry-set cache keys, and returns a bundle version based on the bundle signature. ui_server applies Starlette GZip middleware, adds routes (/, /index.html, /ui/index, /safe), serves splash/safe documents, injects the serialized webui_extension_manifest into the rendered index, and streamlines the /ui/asset-bundle endpoint with ETag and gzip handling. Also add multiple WebUI assets and fonts, new/updated plugin command YAML and Python command handlers, and corresponding tests covering bundling, commands, chat naming, and WebUI behaviors. Documentation (.dox.md) updated to reflect the new runtime contracts and guidance.
2026-07-29 19:49:07 +02:00
..
api Improve built-in command management 2026-07-10 17:50:33 +02:00
commands Improve WebUI bundling, manifest and stop command 2026-07-29 19:49:07 +02:00
extensions Keep goals active and resolve trailing slash commands 2026-07-16 18:14:13 +02:00
helpers Keep goals active and resolve trailing slash commands 2026-07-16 18:14:13 +02:00
skills/commands-create-slash-command Add built-in slash commands plugin 2026-07-09 16:00:30 +02:00
tests Improve WebUI bundling, manifest and stop command 2026-07-29 19:49:07 +02:00
webui Remove Launcher Host access controls from Core 2026-07-17 15:59:30 +02:00
__init__.py Add built-in slash commands plugin 2026-07-09 16:00:30 +02:00
AGENTS.md Improve WebUI bundling, manifest and stop command 2026-07-29 19:49:07 +02:00
LICENSE Add built-in slash commands plugin 2026-07-09 16:00:30 +02:00
plugin.yaml Add built-in slash commands plugin 2026-07-09 16:00:30 +02:00
README.md Improve WebUI bundling, manifest and stop command 2026-07-29 19:49:07 +02:00

Commands

YAML-configured slash commands for Agent Zero.

This plugin lets you define reusable /commands as .command.yaml files with either:

  • a .txt template body
  • a .py script hook

Commands are managed from the plugin modal and can be inserted directly from the chat composer with prefix syntax (/goal objective) or an exact trailing command (objective /goal).

Features

  • .command.yaml config files with command metadata
  • Text template commands with {} placeholders and parsed args
  • Python hook commands with parsed args and optional chat history payload
  • Unified parser for positional args, free-form tail, and flags
  • Prefix and postfix command resolution for WebUI and remote/AI-sent messages
  • Scope-aware command resolution across project and global scopes
  • Built-in A0 CLI connector command pack for common session, queue, model, project, browser, and connector status commands
  • /stop control that uses the same hard-stop operation as the WebUI composer button
  • Slash picker in the chat composer with keyboard navigation and create-on-empty flow

Command File Model

Each command is defined by one config file plus one content file in the same scope directory. Set webui_hidden: true to keep a command resolvable while omitting it from the chat composer picker.

Example text command:

scan.command.yaml

name: scan
description: Scan a Git repository.
argument_hint: /scan --git-url https://github.com/org/repo
type: text
template_path: scan.txt

scan.txt

Please scan repository: {args.flags.git_url}

Raw input:
{raw}

Example python hook command:

optimize.command.yaml

name: optimize
description: Optimize the current request.
argument_hint: /optimize 30%
type: script
script_path: optimize.py
include_history: true

optimize.py

def run(payload):
    args = payload["arguments"]
    pct = args["positional"][0] if args["positional"] else "10%"
    return {
        "text": f"Optimize this response by {pct}.",
        "effects": [],
    }

Argument Parsing

The parser supports:

  • Positional input: /scan https://github.com/org/repo
  • Postfix input: https://github.com/org/repo /scan
  • Long flags: /scan --git-url https://github.com/org/repo
  • Long flags with equals: /scan --git-url=https://github.com/org/repo
  • Short flags and bundles: /scan -v -q or /scan -vq

Parsed data is available to:

  • Text templates via {} placeholders:
    • {raw}
    • {args.positional.0}
    • {args.flags.git_url}
  • Python scripts via payload["arguments"]

Script Hook Contract

Python hook file must expose:

def run(payload): ...

It can return:

  • str (used as replacement text)
  • dict with:
    • text: str (replacement text)
    • effects: list[dict]

Supported frontend effects:

  • {"type": "replace_input", "text": "..."}
  • {"type": "append_input", "text": "..."}
  • {"type": "toast", "level": "info|error|success", "message": "..."}
  • Built-in UI effects for existing WebUI actions such as chat switching, modals, attachments, compaction, queue actions, transcript copy, and toast output

Scope Resolution

Commands are discovered from these scope folders:

  • Project: usr/projects/<project>/.a0proj/plugins/_commands/commands/
  • Global fallback: usr/plugins/_commands/commands/
  • Built-in defaults: plugins/_commands/commands/
  • Other enabled plugins: plugins/<plugin>/commands/ or usr/plugins/<plugin>/commands/

Precedence in the chat picker:

  1. Project
  2. Global
  3. Built-in _commands
  4. Other plugin-distributed commands

Legacy Community Plugin Migration

When the built-in _commands plugin starts, it migrates files from the older community commands plugin namespace:

  • Copies usr/plugins/commands/commands/ into usr/plugins/_commands/commands/
  • Copies usr/plugins/commands/skills/ into usr/plugins/_commands/skills/
  • Copies project and agent scoped plugins/commands/commands/ folders to matching plugins/_commands/commands/ folders
  • Skips existing destination files
  • Disables the legacy commands plugin roots so the WebUI does not load two slash-command popovers

UI Surfaces

  • Plugin modal: manage project/global commands and create editable same-name overrides of bundled commands
  • Chat composer: type / at the start or as the final token to browse commands

Agent Skill

The plugin ships with commands-create-slash-command, a plugin-scoped skill that helps Agent Zero create or update command files.