跳转到正文

selection_recipe API ​

完整接口目录 · 物品动作用法 · 工具包下载

模块说明 ​

text
One explicit hotbar selection, ordered recording, and offline evidence checks.

This composes ItemActions rather than owning a recipe engine or another reader.
The observer may belong to another robot; a local writer is not promised its own
MobEquipment echo. Observation and the durable operation receipt stay separate.

HotbarSelection ​

python
@dataclass
class HotbarSelection

SDK 说明:

text
A retained one-shot attempt; construct with prepare(), never for recovery.

Keep the same cooperative controller lock for preparation and dispatch.
journal(record) must durably store the original intent before returning.
Retain this instance and its action after any exception. Reconcile original
IDs/keys after a crash; creating a new recipe is not crash recovery.

字段(包含继承字段):

HotbarSelection.action ​

python
action: object

数据类字段;声明于 selection_recipe.HotbarSelection。

HotbarSelection.started ​

python
started: bool = False

数据类字段;声明于 selection_recipe.HotbarSelection。

HotbarSelection.observed ​

python
observed: bool = False

数据类字段;声明于 selection_recipe.HotbarSelection。

HotbarSelection.archive_summary ​

python
archive_summary: dict = field(default=None, repr=False)

数据类字段;声明于 selection_recipe.HotbarSelection。

该类型另有以下内部字段,参与数据类声明但不建议直接读写;创建对象时优先使用专题中的工厂方法:

python
_actions: ItemActions = field(repr=False)
_reference: dict = field(repr=False)
_expected: dict = field(repr=False)

HotbarSelection.prepare ​

python
@classmethod
def prepare(
    cls,
    actions,
    inventory,
    slot,
    *,
    entity_runtime_id,
    idempotency_key,
    deadline,
)

HotbarSelection.record ​

python
def record(self)

SDK 说明:

text
JSON-safe state; contains private intent but never raw packet bodies.

HotbarSelection.dispatch ​

python
async def dispatch(
    self,
    *,
    observer_packets,
    journal,
    output,
    expected_epoch = None,
    observer_session = None,
    timeout = 5,
    max_events = 1000,
    max_bytes = 8 << 20,
)

SDK 说明:

text
Initialize observer, save intent, submit once, and keep one reader.

``observer_packets`` implements Packets.open(). Its stream is owned and
closed here; never attach a concurrent listener. ``output`` is a private
text file for the shared JSONL recorder. Callbacks and receipts are not
logged to stderr. The budget never cancels a normal in-flight poll RPC;
transport timeout and close may add time beyond the collection budget.

inspect_selection_recording ​

python
def inspect_selection_recording(source)

SDK 说明:

text
Re-run the live matcher without a Host, connection, operation or send.

A truncated/faulted recording stays incomplete even if a matching packet
exists. This is archived evidence, not a fresh server state or replay plan.

main ​

python
def main()

SDK 说明:

text
Local-only CLI: python -m neomega_runtime.selection_recipe ARCHIVE.

Neomega · 使用、开发与参考文档