← Về thư mục
openai4s/storage/actions.py
- ActionEventDTO · class · L89-L104 — class ActionEventDTO(TypedDict)
- ActionGroupDTO · class · L107-L124 — class ActionGroupDTO(TypedDict)
- ExecutionAttemptDTO · class · L127-L144 — class ExecutionAttemptDTO(TypedDict)
- AttemptStateError · class · L147-L148 — class AttemptStateError(RuntimeError)
- _json_dump · function · L151-L161 — def _json_dump(value: Any) -> str | None
- _json_load · function · L164-L172 — def _json_load(value: str | None) -> Any
- _required_text · function · L175-L178 — def _required_text(name: str, value: str) -> str
- _ordinal · function · L181-L184 — def _ordinal(name: str, value: int) -> int
- _optional_cost_usd · function · L187-L195 — def _optional_cost_usd(value: Any) -> float | None
- _optional_usage · function · L198-L203 — def _optional_usage(value: Any) -> dict[str, Any] | None
- ActionLedgerRepository · class · L206-L1072 — class ActionLedgerRepository
- init · method · L209-L223 — def init( self, connection: sqlite3.Connection, lock: Any, *, clock_ms: Callable[[], int], admit_action_group: Callable[[str, str], None] | None = None, admit_action_scope: Callable[[str, str, str], None] | None = None, ) -> None
- _install_schema · method · L225-L261 — def _install_schema(self) -> None
- append_group · method · L264-L326 — def append_group( self, *, root_frame_id: str, turn_id: str, kind: str, branch_id: str | None = None, ordinal: int | None = None, provider: str | None = None, model: str | None = None, wire_state: Any = None, assistant_content: str | None = None, assistant_message: Any = None, usage: dict[str, Any] | None = None, cost_usd: float | None = None, group_id: str | None = None, created_at: int | None = None, ) -> ActionGroupDTO
- append_event · method · L328-L382 — def append_event( self, *, group_id: str, type: str, sequence: int | None = None, action_id: str | None = None, tool_call_id: str | None = None, wire_id: str | None = None, canonical_arguments: Any = None, raw_arguments: Any = None, result: Any = None, side_effect_class: str | None = None, resource_keys: list[str] | tuple[str, ...] | None = None, event_id: str | None = None, created_at: int | None = None, ) -> ActionEventDTO
- append_tool_group · method · L384-L489 — def append_tool_group( self, *, root_frame_id: str, turn_id: str, events: list[dict[str, Any]], branch_id: str | None = None, ordinal: int | None = None, provider: str | None = None, model: str | None = None, wire_state: Any = None, assistant_content: str | None = None, assistant_message: Any = None, usage: dict[str, Any] | None = None, cost_usd: float | None = None, group_id: str | None = None, created_at: int | None = None, kind: str = "native_tools", admission_operation: str = "tool_action_group:append", ) -> ActionGroupDTO
- get_group · method · L491-L511 — def get_group( self, group_id: str, *, include_events: bool = True ) -> ActionGroupDTO | None
- list_groups · method · L513-L577 — def list_groups( self, root_frame_id: str, *, branch_id: str | None = None, turn_id: str | None = None, after_ordinal: int | None = None, limit: int | None = None, include_events: bool = True, ) -> list[ActionGroupDTO]
- list_events · method · L579-L586 — def list_events(self, group_id: str) -> list[ActionEventDTO]
- allocate_attempt · method · L589-L648 — def allocate_attempt( self, *, group_id: str, producing_cell_id: str, state_revision: int | None = None, generation_id: str | None = None, owner_instance_id: str | None = None, replayed_from_cell_id: str | None = None, attempt_ordinal: int | None = None, attempt_id: str | None = None, allocated_at: int | None = None, ) -> ExecutionAttemptDTO
- abandon_incomplete_attempts · method · L650-L691 — def abandon_incomplete_attempts( self, *, owner_instance_id: str, finished_at: int | None = None, ) -> int
- mark_attempt_started · method · L693-L701 — def mark_attempt_started( self, attempt_id: str, *, started_at: int | None = None ) -> ExecutionAttemptDTO
- bind_attempt_generation · method · L703-L739 — def bind_attempt_generation( self, attempt_id: str, generation_id: str ) -> ExecutionAttemptDTO
- mark_attempt_response · method · L741-L749 — def mark_attempt_response( self, attempt_id: str, *, response_at: int | None = None ) -> ExecutionAttemptDTO
- mark_attempt_capture · method · L751-L759 — def mark_attempt_capture( self, attempt_id: str, *, capture_at: int | None = None ) -> ExecutionAttemptDTO
- finish_attempt · method · L761-L805 — def finish_attempt( self, attempt_id: str, *, terminal_state: str, error: Any = None, finished_at: int | None = None, ) -> ExecutionAttemptDTO
- get_attempt · method · L807-L814 — def get_attempt(self, attempt_id: str) -> ExecutionAttemptDTO | None
- list_attempts · method · L816-L856 — def list_attempts( self, *, group_id: str | None = None, producing_cell_id: str | None = None, root_frame_id: str | None = None, branch_id: str | None = None, turn_id: str | None = None, ) -> list[ExecutionAttemptDTO]
- _mark_attempt_milestone · method · L859-L905 — def _mark_attempt_milestone( self, attempt_id: str, *, column: str, at: int | None, prerequisite: str | None, ) -> ExecutionAttemptDTO
- _assert_action_group_admitted_locked · method · L907-L911 — def _assert_action_group_admitted_locked( self, group_id: str, operation: str ) -> None
- _validate_timestamp · method · L914-L923 — def _validate_timestamp(row: Any, column: str, value: int) -> None
- _insert_group_locked · method · L925-L947 — def _insert_group_locked(self, **values: Any) -> None
- _insert_event_locked · method · L949-L973 — def _insert_event_locked(self, **values: Any) -> None
- latest_group_ordinal · method · L975-L1003 — def latest_group_ordinal( self, root_frame_id: str, *, branch_id: str | None = None, kind: str | None = None, ) -> int | None
- _next_group_ordinal_locked · method · L1005-L1011 — def _next_group_ordinal_locked(self, root_frame_id: str, branch_id: str) -> int
- _next_event_sequence_locked · method · L1013-L1019 — def _next_event_sequence_locked(self, group_id: str) -> int
- _require_group_locked · method · L1021-L1028 — def _require_group_locked(self, group_id: str) -> None
- _group_row_locked · method · L1030-L1036 — def _group_row_locked(self, group_id: str) -> Any
- _attempt_row_locked · method · L1038-L1044 — def _attempt_row_locked(self, attempt_id: str) -> Any
- _normalize_event · method · L1047-L1053 — def _normalize_event(row: Any) -> ActionEventDTO
- _normalize_group · method · L1056-L1062 — def _normalize_group(row: Any, *, events: list[ActionEventDTO]) -> ActionGroupDTO
- _normalize_attempt · method · L1065-L1072 — def _normalize_attempt(row: Any) -> ExecutionAttemptDTO