mirror of
https://github.com/agent0ai/agent-zero.git
synced 2026-07-29 18:53:35 +00:00
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.
4 KiB
4 KiB
Commands Plugin DOX
Purpose
- Own the built-in slash command manager and chat composer slash picker.
- Keep file-backed
/commanddiscovery consistent across project, global, and plugin-provided scopes.
Ownership
plugin.yamlowns the built-in_commandsplugin metadata.helpers/commands.pyowns command name sanitization, argument parsing, scope resolution, file persistence, plugin command discovery, and command invocation resolution.api/commands.pyowns the Commands API actions used by the WebUI.webui/owns the manager/editor modal stores, HTML surfaces, and thumbnail asset.commands/owns bundled read-only slash command definitions shipped by_commands, including/stopagent-run control.extensions/owns the chat composer slash picker and incoming-message command resolution.extensions/python/startup_migration/owns one-time migration from the legacy communitycommandsplugin namespace.skills/commands-create-slash-command/owns the agent-facing authoring workflow for reusable slash commands.tests/owns regression coverage for parsing, CRUD, scope precedence, plugin-distributed commands, legacy migration, and skill discovery.
Local Contracts
- The plugin identity is
_commands; user-created command files live underusr/plugins/_commands/commands/orusr/projects/<project>/.a0proj/plugins/_commands/commands/. - Each command is one
.command.yamlconfig plus one same-directory.txttext template or.pyscript hook. - Project commands override global commands, global commands override bundled
_commands/commands/defaults, and bundled defaults override other plugin-distributed commands with the same name. - Bundled
_commands/commands/definitions and commands contributed by other plugins are read-only from this manager. - The manager lists bundled commands separately; editing one copies it unchanged into the selected project or global scope under the same name, then edits that higher-precedence override.
- Bundled command files use canonical command names only; do not ship alias-only built-ins such as
/imgfor/attach. - Command configs may set
webui_hidden: trueto stay resolvable but be omitted from the chat composer picker. - Commands contributed by enabled plugins live in their
commands/directory and must not be rediscovered through the generic plugin-distributed path from_commandsitself. - On startup,
_commandscopies legacyusr/plugins/commandscommand and skill files intousr/plugins/_commandswithout overwriting existing files, copies scoped legacy command folders to_commands, and disables the legacycommandsplugin roots to prevent duplicate WebUI popovers. - Script commands must expose
run(payload)and return a string or a dict withtextand optionaleffects;show_markdowneffects render as auto-dismissing toast notifications. - Script commands may emit
send_messagewithtextto submit the rendered composer text immediately after command resolution. - Commands accept prefix syntax (
/goal objective) and exact postfix syntax (objective /goal); ordinary mid-sentence mentions are not invocations. - WebUI sends resolve through the picker effect path, while backend-originated messages resolve before reaching the agent.
/stopuses the same shared cancellation operation as the composer Stop button, including progress cleanup and terminal logging.- Built-in
/computer-use on|offemits a boundedcomputer_useeffect. WebUI only directs the user to Host access in A0 Launcher or the same command in A0 CLI; it never changes a Launcher gateway lease from Agent Zero page content.
Work Guidance
- Keep the command storage and route namespace aligned with
_commands. - Preserve unknown command config keys when editing commands.
- Keep built-in source files immutable; user edits must be same-name scope overrides.
- Keep WebUI paths pointed at
/plugins/_commands/....
Verification
- Run
conda run -n a0 pytest plugins/_commands/testsafter backend or command contract changes.
Child DOX Index
No child DOX files.