载入中...
搜索中...
未找到
SequenceRuntime.h
浏览该文件的文档.
54using SequenceCommandHandler = std::function<SequenceCommandResponse(const SequenceCommandRequest&)>;
86 enum class EventKind : std::uint8_t { Started, NodeEntered, Blocked, Stepped, Resumed, Ended, Failed };
117 [[nodiscard]] eve::Result<void> start(const SequenceAsset* asset, eve::Value bindings = eve::Value::Object{});
163 [[nodiscard]] eve::Result<void> resumeCommand(std::string_view requestId, eve::StateValue result);
188 void setConditionEvaluator(ConditionEvaluator evaluator) { conditionEvaluator_ = std::move(evaluator); }
196 void setCommandDispatcher(SequenceCommandHandler dispatcher) { commandDispatcher_ = std::move(dispatcher); }
232 [[nodiscard]] const std::string& pendingCommandRequestId() const noexcept { return pendingCommandRequestId_; }
271 [[nodiscard]] eve::Result<void> fail(eve::DiagnosticCode code, std::string message, std::string path = {});
275 [[nodiscard]] eve::Result<void> resumeCommandImpl(std::string_view requestId, eve::Value result);
Move-only, checked operation results for the common layer.
Domain-neutral compiled sequence graph for `.dnut` sources.
Extensible step vocabulary, payload schema and dispatch.
Owning, renderer-independent dynamic values.
Caller-owned interpreter over a compiled sequence asset.
Definition SequenceRuntime.h:67
void setCommandDispatcher(SequenceCommandHandler dispatcher)
Install the catch-all command dispatcher used after named lookup.
Definition SequenceRuntime.h:196
std::function< void(const Event &)> EventSink
Single event outlet; invoked synchronously without locks.
Definition SequenceRuntime.h:97
bool isWaitingStep() const
Whether the suspension is a step awaiting resumeStep.
Definition SequenceRuntime.h:214
void setEventSink(EventSink sink)
Definition SequenceRuntime.h:207
std::function< const SequenceAsset *(const std::string &)> AssetResolver
Resolves a called asset id to a borrowed, externally owned asset.
Definition SequenceRuntime.h:75
void setHostContext(void *host)
Install the opaque consumer context forwarded to every step handler.
Definition SequenceRuntime.h:206
void setConditionEvaluator(ConditionEvaluator evaluator)
Definition SequenceRuntime.h:188
bool isBlocked() const
Whether execution is suspended and awaiting host acknowledgement.
Definition SequenceRuntime.h:212
void clearCommandDispatcher()
Remove the catch-all command dispatcher.
Definition SequenceRuntime.h:198
const std::string & pendingCommandRequestId() const noexcept
Stable id of the blocked command, or an empty string.
Definition SequenceRuntime.h:232
const std::string & currentNodeId() const
Definition SequenceRuntime.h:221
bool isWaitingCommand() const
Whether the suspension is a command awaiting resumeCommand.
Definition SequenceRuntime.h:216
std::function< SequenceConditionOutcome(const eve::Value &)> ConditionEvaluator
Evaluates one authored condition value.
Definition SequenceRuntime.h:83
void setStepRegistry(const StepKindRegistry *registry)
Bind the step vocabulary; passing nullptr disables non-core steps.
Definition SequenceRuntime.h:190
const SequenceConditionOutcome * lastConditionResult() const
Last evaluated condition outcome.
Definition SequenceRuntime.h:238
const SequenceCommandRequest * lastCommandRequest() const
Last emitted command request, or nullptr when none has been emitted.
Definition SequenceRuntime.h:228
const SequenceAsset * asset() const
Borrowed active asset, or nullptr. @lifetime Owned by the caller of start.
Definition SequenceRuntime.h:218
const eve::Value & lastStepResult() const
Value supplied by the most recent resumeStep.
Definition SequenceRuntime.h:226
const eve::Value & bindings() const
Definition SequenceRuntime.h:222
void setAssetResolver(AssetResolver resolver)
Definition SequenceRuntime.h:187
Canonical step vocabulary owner and runtime handler router.
Definition StepKindRegistry.h:108
Definition ConversationDialect.cpp:13
std::function< SequenceCommandResponse(const SequenceCommandRequest &)> SequenceCommandHandler
Synchronous owner-thread handler for one command request.
Definition SequenceRuntime.h:54
@ Failed
Immutable, parameterized and versioned compiled sequence.
Definition SequenceAsset.h:77
Immutable request emitted by a generic command node.
Definition SequenceRuntime.h:33
eve::Value payload
Complete owning command payload for domain-specific decoding.
Definition SequenceRuntime.h:40
Structured response returned by a generic command handler.
Definition SequenceRuntime.h:44
Outcome of one authored condition, as seen by the language core.
Definition SequenceRuntime.h:24
std::string error
Evaluation failure; non-empty means no route may be selected.
Definition SequenceRuntime.h:29
std::string reason
Stable machine-readable reason; empty when passed is true.
Definition SequenceRuntime.h:27
One observable transition; every field is owned by the event.
Definition SequenceRuntime.h:89