ConstOptionalbaseDir: stringImplements the async iterator protocol for iterating over entities.
Delegates to the values method for iteration, enabling for await loops over entities.
ReadonlybaseDir: stringReadonlyentityName: EntityNameReads an entity from storage by its ID, parsing it from a JSON file.
Core method for retrieving persisted data (e.g., alive status for a SessionId in a SwarmName context).
Iterates over all entities in storage, sorted numerically by ID.
Yields entities in ascending order, useful for batch processing (e.g., listing all SessionIds in a SwarmName).
Initializes the storage directory, creating it if it doesn’t exist, and validates existing entities.
Removes invalid JSON files during initialization to ensure data integrity (e.g., for SwarmName-based alive status).
Writes an entity to storage with the specified ID, serializing it to JSON.
Uses atomic file writing via writeFileAtomic to ensure data integrity (e.g., persisting AgentName for a SwarmName).
Base class for persistent storage of entities in the swarm system, using the file system. Provides foundational methods for reading, writing, and managing entities as JSON files, supporting swarm utilities like
PersistAliveUtils.