agent-zero/api/stop.py.dox.md
frdel bebe6826cf
Some checks failed
Build And Publish Docker Images / plan (push) Has been cancelled
Build And Publish Docker Images / build (push) Has been cancelled
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

1.4 KiB

stop.py DOX

Purpose

  • Own the authenticated WebUI endpoint that stops an active agent run without deleting or resetting its chat context.

Ownership

  • stop.py resolves the requested in-memory context and exposes the shared stop_context() operation used by the endpoint and slash command.

Runtime Contracts

  • Stop derives from ApiHandler, retaining the default authentication and CSRF protections.
  • Input uses the selected chat ID in context; the endpoint never creates a missing context.
  • Stopping cancels the context task through AgentContext.kill_process(), clears pause state, preserves chat history and queued messages, and does not start another run.
  • The endpoint clears active progress and logs a terminal Agent process stopped. info step so the WebUI closes the interrupted process group.
  • The response contains message, context, and a stopped boolean indicating whether the context was running when requested.
  • Other authenticated entry points should call stop_context() so cancellation, progress cleanup, and terminal logging remain identical to the Stop button.

Work Guidance

  • Keep this endpoint aligned with the composer stop-button state and the existing AgentContext task lifecycle.

Verification

  • Run pytest tests/test_stop_agent.py and smoke-test stopping during model streaming and tool execution.

Child DOX Index

No child DOX files.