Interface NaruInputRequest


public interface NaruInputRequest
A pending question the core needs answered before a task can continue.

The core does not care how the answer arrives. A terminal implementation blocks a readline thread; a web implementation pushes the prompt to a browser and calls deliver(String) minutes later from an HTTP handler. Both are the same event.

Exactly one terminal call

A request must be answered with exactly one of deliver(String) or cancel(String). Later calls are ignored, so a browser that reconnects and replays a submission cannot resume a task twice. Implementations are expected to be callable from any thread.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    cancel(String reason)
    Abandons the question because no answer will come — the user closed the tab, the websocket dropped, the host is shutting down.
    void
    Answers the question and lets the task continue.
    The question to put to the user, already formatted by the core.
    The task blocked on this answer.
  • Method Details

    • prompt

      NMsg prompt()
      The question to put to the user, already formatted by the core.
    • task

      NaruTask task()
      The task blocked on this answer.
    • deliver

      void deliver(String line)
      Answers the question and lets the task continue.
      Parameters:
      line - what the user typed. May be empty, but not null.
    • cancel

      void cancel(String reason)
      Abandons the question because no answer will come — the user closed the tab, the websocket dropped, the host is shutting down. The task is terminated rather than left blocked forever, since nothing would ever resume it.