Interface AsyncToolRegistry

All Known Implementing Classes:
WorkspaceAsyncToolRegistry

public interface AsyncToolRegistry
Registry for tracking async tool executions that have been offloaded to the background.

When a tool execution exceeds the configured timeout, AsyncToolMiddleware registers it here. The registry tracks the tool's lifecycle so that:

  • On normal completion, the record is updated and the result delivered via inbox
  • On process crash/restart, stale RUNNING records can be detected and cleaned up

Implementations:

  • WorkspaceAsyncToolRegistry — single-process, suitable for testing
  • Method Summary

    Modifier and Type
    Method
    Description
    reactor.core.publisher.Mono<Void>
    complete(String id, String result)
    Mark an async tool execution as completed.
    reactor.core.publisher.Mono<Void>
    fail(String id, String error)
    Mark an async tool execution as failed.
    reactor.core.publisher.Mono<List<AsyncToolRecord>>
    findStale(String sessionId, Duration ttl)
    Find async tool records for the given session that have been in RUNNING status longer than the specified TTL.
    reactor.core.publisher.Mono<Void>
    Mark a stale async tool record as timed out.
    reactor.core.publisher.Mono<Void>
    Register a new async tool execution.
  • Method Details

    • register

      reactor.core.publisher.Mono<Void> register(AsyncToolRecord record)
      Register a new async tool execution.
      Parameters:
      record - the async tool record with status AsyncToolRecord.RUNNING
    • complete

      reactor.core.publisher.Mono<Void> complete(String id, String result)
      Mark an async tool execution as completed.
      Parameters:
      id - the async tool record id
      result - the tool execution result text
    • fail

      reactor.core.publisher.Mono<Void> fail(String id, String error)
      Mark an async tool execution as failed.
      Parameters:
      id - the async tool record id
      error - the error message
    • findStale

      reactor.core.publisher.Mono<List<AsyncToolRecord>> findStale(String sessionId, Duration ttl)
      Find async tool records for the given session that have been in RUNNING status longer than the specified TTL. These are likely orphaned due to process crash.
      Parameters:
      sessionId - the session to check
      ttl - records older than this duration are considered stale
      Returns:
      stale RUNNING records
    • markTimeout

      reactor.core.publisher.Mono<Void> markTimeout(String id)
      Mark a stale async tool record as timed out. Prevents it from being returned by subsequent findStale(java.lang.String, java.time.Duration) calls.
      Parameters:
      id - the async tool record id