mirror of
https://github.com/usestrix/strix.git
synced 2026-08-25 04:12:37 +02:00
fix: pre-v1-style lifecycle resilience — mailbox delivery, uniform revival, unexitable runner, waiting timeout, broader retries, crash-safe identity (#923)
This commit is contained in:
@@ -7,6 +7,7 @@ import logging
|
||||
from typing import TYPE_CHECKING, Any, cast
|
||||
from weakref import WeakKeyDictionary
|
||||
|
||||
from agents.items import ItemHelpers
|
||||
from agents.memory import SQLiteSession
|
||||
|
||||
|
||||
@@ -26,6 +27,18 @@ def open_agent_session(agent_id: str, path: Path) -> SQLiteSession:
|
||||
return SQLiteSession(session_id=agent_id, db_path=path)
|
||||
|
||||
|
||||
async def seed_initial_input(session: Session, initial_input: Any) -> bool:
|
||||
"""Commit an agent's opening identity/task input before its first run cycle."""
|
||||
items = ItemHelpers.input_to_new_input_list(initial_input)
|
||||
if not items:
|
||||
return False
|
||||
async with session_write_lock(session):
|
||||
if await session.get_items():
|
||||
return False
|
||||
await session.add_items(items)
|
||||
return True
|
||||
|
||||
|
||||
_IMAGE_REJECTED_TEXT = "[image rejected by the model]"
|
||||
_IMAGE_ELIDED_TEXT = "[older screenshot elided to bound context memory]"
|
||||
_INHERITED_IMAGE_TEXT = "[screenshot omitted from inherited context]"
|
||||
|
||||
Reference in New Issue
Block a user