跳转到正文

inventory API ​

完整接口目录 · 库存与物品用法 · 工具包下载

模块说明 ​

text
Robot inventory intent builders; observation and active refresh stay separate.

Inventory ​

python
class Inventory

SDK 说明:

text
Prepare intents, or compose passive reads with observe_context.

Persist each standalone intent before submitting with Operations.

observe retains native unknown/empty/occupied evidence. read is the older
cache-slot API and must not be used as a native HeldItemRef source. refresh
changes screen state and requires its own world-write permission.

Inventory.__init__ ​

python
def __init__(self, operations: Operations)

Inventory.observe_context ​

python
async def observe_context(
    self,
    *,
    idempotency_key: str,
    deadline: str,
    journal,
    timeout: float = 6,
) -> dict

SDK 说明:

text
Compose three passive reads with retained intents and native identity.

Caller owns durable once admission; journal must persist each record.
No refresh, retry, new packet guarantee, or atomic snapshot is implied.
See :mod:`neomega_runtime.inventory_context` for the complete contract.

Inventory.observe ​

python
def observe(
    self,
    window_id: int,
    *,
    idempotency_key: str,
    deadline: str,
) -> OperationIntent

SDK 说明:

text
Prepare passive native evidence for main 0, offhand 119 or armour 120.

Inventory.read ​

python
def read(
    self,
    window_id: int,
    slot: int,
    *,
    idempotency_key: str,
    deadline: str,
) -> OperationIntent

SDK 说明:

text
Prepare the existing cached-slot read; missing cache is not empty proof.

Inventory.refresh ​

python
def refresh(
    self,
    window_id: int,
    *,
    idempotency_key: str,
    deadline: str,
) -> OperationIntent

SDK 说明:

text
Explicitly prepare one bounded screen open/close observation attempt.

Success acknowledges the lifecycle; inspect fresh_complete separately.
An unknown result retains its recovery fence and must never be replayed.

Inventory.layout ​

python
@staticmethod
def layout(snapshot: dict, *, max_age_ms: int, at: str | None=None) -> dict

SDK 说明:

text
Return explicit slot sections and freshness; retain original evidence.

Inventory.move ​

python
def move(
    self,
    source_slot: int,
    destination_slot: int,
    count: int,
    *,
    expected_source_stack_id: int,
    expected_destination_stack_id: int = 0,
    idempotency_key: str,
    deadline: str,
) -> OperationIntent

SDK 说明:

text
Move count into an observed empty slot; count below source splits it.

Inventory.split ​

python
def split(
    self,
    source_slot: int,
    destination_slot: int,
    count: int,
    *,
    expected_source_stack_id: int,
    idempotency_key: str,
    deadline: str,
) -> OperationIntent

SDK 说明:

text
Explicit-count Take into empty destination; caller retains source count.

Inventory.merge ​

python
def merge(
    self,
    source_slot: int,
    destination_slot: int,
    count: int,
    *,
    expected_source_stack_id: int,
    expected_destination_stack_id: int,
    expected_source_fingerprint: str,
    expected_destination_fingerprint: str,
    expected_source_count: int,
    expected_destination_count: int,
    destination_count_limit: int,
    idempotency_key: str,
    deadline: str,
) -> OperationIntent

SDK 说明:

text
Merge exact compatible stacks, respecting the explicit retained bound.

Inventory.swap ​

python
def swap(
    self,
    source_slot: int,
    destination_slot: int,
    *,
    expected_source_stack_id: int,
    expected_destination_stack_id: int,
    expected_source_fingerprint: str,
    expected_destination_fingerprint: str,
    idempotency_key: str,
    deadline: str,
) -> OperationIntent

SDK 说明:

text
Swap two exactly referenced occupied stacks in bot window 0.

Inventory.operations ​

python
self.operations

公开实例属性,在 __init__ 中设置。

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