+
    Q(i                         R t ^ RIt^ RIt^ RIHt ^ RIt^ RIHt ^ RIH	t	 ^ RI
Ht ]! R4      t]! 4       t]P                  ! RRR	7      tR
 R lt]P"                  RR R ll4       tR# )z-FastMCP tasks CLI for Docket task management.N)	Annotated)Console)load_and_merge_config)
get_loggerz	cli.taskstasksz,Manage FastMCP background tasks using Docket)namehelpc                    V ^8  d   QhRR/# )   returnN )formats   "W/Users/agent/.openclaw/workspace/venv/lib/python3.14/site-packages/fastmcp/cli/tasks.py__annotate__r      s     # #4 #    c                     ^ RI p V P                  P                  P                  pVP	                  R4      '       d.   \
        P                  R4       \        P                  ! ^4       R# R# )zCheck if Docket is configured with a distributed backend.

The CLI worker runs as a separate process, so it needs Redis/Valkey
to coordinate with the main server process.

Raises:
    SystemExit: If using memory:// URL
Nz	memory://up  [bold red]✗ In-memory backend not supported by CLI[/bold red]

Your Docket configuration uses an in-memory backend (memory://) which
only works within a single process.

To use [cyan]fastmcp tasks[/cyan] CLI commands (which run in separate
processes), you need a distributed backend:

[bold]1. Install Redis or Valkey:[/bold]
   [dim]macOS:[/dim]     brew install redis
   [dim]Ubuntu:[/dim]    apt install redis-server
   [dim]Valkey:[/dim]    See https://valkey.io/

[bold]2. Start the service:[/bold]
   redis-server

[bold]3. Configure Docket URL:[/bold]
   [dim]Environment variable:[/dim]
   export FASTMCP_DOCKET_URL=redis://localhost:6379/0

[bold]4. Try again[/bold]

The memory backend works great for single-process servers, but the CLI
commands need a distributed backend to coordinate across processes.

Need help? See: [cyan]https://gofastmcp.com/docs/tasks[/cyan])	fastmcpsettingsdocketurl
startswithconsoleprintsysexit)r   
docket_urls     r   check_distributed_backendr      sU     !!((,,J [))L	
( 	+ *r   c                z    V ^8  d   QhR\         \        R,          \        P                  ! RR7      3,          RR/# )r
   server_specNzWPython file to run, optionally with :object suffix, or None to auto-detect fastmcp.json)r   r   )r   strcyclopts	Parameter)r   s   "r   r   r   =   s@     1 1d
j	
	1 
1r   c                  aa ^ RI o\        4         \        V 4      w  r\        P                  ! XP                  P                  4       4      oVV3R lp \        P                  ! V! 4       4       R#   \         d    \        P
                  ! ^4        Lvi ; i  \         d0    \        P                  R4       \        P
                  ! ^ 4        R# i ; i)a0  Start an additional worker to process background tasks.

Connects to your Docket backend and processes tasks in parallel with
any other running workers. Configure via environment variables
(FASTMCP_DOCKET_*).

Example:
    fastmcp tasks worker server.py
    fastmcp tasks worker examples/tasks/server.py
Nc                 \  <"   SP                  4       ;_uu_4       GRj  xL
  \        P                  RSP                   R24       \        P                  RS P                  P
                  P                   24       \        P                  RS P                  P
                  P                   24       \        P                  RS P                  P
                  P                   24        \        P                  ! R4      G Rj  xL
  K!   L L  + GRj  xL 
 '       g   i     R# ; i5i)z'Enter server lifespan and camp forever.Nu7   [bold green]✓[/bold green] Starting worker for [cyan]z[/cyan]z
  Docket: z  Backend: z  Concurrency: i  )
_lifespan_managerr   r   r   r   r   r   concurrencyasynciosleep)r   servers   r   
run_workerworker.<locals>.run_worker\   s     ++---MMI&++V]^ MMJw'7'7'>'>'C'C&DEFMMK(8(8(?(?(C(C'DEFMMOG,<,<,C,C,O,O+PQR mmD))) . * .---sK   D,DD,C DDDD,DD)	D
D)	!D)	#	D,z 
[yellow]Worker stopped[/yellow])r   r   r   FileNotFoundErrorr   r   r&   runsourceload_serverKeyboardInterruptr   r   )r   config_resolved_specr)   r   r(   s   &   @@r   workerr2   <   s    & !6{!C
 [[2245F*JL!+  ,  9:s#   A2 B 2!BB6CC)N)__doc__r&   r   typingr   r    rich.consoler   fastmcp.utilities.clir   fastmcp.utilities.loggingr   loggerr   App	tasks_appr   commandr2   r   r   r   <module>r<      sb    3  
     7 0	K	 
)LL		7	#L 1 1r   