Package net.thevpc.naru.api.agent
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 ofdeliver(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 TypeMethodDescriptionvoidAbandons the question because no answer will come — the user closed the tab, the websocket dropped, the host is shutting down.voidAnswers the question and lets the task continue.prompt()The question to put to the user, already formatted by the core.task()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
Answers the question and lets the task continue.- Parameters:
line- what the user typed. May be empty, but not null.
-
cancel
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.
-